| Video and Image Processing Blockset™ | ![]() |
Sources

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 and variables that are in the structure format returned by the MATLAB aviread function.
Note If you generate code from a model that contains this block, Real-Time Workshop 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. |
| 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 |
| 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 Video and Image Processing Blockset™ 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 = aviread('filename.avi')
The aviread function reads the AVI file into the MATLAB movie structure mov. The MATLAB movie structure might be obsoleted in the future. For more information, see aviread in the MATLAB documentation.
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.
The Video From Workspace dialog box appears as shown in the following figure.

Specify the MATLAB workspace variable that contains the video signal, or use the aviread function to specify an AVI filename.
Enter the sample period of the output.
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).
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.
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.
Video and Image Processing Blockset | |
Video and Image Processing Blockset | |
Video and Image Processing Blockset | |
Video and Image Processing Blockset | |
Video and Image Processing Blockset |
![]() | Variance | Video To Workspace | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |