Video From Workspace

Import video signal from MATLAB workspace

Library

Sources

visionsources

Description

The Video From Workspace block 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, Simulink® Coder™ takes a long time to compile the code because it puts all of the video data into the .c file. 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.

PortOutputSupported Data TypesComplex 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 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 the Signal parameter 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')

If filename.avi has 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 be uint8.

Use the Sample time parameter 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. The Form output after final value by parameter controls this behavior:

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

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

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

Use the Image signal parameter to specify how the block outputs a color video signal. If you select One 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 select Separate color signals, additional ports appear on the block. Each port outputs one M-by-N plane of an RGB video stream.

Use the Output port labels parameter to label your output ports. Use the spacer character, |, as the delimiter. This parameter is available when the Image signal parameter is set to Separate color signals.

Parameters

Signal

Specify the MATLAB workspace variable that contains the video signal, or use the VideoReader function 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 select One 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 select Separate 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 the Image signal parameter is set to Separate color signals.

See Also

From Multimedia File

Computer Vision Toolbox software

Image From Workspace

Computer Vision Toolbox software

Read Binary File

Computer Vision Toolbox software

To Video Display

Computer Vision Toolbox software

Video Viewer

Computer Vision Toolbox software

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Introduced before R2006a