Acquiring Image Data
After completing chapters 3 and 4, you can see your adaptor
included in the list of adaptors returned by
you can create a video input object using the
Now it's time to acquire data from your device. In this chapter, you
flesh out the stub implementations of the adaptor class virtual functions
that work together to acquire data.
The following example shows how a toolbox user initiates the
acquisition of image frames. The example calls the
to create a video input object and then calls the
to start the object. Note in the summary that ten image frames are
vid = videoinput('winvideo'); start(vid); vid Summary of Video Input Object Using 'IBM PC Camera'. Acquisition Source(s): input1 is available. Acquisition Parameters: 'input1' is the current selected source. 10 frames per trigger using the selected source. 'RGB555_128x96' video data to be logged upon START. Grabbing first of every 1 frame(s). Log data to 'memory' on trigger. Trigger Parameters: 1 'immediate' trigger(s) on START. Status: Waiting for START. 10 frames acquired since starting. 10 frames available for GETDATA.
In the previous example, the
opens the connection with the device but does not actually cause the
acquisition of image data. The toolbox uses triggers to control image
acquisition. By default, video input objects are configured with an
immediate trigger so, in the example, when you start the object, an
immediate trigger fires.
The toolbox also supports two other types of triggers: manual
and hardware. With a manual trigger, after starting a video input
object, you must call the
trigger function to acquire
data. With hardware triggers, you start the object and it waits until
it receives a signal from an external device to start acquiring data.
The toolbox handles immediate and manual triggering automatically; you do not have to include any special processing in your adaptor. Supporting hardware triggers, requires some adaptor development work. For more information, see Supporting Hardware Triggers.
Overview of Virtual Functions Used to Acquire Data
The pure virtual functions in your adaptor class that you must implement work together to acquire data. However, the main steps are:
Specify the format of the video data in the
getFrameType()functions — see Specifying the Format of the Image Data.
Open a connection with your device in the
openDevice()function — see Opening and Closing Connection with a Device.
Start acquiring data in the
startCapture()function — see Starting and Stopping Image Acquisition.
Stop acquiring data in the
stopCapture()function — see Starting and Stopping Image Acquisition.
Close the connection with the device in the
closeDevice()function — see Opening and Closing Connection with a Device.
The following diagram shows this flow of control in graphical form. This diagram picks up where the diagram in Chapter 3 ends, after the object has been created — see Acquiring Image Data.
The diagrams do not show the calls your adaptor makes to the image acquisition device's SDK because these calls vary with each device's SDK.
Flow of Control Among the Adaptor Acquisition Functions