This example shows how to use Simulink® blocks to display live video stream and a histogram of its RGB values side by side.
Image Acquisition Toolbox™ provides a Simulink block to acquire live image data from image acquisition devices into Simulink models. This example uses the From Video Device block to acquire live image data from the Logitech® Quickcam® Zoom webcam into Simulink. This example uses the Histogram block in DSP System Toolbox™ to calculate the histograms of R, G, and B values in each video frame.
This example requires Simulink, DSP System Toolbox and Computer Vision System Toolbox™ to open and run the model.
The following figure shows the example model using the From Video Device block.
Live Video Input
The input video is acquired live from a winvideo image acquisition device (Logitech Quickcam Zoom). In this example, the block acquires RGB frames from the Logitech camera and outputs them into the Simulink model at every simulation time step. The data type output from the block is uint8.
Histogram Display Results
The example displays the histograms of R, G, and B values in the RGB Histogram window and displays the original RGB video in the viewer window.
Even though a winvideo Logitech webcam was used for this example, this model can be easily updated to connect your models to other supported image acquisition devices. This provides you the flexibility to use the same Simulink model with different image acquisition hardware.
Available Example Versions
Windows-only example model contains the To Video Display block (supported only on Windows) from Computer Vision System Toolbox and supports code generation. The platform independent version consists of Video Viewer block and does not support code generation.