User`s guide

5 Acqu iring Image Data
Logging Grayscale Images
When logging images in grayscale format, such a s RS170, you must set the
value of the AVI object’s
Colormap property to be a grayscale colormap.
Otherwise, the image data in the AVI file w ill not d isplay correctly.
This example uses the MATLAB
gray function to create a grayscale colormap
and sets the value of the AVI file object’s
Colormap property with this
colormap.
logfile = avifile('my _datalog.avi','Color map',gray(256));
Guidelines for Using an AVI File Object to Log Image Data
When you specify the AVI file object as the value of the DiskLogger property,
you are creating a copy of the AVI file ob ject. Do not acces s the AVI file object
using the original variable name,
aviobj, while the v id eo i np u t object is using
thefilefordatalogging. Toavoidfile access conflicts, keep in mind these
guidelines when using an AVI file for data logging:
Do not close an AVI file object while it is being used for data logging.
Do not use the AVI file
addframe function to add frames to the AVI file
object while it is being used for data logging.
Do not change the values of any AVI file object properties while it is being
used for data logging.
Closing the DiskLogger AVI file
Whendatalogginghasended,closetheAVIfiletomakeitaccessible
outside the MATLAB environment. Use the value of the video input object
DiskLogger property to reference the AVI file, rather than the variable
returned w h en you created the AV I file object (
aviobj). See “Example:
Logging Data to Disk” on page 5-43 for an example.
Before you close the file, make s ure that the video input object has finished
logging frames to disk. Because logging to disk takes more time than logging
to memory, the completion of disk logging can lag behind the completion of
memory logging. To determine when logging to disk is complete, check the
value of the
DiskLoggerFrameCount property; this property tells how many
frames have been logged to disk.
5-42