User`s guide
5 Acquiring Image Data
5-6
The engine calls these functions in your adaptor to get the resolution information that it
displays in the VideoResolution property of the video input object.
vid = videoinput('mydeviceimaq');
get(vid,'VideoResolution')
ans =
640 480
Your adaptor also call these functions when it creates the IAdaptorFrame object to
receive image data. See “Implementing the Acquisition Thread Function” on page
5-18 for more information.
Suggested Algorithm
The getMaxHeight(), getMaxWidth(), and getNumberOfBands() functions in an
adaptor typically perform the following processing:
1
Determine the format specified by the user when they created the video input
object. The engine passes this information as an argument to your adaptor's
createInstance() function.
2
Based on the format chosen, return the appropriate values of the height, width,
or number of bands. Your adaptor can accomplish this in many ways. One way,
illustrated by the demo adaptor, is to determine these values in your getAvailHW()
function and store the information in application data in the IDeviceFormat object
— see “Defining Classes to Hold Device-Specific Information” on page 3-17. Then,
the getMaxHeight(), getMaxWidth(), and getNumberOfBands() functions can
retrieve this application data and read these values.
Example
The following implementations of the getMaxHeight() and getMaxWidth() functions
determine the value based on the format specified by the user. The number of bands
depends on whether the format is color or monochrome. For color formats, such as RGB
and YUV, the number of bands is always 3. For monochrome (black and white) formats,
the number of bands is always 1. The Image Acquisition Toolbox software only supports
image data with 1 or 3 bands.
Replace the stub implementations in the example adaptor with the following code C+
+ file, mydevice.cpp, created in Chapter 3. The values are appropriate for the format