Read, Convert, and View Video from File
This example shows you how to read RGB video frames from a multimedia file, convert them to intensity frames, and display them using the To Video Display block.
Example Model
Open the Simulink® model.
modelname = 'ex_blkToVideoDisplay.slx';
open_system(modelname)
The model reads an input video file using a From Multimedia File block with these parameters:
File name —
visionface.avi
Output color format —
RGB
To convert the RGB video frames to intensity frames, the model uses the Color Space Conversion block with the Conversion parameter set to R'G'B' to intensity
. This block converts each RGB frame of the video to an intensity frame.
The model displays the original RGB video frames and the converted intensity video frames using To Video Display blocks with default parameters.
Simulate Model
Run the model. The model opens two display windows: one for the RGB frames and the other for the converted intensity frames. In the following figure, the top image shows the last RGB frame of the input video file, and the bottom image shows the corresponding converted intensity frame.
sim(modelname);