This example shows how to find object edges in a video stream using the Prewitt method. 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. This model also illustrates how to use the Compositing block to overlay the edges on the original video frames.
|On this page…|
The following figure shows the Edge Detection model:
The Edge Detection block outputs a binary image with the edges shown in white. This output is displayed in the Edges window. The Compositing block accepts the original video frames, shown in the Original window, and the output of the Edge Detection block as inputs at its Image1 and Mask ports, respectively. The input to the Mask port tells the Compositing block which pixels to highlight. As a result, the model displays a composite image in the Overlay window, where the original pixel values are overwritten by the white edge values.
Floating-point versions of this example:
Fixed-point versions of this example:
Windows-only example models might contain compressed multimedia files or To Video Display blocks, both of which are only supported on Windows platforms. The To Video Display block supports code generation, and its performance is optimized for Windows.