↓ Skip to main content
  1. Home projects/

milInterface: a Matrox frame grabber in LabVIEW

··
Table of Contents

LabVIEW is good at instrument control. A Matrox frame grabber needs the Matrox Imaging Library (MIL), which is a C library. milInterface is a thin C++ DLL between them. LabVIEW calls a few plain C functions and the DLL does the MIL work.

The interface
#

FunctionWhat it does
initialize(dcf_path, max_frames)Starts MIL, opens the frame grabber with a camera configuration file (DCF) and allocates a ring of image buffers
start(n)Starts an asynchronous grab of n frames
is_grabbing(), get_num_grabbed()Let LabVIEW poll the progress without blocking
get_frame_size()Size of one frame in bytes, so LabVIEW can allocate its array
get(frame, buffer, size)Copies one grabbed frame into a LabVIEW array (8- or 16-bit pixels)
destroy()Frees everything

The grab runs asynchronously, so LabVIEW stays responsive while frames arrive. Only the frames LabVIEW asks for are copied into its memory. Every MIL allocation step has its own error code, so a misconfigured camera is easy to diagnose from the LabVIEW side.

The repository also has LabVIEW test VIs and Python scripts that check the camera and configuration outside LabVIEW.

Source on GitHub.

Related