↓ Skip to main content
  1. Home projects/

milInterface: a Matrox frame grabber in LabVIEW

··
Table of Contents

LabVIEW is good at instrument control, but talking to a Matrox frame grabber means using the Matrox Imaging Library (MIL) from C. milInterface is a thin C++ DLL in between: LabVIEW calls a handful of 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 into the buffers
is_grabbing(), get_num_grabbed()Lets 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 (MdigGrab / MdigGrabWait into the buffer ring), so LabVIEW stays responsive while frames arrive, and the copy into LabVIEW’s memory happens only for the frames it asks for. Every MIL allocation step has its own error code, which makes a misconfigured camera easy to diagnose from the LabVIEW side.

The repository also has LabVIEW test VIs and Python scripts for the MIL Python bindings, used to check the camera and the configuration outside LabVIEW.

Tech: C++, Matrox Imaging Library, Visual Studio 2017, LabVIEW, Python. Source on GitHub.

Related