Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

snapshot

Acquire single image frame from Matrox frame grabber

Syntax

img = snapshot(m);
[img, ts] = snapshot(m);

Description

example

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.

Note

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.

Examples

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.

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

preview(m)

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

closePreview(m)

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.

imshow(img)

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.

Introduced in R2014b

Was this topic helpful?