Documentation

Video From Workspace

Import video signal fromMATLABworkspace

Library

Sources

visionsources

Description

TheVideo From Workspaceblock imports a video signal from the MATLAB®workspace. If the video signal is a M-by-N-by-T workspace array, the block outputs an intensity video signal, where M and N are the number of rows and columns in a single video frame, and T is the number of frames in the video signal. If the video signal is a M-by-N-by-C-by-T workspace array, the block outputs a color video signal, where M and N are the number of rows and columns in a single video frame, C is the number of color channels, and T is the number of frames in the video stream. In addition to the video signals previously described, this block supports fi objects.

Note

If you generate code from a model that contains this block,万博1manbetx®Coder™takes a long time to compile the code because it puts all of the video data into the.cfile. Before you generate code, you should convert your video data to a format supported by the From Multimedia File block or the Read Binary File block.

Port Output Supported Data Types Complex Values Supported

Image

M-by-N matrix of intensity values or an M-by-N-by-P color video signal where P is the number of color planes

  • Double-precision floating point

  • Single-precision floating point

  • Fixed point

  • Boolean

  • 8-, 16-, 32-bit signed integer

  • 8-, 16-, 32-bit unsigned integer

No

R, G, B

Scalar, vector, or matrix that represents one plane of the RGB video stream. Outputs from the R, G, or B ports have the same dimensions.

Same as I port

No

For the Computer Vision System Toolbox™ blocks to display video data properly, double- and single-precision floating-point pixel values must be from 0 to 1. This block does not scale pixel values.

Use theSignalparameter to specify the MATLAB workspace variable from which to read. For example, to read an AVI file, use the following syntax:

mov = VideoReader('filename.avi')

Iffilename.avihas a colormap associated with it, the AVI file must satisfy the following conditions or the block produces an error:

  • The colormap must be empty or have 256 values.

  • The data must represent an intensity image.

  • The data type of the image values must beuint8.

Use theSample timeparameter to set the sample period of the output signal.

When the block has output all of the available signal samples, it can start again at the beginning of the signal, repeat the final value, or generate 0s until the end of the simulation. TheForm output after final value byparameter controls this behavior:

  • When you specifySetting To Zero, the block generates zero-valued outputs for the duration of the simulation after generating the last frame of the signal.

  • When you specifyHolding Final Value, the block repeats the final frame for the duration of the simulation after generating the last frame of the signal.

  • When you specifyCyclic Repetition, the block repeats the signal from the beginning after it reaches the last frame in the signal.

Use theImage signalparameter to specify how the block outputs a color video signal. If you selectOne multidimensional signal, the block outputs an M-by-N-by-P color video signal, where P is the number of color planes, at one port. If you selectSeparate color signals, additional ports appear on the block. Each port outputs one M-by-N plane of an RGB video stream.

Use theOutput port labelsparameter to label your output ports. Use the spacer character, |, as the delimiter. This parameter is available when theImage signalparameter is set toSeparate color signals.

Parameters

Signal

Specify the MATLAB workspace variable that contains the video signal, or use theVideoReaderfunction to specify an AVI filename.

Sample time

Enter the sample period of the output.

Form output after final value by

Specify the output of the block after all of the specified signal samples have been generated. The block can output zeros for the duration of the simulation (Setting to zero), repeat the final value (Holding Final Value) or repeat the entire signal from the beginning (Cyclic Repetition).

Image signal

Specify how the block outputs a color video signal. If you selectOne multidimensional signal, the block outputs an M-by-N-by-P color video signal, where P is the number of color planes, at one port. If you selectSeparate color signals, additional ports appear on the block. Each port outputs one M-by-N plane of an RGB video stream.

Output port labels

Enter the labels for your output ports using the spacer character, |, as the delimiter. This parameter is available when theImage signalparameter is set toSeparate color signals.

See Also

From Multimedia File

Computer Vision System Toolbox software

Image From Workspace

Computer Vision System Toolbox software

Read Binary File

Computer Vision System Toolbox software

To Video Display

Computer Vision System Toolbox software

Video Viewer

Computer Vision System Toolbox software

Introduced before R2006a