Documentation Center

  • Trial Software
  • Product Updates

Histogram Display Using Live Video Acquisition

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.

Watch histogram display using live video acquisitionWatch histogram display using live video acquisition. (5 seconds)

Example Model

The following figure shows the example model using the From Video Device block.

Live Video Input

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.

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 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.

Available Example Versions

Windows® only: viplivergbhistogram_win.mdlviplivergbhistogram_win.mdl (using live video acquisition)

Windows only: viphistogram_win.mdlviphistogram_win.mdl (using stored video data)

Platform independent: viphistogram_all.mdlviphistogram_all.mdl

Windows-only example models contain To Video Display block and From Video Device block, which are only supported on Windows platforms.

Was this topic helpful?