This example shows how to use the From Video Device block to acquire live image data from the Logitech Quickcam Zoom webcam into Simulink. This example uses the Histogram block from Computer Vision System Toolbox™ to calculate the histograms of R, G, and B values in each video frame to maximize the dynamic range of the acquired video.
Image Acquisition Toolbox™ provides functions for acquiring images and video directly into MATLAB and Simulink from PC-compatible imaging hardware. You can detect hardware automatically, configure hardware properties, preview an acquisition, and acquire images and video.
This example requires Image Acquisition Toolbox and a Logitech Quickcam Zoom webcam to run the model.
The following figure shows the example model using the From Video Device block.
The example acquires the input video 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 example displays the histograms of R, G, and B values in the RGB Histogram window and displays the original RGB video in the To Video Display window.
Even though a winvideo Logitech webcam was used for this example, you can update this model to use other supported image acquisition devices. This enables you to use the same Simulink model with different image acquisition hardware.
Windows-only example models contain To Video Display block and From Video Device block, which are only supported on Windows platforms.