This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.

Object Counting

This example shows how to use basic morphological operators to extract information from a video stream. In this case, the model counts the number of staples in each video frame. Note that the focus and lighting change in each video frame.

Example Model

The following figure shows the Object Counting model.

Count Staples Subsystem

The model uses the Top-hat block to remove uneven illumination and the Opening block to widen the gaps between the staples. Due to changes in overall lighting intensity, the model cannot apply a single threshold value to all of the video frames. Instead, it uses the Autothreshold block to compute a threshold for each frame. Once the model applies the threshold to separate the staples, it uses the Blob Analysis block to count the number of staples in each frame and to calculate the centroid of each staple. The model passes the total number of staples in each frame to the Insert Text block in the main model. This block embeds this information on each video frame.

Mark Staples Subsystem

The model passes the centroid information to a series of Draw Markers blocks, which mark the centroids of each staple.

Object Counting Results

The Counted window displays one frame of the original video and the segmented staples in that frame. The number of staples is displayed in the lower left corner.