Determining When a Trigger Executed

To determine when a trigger executed, check the information
returned by a trigger event in the object's event log. You can also
get access to this information in a callback function associated with
a trigger event. For more information, see Retrieving Event Information.

As a convenience, the toolbox returns the time of the first trigger
execution in the video input object's InitialTriggerTime property.
This figure indicates which trigger is returned in this property when
multiple triggers are configured.

InitialTriggerTime Records First Trigger
Execution

The trigger timing information is stored in MATLAB® clock vector format. The following
example displays the time of the first trigger for the video input
object vid. The example uses the MATLAB datestr function
to convert the information into a form that is more convenient to
view.

datestr(vid.InitialTriggerTime)
ans =
02-Mar-2007 13:00:24

Determining When a Frame Was Acquired

The toolbox provides two ways to determine when a particular
frame was acquired:

By the absolute time of the acquisition

By the elapsed time relative to the execution of the
trigger

You can use the getdata function to retrieve
both types of timing information.

Getting the Relative Acquisition Time

When you use the getdata function, you can
optionally specify two return values. One return value contains the
image data; the other return value contains a vector of timestamps
that measure, in seconds, the time when the frame was acquired relative
to the first trigger.

Getting the Absolute Acquisition Time

When you use the getdata function, you can
optionally specify three return values. The first contains the image
data, the second contains a vector of relative acquisition times,
and the third is an array of structures where each structure contains
metadata associated with a particular frame.

[data time meta ] = getdata(vid);

Each structure in the array contains the following four fields.
The AbsTime field contains the absolute time the
frame was acquired. You can also retrieve this metadata by using event
callbacks. See Retrieving Event Information for more information.

Trigger the event is associated with. For example, when
the object starts, the associated trigger is 0. Upon stop, it is equivalent
to the TriggersExecuted property.

Determining the Frame Delay Duration

To illustrate, this example calculates the duration of the delay
specified by the TriggerFrameDelay property.

Create an image
acquisition object — This example creates a video
input object for a Data
Translation® image acquisition device using
the default video format. 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.

vid = videoinput('dt',1);

Configure properties —
For this example, configure a trigger frame delay large enough to
produce a noticeable duration.

The object executes an immediate trigger and begins acquiring
frames of data. The start function returns control
to the command line immediately but data logging does not begin until
the trigger frame delay expires. After logging the specified number
of frames, the object stops running.

Bring the acquired
data into the workspace — Call the getdata function
to bring frames into the workspace. Specify a return value to accept
the timing information returned by getdata.

[data time ] = getdata(vid);

The variable time is a vector that contains
the time each frame was logged, measured in seconds, relative to the
execution of the first trigger. Check the first value in the time
vector. It should reflect the duration of the delay before data logging
started.

This website uses cookies to improve your user experience, personalize content and ads, and analyze website traffic. By continuing to use this website, you consent to our use of cookies. Please see our Privacy Policy to learn more about cookies and how to change your settings.