Documentation Center

  • Trial Software
  • Product Updates

Contents

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.

Properties that can be used with the VideoDevice System object™ include:

PropertyDescription
Device

Device from which to acquire images.

Specify the image acquisition device to use to acquire a frame. It consists of the device name, adaptor, and device ID. The default device is the first device returned by imaqhwinfo.

set(obj, 'Device')

shows the list of available devices for VideoDevice System object, obj.

VideoFormat

Video format to be used by the image acquisition device.

Specify the video format to use while acquiring the frame. The default value of VideoFormat is the default format returned by imaqhwinfo for the selected device. To specify a Video Format using a device file, set the VideoFormat property to 'From device file' This option exists only if your device supports device configuration files.

set(obj, 'VideoFormat')

shows the list of available video formats.

DeviceFileName of file specifying video format. This property is only visible when VideoFormat is set to 'From device file'.
DevicePropertiesObject containing properties specific to the image acquisition device.
set(obj.DeviceProperties, <property_name>, 
    <property_value>)

shows a device-specific property for VideoDevice System object, obj.

ROI

Region-of-interest for acquisition. This is set to the default ROI value for the specified device, which is the maximum resolution possible for the specified format. You can change the value to change the size of the captured image. The format is 1-based, that is, it is specified in pixels in a 1-by-4 element vector [x y width height], where x is x offset and y is y offset.

Note that this differs from the videoinput object, the Image Acquisition Tool, and the From Video Device block, all of which are 0-based.

HardwareTriggeringTurn hardware triggering on/off. Set this property to 'on' to enable hardware triggering to acquire images. The property is visible only when the device supports hardware triggering.
TriggerConfigurationSpecifies the trigger source and trigger condition before acquisition. The triggering condition must be met via the trigger source before a frame is acquired. This property is visible only when HardwareTriggering is set to 'on'.
set(obj, 'TriggerConfiguration')

shows the list of available hardware trigger configurations.

ReturnedColorSpaceSpecify the color space of the returned image. The default value of the property depends on the device and the video format selected. Possible values are {rgb|grayscale|YCbCr} when the default returned color space for the device is not grayscale. Possible values are {rgb|grayscale|YCbCr|bayer} when the default returned color space for the device is grayscale
set(obj, 'ReturnedColorSpace')

shows the list of available color space settings.

BayerSensorAlignmentString indicating the 2x2 sensor alignment. Specifies Bayer patterns returned by hardware. Specify the sensor alignment for Bayer demosaicing. The default value of this property is 'grbg'. Possible values are {grbg|gbrg|rggb|bggr}. Visible only if ReturnedColorSpace is set to 'bayer'.
set(obj, 'BayerSensorAlignment')

shows the list of available sensor alignments.

ReturnedDataTypeThe returned data type of the acquired frame. The default ReturnedDataType is single.
set(obj, 'ReturnedDataType')

shows the list of available data types.

    Note:   The setting of properties for the System object supports tab completion for enumerated properties while coding in MATLAB. Using the tab completion is an easy way to see available property values. After you type the property name, type a comma, then a space, then the first quote mark for the value, then hit tab to see the possible values.

Once you have created a VideoDevice System object, you can set either object-level properties or device-specific properties on it.

To set an object-level property, use this syntax:

set(vidobj, 'ReturnedColorSpace', 'grayscale');

You can see that the syntax for an object-level property is to use set on the object name, property name, and property value.

Another example of an object-level property is setting the region-of-interest, or ROI, to change the dimensions of the acquired image. The ROI format is specified in pixels in a 1-by-4 element vector [x y width height].

set(vidobj, 'ROI', [1 1 200 200]);

    Note:   This ROI value is 1-based. This differs from the videoinput object, the Image Acquisition Tool, and the From Video Device block, all of which are 0-based.

To set a device-specific property, use this syntax:

set(vidobj.DeviceProperties, 'Brightness', 150);

You can see that the syntax for a device-specific property is to use set with the DeviceProperties object using dot notation, then the property name and property value.

Another example of a device-specific property is setting the frame rate for a device that supports it.

set(vidobj.DeviceProperties, 'FrameRate', '30');

    Note:   Once you have done a step, in order to change a property or set a new one, you need to release the object using the release function, before setting the new property.

Was this topic helpful?