User`s guide

6 Acquiring Image Data
6-44
Guidelines for Using a VideoWriter Object to Log Image Data
Note the following when using VideoWriter.
You should not delete the video input object until logging has been completed as
indicated by the DiskLoggerFrameCount property equaling the FramesAcquired
property. Doing so will cause disk logging to stop without all of the data being logged.
If START is called multiple times without supplying a new VideoWriter object, the
contents of the previous file will be erased when START is called.
Once the VideoWriter object has been passed to the DiskLogger property, you should
not modify it.
Logging Data to Disk Using an AVI File
While a video input object is running, you can log the image data being acquired to a
disk file. Logging image data to disk provides a record of your data. You can log data
to several formats but we recommend using VideoWriter, as described in the previous
section. However, if you need to use an AVI file, this section describes how to do that.
To set up data logging to disk:
1
Create a disk file to store the data. The toolbox logs the data to disk in Audio Video
Interleave (AVI) format because this format provides data compression capabilities
that allow for efficient storage. You must use the MATLAB avifile function to
create this log file. For more information, see “Creating an AVI File Object for
Logging” on page 6-45.
2
Set the value of the video input object LoggingMode property to 'disk' or
'disk&memory'.
3
Set the value of the video input object DiskLogger property to the AVI file object
created in step 1.
The following figure shows how the toolbox adds frames to the AVI file when a trigger
occurs. With each subsequent trigger, the toolbox appends the acquired frames to the end
of the AVI file. The frames must have the same dimensions. For an example of how to set
up disk data logging, see “Logging Data to Disk Using an AVI File” on page 6-47.