Image Acquisition Toolbox

Edge Detection on Live Video Stream

This example shows how to use the From Video Device block to detect the edges of objects in a live video stream.

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 a Hamamatsu C8484 camera into Simulink. The Prewitt method is applied to find the edges of objects in the input video stream.

This example requires Simulink, and Computer Vision System Toolbox™ to open and run the model.

Watch edge detection on live videoWatch edge detection on live video. (9 seconds)

Example 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 Hamamatsu image acquisition device (C8484). In this example, the block acquires intensity data from the camera and outputs it into the Simulink model at every simulation time step. The data type output from the block is single.

Edge Detection Analysis

This example uses Computer Vision System Toolbox to find the edges of objects in the video input. When you run the model, you can double-click the Edge Detection block and adjust the threshold parameter while the simulation is running. The higher you make the threshold, the smaller the amount of edges the example finds in the video stream.

Even though a Hamamatsu camera 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: demoimaqsl_edgedetection_win.mdldemoimaqsl_edgedetection_win.mdl

Platform independent: demoimaqsl_edgedetection_all.mdldemoimaqsl_edgedetection_all.mdl

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.