Main Content

Acquisition Using Any Hardware

Specify acquisition parameters and acquire image data using the videoinput interface

You can acquire images with any type of supported hardware using the videoinput object. If you have GigE Vision® or Matrox® hardware, you can continue to use the existing GigE Vision and Matrox adaptors (gige and matrox) with the videoinput object, or you can use the new interfaces for GigE Vision and Matrox, which provide new objects, gigecam and matroxcam. See Acquisition Using GigE Vision Hardware and Acquisition Using Matrox Hardware for more information on those interfaces.

In addition to doing the acquisition programmatically using the videoinput object, you can also acquire images using any type of supported hardware using the Image Acquisition Tool, a full user interface that enables you to set acquisition properties, preview the image, and acquire images. For more information on using the tool, see Acquisition Using the Image Acquisition Tool.

Note: The functionality for all supported hardware is now available via the Support Package Installer. Starting with R2014a, each adaptor is available separately through the Support Package Installer, and you must install the appropriate support packages to use the toolbox with your hardware. For more information, see Image Acquisition Support Packages for Hardware Adaptors.


videoinputCreate video input object
imaq.VideoDeviceAcquire one frame at a time from video device
getdataAcquired image frames to MATLAB workspace
peekdataMost recently acquired image data
getsnapshotImmediately return single image frame
setConfigure or display image acquisition object properties
startObtain exclusive use of image acquisition device
isloggingDetermine whether video input object is logging
isrunningDetermine whether video input object is running
isvalidDetermine whether image acquisition object is associated with image acquisition device
waitWait until image acquisition object stops running or logging
stopStop video input object
clearClear image acquisition object from MATLAB workspace
deleteRemove image acquisition object from memory
flushdataRemove data from memory buffer used to store acquired image frames
obj2mfileConvert video input objects to MATLAB code
imaqmontageSequence of image frames as montage
loadLoad image acquisition object into MATLAB workspace
saveSave image acquisition objects to MAT-file
triggerInitiate data logging
triggerconfigConfigure video input object trigger properties
triggerinfoProvide information about available trigger configurations


Image Acquisition ToolAcquire images and video from hardware

Examples and How To

Programmatic Workflow

Acquiring Image Data

Triggers can come from an internal or external event or source.

Controlling Logging Parameters

Describes how you can control various aspects of data logging using toolbox functions and video input object properties.

Logging Image Data to Disk

While a video input object is running, you can log image data being acquired to a disk file. Logging image data to disk provides a record of your data.

Setting the Values of Trigger Properties

Describes how to set the values of video input object trigger properties.

Specifying the Trigger Type

To specify the type of trigger you want to execute, set the value of the TriggerType property of the video input object. You can use immediate, manual, or hardware triggering.

Specifying the Color Space

You can determine your device’s default color space and change the color space.

Waiting for an Acquisition to Finish

You can use the wait function to block the command line until an acquisition completes.

Managing Memory Usage

You can free memory using the flushdata function.

Using Events and Callbacks when Acquiring Data Programmatically

Using Events and Callbacks

You can enhance the power and flexibility of your image acquisition application by using event callbacks.

Using the Default Callback Function

Introduces events and callbacks by showing a simple example.

Retrieving Event Information

Describes the information generated with each event and how to access it.

Creating and Executing Callback Functions

Describes how to write a callback function and associate it with an event callback.

Working with Acquired Data Programmatically

Bringing Image Data into the MATLAB Workspace

You can bring acquired image data into the MATLAB® workspace in multiple ways.

Working with Image Data in MATLAB Workspace

Describes the format of the image data returned to the MATLAB workspace.

Specifying the Color Space

You can determine your device’s default color space and change the color space.

Retrieving Timing Information

You can use the getdata function to retrieve timing information, such as when a trigger is executed or when a frame is acquired.

Acquiring Data Using the VideoDevice System Object

Creating the VideoDevice System Object

You use the imaq.VideoDevice function to create the System object. You can specify the adaptor name, device ID, and format when you create the object.

Using VideoDevice System Object to Acquire Frames

The basic workflow for using the VideoDevice System object is to create the object, preview the image, set any properties, acquire a frame, and clear the object.

Using Properties on a VideoDevice System Object

You can specify properties at the time of object creation, or they can be specified and changed after the object is created.

Code Generation with VideoDevice System Object

The VideoDevice System object supports code generation in MATLAB via the codegen function.


Data Logging

Provides an overview of data logging and a brief description of all the trigger properties supported by the video input object. Acquired frames can be logged in a buffer in memory, a disk file, or both.

Image Acquisition Overview

Provides an overview of data logging and the process of bringing frames into the MATLAB workspace.

Event Types

Defines all the event types supported by the toolbox.

VideoDevice System Object Overview

The VideoDevice System object allows single-frame image acquisition and code generation from MATLAB.

Image Acquisition Toolbox Properties

These properties are available in the toolbox.

Featured Examples