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 GigE Vision camera

Syntax

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

Description

example

img = snapshot(g); acquires the current frame as a single image from the GigE camera g and assigns it to the variable img. If you call snapshot in a loop, then it returns a new frame each time. The returned image is based on the Pixel Format of your camera. snapshot uses the camera’s default resolution or another resolution that you specify using the Height and Width properties, if available.

Note

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

[img, ts] = snapshot(g); acquires the current frame as a single image from the GigE camera g 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 GigE Vision camera. You then show it using a display function such as imshow or image.

Use the gigecamlist function to ensure that MATLAB® is discovering your camera.

gigecamlist
ans = 

	Model              Manufacturer           IPAddress       SerialNumber
  ____________________   ___________________   _______________    ______________

  'MV1-D1312-80-G2-12'   'Photonofocus AG'     '169.254.192.165'  '022600017445'

Use the gigecam function to create the object and connect it to the camera.

g = gigecam

Preview the image from the camera.

preview(g)

The preview window displays live video stream from your camera. If you change a property while previewing, then the preview dynamically updates, and the image reflects the property change.

Close the preview.

closePreview(g)

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

img = snapshot(g);

Display the acquired image.

imshow(img)

Clean up by clearing the object.

clear g

Introduced in R2014b

Was this topic helpful?