Image Acquisition Toolbox Previous page   Next Page

Determining the Dimensions of Image Data

The video format used by the image acquisition device is the primary determinant of the width, height, and the number of bands in each image frame. Image acquisition devices typically support multiple video formats. You select the video format when you create the video input object (described in Specifying the Video Format). The video input object stores the video format in the VideoFormat property.

Industry-standard video formats, such as RS170 or PAL, include specifications of the image frame width and height, referred to as the image resolution. For example, the RS170 standard defines the width and height of the image frame as 640-by-480 pixels. Other devices, such as digital cameras, support the definition of many different, nonstandard image resolutions. The video input object stores the video resolution in the VideoResolution property.

For devices that support the definition of a region of interest (ROI) in the image being captured, the dimensions of the ROI determine the dimensions of the image frames returned. The VideoResolution property specifies the dimensions of the image data being provided by the device; the ROIPosition property specifies the dimensions of the image frames being logged. See the ROIPosition property reference page for more information.

Each image frame is three dimensional; however, the video format determines the number of bands in the third dimension. For color video formats, such as RGB, each image frame has three bands: one each for the red, green, and blue data. Other video formats, such as the grayscale RS170 standard, have only a single band. The video input object stores the size of the third dimension in the NumberOfBands property.

The following example illustrates how video format affects the size of the image frames returned.

  1. Select a video format -- Use the imaqhwinfo function to view the list of video formats supported by your image acquisition device. This example shows the video formats supported by a Matrox Orion frame grabber. The formats are industry standard, such as RS170, NTSC, and PAL. These standards define the image resolution.
  2. Create an image acquisition object -- This example creates a video input object for a Matrox image acquisition device using the default video format, RS170. To run this example on your system, use the imaqhwinfo function to get the object constructor for your image acquisition device and substitute that syntax for the following code.
  3. View the video format and video resolution properties -- The toolbox creates the object with the default video format. This format defines the video resolution.
  4. Bring a single frame into the workspace -- Call the getsnapshot function to bring a frame into the workspace.

  1. The dimensions of the returned data reflect the image resolution and the value of the NumberOfBands property.

  1. Start the image acquisition object -- Call the start function to start the image acquisition object.

  1. The object executes an immediate trigger and begins acquiring frames of data.

  1. Bring multiple frames into the workspace -- Call the getdata function to bring multiple image frames into the MATLAB workspace.

  1. The getdata function brings 10 frames of data into the workspace. Note that the returned data is a four-dimensional array: each frame is three-dimensional and the nth frame is indicated by the fourth dimension.

  1. Clean up -- Always remove image acquisition objects from memory, and the variables that reference them, when you no longer need them.


Previous page  Working with Image Data in the MATLAB Workspace Determining the Data Type of Image Frames Next page

Learn more about the latest releases of MathWorks products:

 © 1994-2010 The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS