Main Content


Acquire single image frame from Matrox frame grabber



img = snapshot(m); acquires the current frame as a single image from the Matrox® frame grabber m and assigns it to the variable img. If you call snapshot in a loop, then it returns a new frame each time.


The snapshot function is for use only with the matroxcam object. To acquire images using the videoinput object, use the getsnapshot or getdata functions.

[img, ts] = snapshot(m); acquires the current frame as a single image from the Matrox frame grabber m and assigns it to the variable img, and assigns the timestamp to the variable ts.


collapse all

Use the snapshot function to acquire one image frame from a Matrox frame grabber. You then show it using a display function such as imshow or image.

Use the matroxlist function to ensure that MATLAB® is discovering your frame grabber.

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 a 2 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     

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 frame grabber.


You can leave the Preview window open, or close it any time. To close the preview:


Acquire a single image from the frame grabber using the snapshot function, and assign it to the variable img.

img = snapshot(m);

Display the acquired image.


Clean up by clearing the object.

clear m

Note about 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 this example, and then perform the hardware trigger to acquire the frame. 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.

Version History

Introduced in R2014b