Acquire Images from Matrox Frame Grabbers
Create the matroxcam Object
To acquire images from a Matrox frame grabber, use the matroxcam
function
to create a Matrox object. Specify a frame grabber by the list order,
using an index number, as the first input argument. The second input
argument must be the name and fully qualified path of your DCF file.
Note that you cannot create more than one object connected to the same device, and trying to do that generates an error.
After you create the object, you can preview and acquire images.
Note
The Matrox support requires that you download and install the
necessary files via MATLAB® Add-Ons. The Matrox Hardware support
package installs the files for both the matrox
adaptor
for the videoinput
object and the matroxcam
object.
For more information, see Installing the Support Packages for Image Acquisition Toolbox Adaptors.
Create a matroxcam Object Using Device Number as an Index
Use the matroxcam
function with an index
as the first input argument to create the object corresponding to
that index and connect it to that frame grabber. The index corresponds
to the order of boards in the cell array returned by matroxlist
when
you have multiple frame grabbers connected. If you only have one frame
grabber, you must use a 1
as the input argument.
Use the matroxlist
function to ensure that MATLAB is
discovering your frame grabbers.
matroxlist
ans = Solios XCL (digitizer 0) Solios XCL (digitizer 1) VIO (digitizer 0)
Create an object, m
, using the index number
and DCF file. If you want to use the second frame grabber in the list,
the Solios XCL at digitizer 1, use a 2
as the index
number, since it is the second camera on the list. The second argument
must be the name of your DCF file, entered as a character vector.
It must contain the fully qualified path to the file as well. In this
example, the DCF file is named mycam.dcf
.
m = matroxcam(2, 'C:\Drivers\Solios\dcf\XCL\Basler\A404K\mycam.dcf')
m = Display Summary for matroxcam: DeviceName: 'Solios XCL (digitizer 1)' DCFName: 'C:\Drivers\Solios\dcf\XCL\Basler\A404K\mycam.dcf' FrameResolution: '1300 x 1080' Timeout: 10
It creates the object and connects it to the Solios XCL with
that index number, in this case, the second one displayed by matroxlist
.
The DCF file is specified so that the acquisition can use the properties
you have set in your DCF file.
The four properties shown when you create the object are read-only properties that identify the frame grabber.
Acquire One Image Frame from a Matrox Frame Grabber
Use the snapshot
function to acquire one
image frame from a Matrox frame grabber.
Use the
matroxlist
function to ensure that MATLAB is discovering your frame grabber.matroxlist
ans = Solios XCL (digitizer 0) Solios XCL (digitizer 1) VIO (digitizer 0)
Use the
matroxcam
function to create the object and connect it to the frame grabber. If you want to use the second frame grabber in the list, the Solios XCL at digitizer 1, use a2
as the index number, since it is the second board on the list. The second argument must be the name and path of your DCF file, entered as a character vector.m = matroxcam(2, 'C:\Drivers\Solios\dcf\XCL\Basler\A404K\mycam.dcf')
m = Display Summary for matroxcam: DeviceName: 'Solios XCL (digitizer 1)' DCFName: 'C:\Drivers\Solios\dcf\XCL\Basler\A404K\mycam.dcf' FrameResolution: '1300 x 1080' Timeout: 10
It creates the object and connects it to the Solios XCL with that index number, in this case, the second one displayed by
matroxlist
. The DCF file is specified so that the acquisition can use the properties you have set in your DCF file.Preview the image from the camera.
preview(m)
You can leave the Preview window open, or close it any time. To close the preview:
closePreview(m)
Acquire a single image using the
snapshot
function, and assign it to the variableimg
img = snapshot(m);
Display the acquired image.
imshow(img)
Clean up by clearing the object.
clear m
Configuring Hardware Triggering
If your DCF file is configured for hardware triggering, then
you must provide the trigger to acquire images. To do that, call the snapshot
function
as you normally would, as shown in step 5, and then perform the hardware
trigger to acquire the frame.
Note that when you call the snapshot
function
with hardware triggering set, it will not timeout as it normally would.
Therefore, the MATLAB command-line will be blocked until you
perform the hardware trigger.