Count Objects in an Image In this example, you import an intensity image of a wheel from the MATLAB® workspace and convert it to binary. Then, using the Opening and Label blocks, you count the number of spokes in the wheel. You can use similar techniques to count objects in other intensity images. However, you might need to use additional morphological operators and different structuring elements. Note:   Running this example requires a DSP System Toolbox™ license.

You can open the example model by typing ex_vision_count_objects on the MATLAB command line. 1.  Create a new Simulink® model, and add to it the blocks shown in the following table. Block

Library

Quantity

Image From File

Computer Vision System Toolbox™ > Sources

1

Opening

Computer Vision System Toolbox> Morphological Operations

1

Label

Computer Vision System Toolbox > Morphological Operations

1

Video Viewer

Computer Vision System Toolbox > Sinks

2

Constant

Simulink > Sources

1

Relational Operator

Simulink > Logic and Bit Operations

1

Display

Simulink > Sinks

1

2.  Use the Image From File block to import your image. Set the File name parameter to testpat1.png. This is a 256­by­ 256 matrix image of 8­bit unsigned integers. 3.  Use the Constant block to define a threshold value for the Relational Operator block. Set the Constant value parameter to 200. 4.  Use the Video Viewer block to view the original image. Accept the default parameters. 5.  Use the Relational Operator block to perform a thresholding operation that converts your intensity image to a binary image. Set the Relational Operator parameter to <. If the input to the Relational Operator block is less than 200, its output is 1; otherwise, its output is 0. You must threshold your intensity image because the Label block expects binary input. Also, the objects it counts must be white. 6.  Use the Opening block to separate the spokes from the rim and from each other at the center of the wheel. Use the default parameters. The strel function creates a circular STREL object with a radius of 5 pixels. When working with the Opening block, pick a STREL object that fits within the objects you want to keep. It often takes experimentation to find the neighborhood or STREL object that best suits your application. 7.  Use the Video Viewer1 block to view the opened image. Accept the default parameters. 8.  Use the Label block to count the number of spokes in the input image. Set the Output parameter to Number of labels. 9.  The Display block displays the number of spokes in the input image. Use the default parameters. 10.  Connect the block as shown in the following figure.

11.  Set the configuration parameters. Open the Configuration dialog box by selecting Model Configuration Parameters from the Simulation menu. Set the parameters as follows: •

Solver pane, Stop time = 0



Solver pane, Type = Fixed‐step



Solver pane, Solver = discrete (no continuous states)

12.  Run the model. The original image appears in the Video Viewer1 window. To view the image at its true size, right­click the window and select Set Display To True Size.

The opened image appears in the Video Viewer window. The following image is shown at its true size.

As you can see in the preceding figure, the spokes are now separate white objects. In the model, the Display block correctly indicates that there are 24 distinct spokes.

You have used the Opening and Label blocks to count the number of spokes in an image. For more information about these blocks, see the Opening and Label block reference pages in the Computer Vision System Toolbox Reference. If you want to send the number of spokes to the MATLAB workspace, use the To Workspace block in Simulink. For more information about STREL objects, see strel in the Image Processing Toolbox™ documentation.

Count Objects in an Image - MATLAB & Simulink.pdf

Count Objects in an Image - MATLAB & Simulink.pdf. Count Objects in an Image - MATLAB & Simulink.pdf. Open. Extract. Open with. Sign In. Main menu.

547KB Sizes 2 Downloads 130 Views

Recommend Documents

System Objects in MATLAB Code Generation - MATLAB & Simulink ...
System Objects in MATLAB Code Generation - MATLAB & Simulink.pdf. System Objects in MATLAB Code Generation - MATLAB & Simulink.pdf. Open. Extract.

projects in image processing using matlab pdf
projects in image processing using matlab pdf. projects in image processing using matlab pdf. Open. Extract. Open with. Sign In. Main menu.

projects in image processing using matlab pdf
projects in image processing using matlab pdf. projects in image processing using matlab pdf. Open. Extract. Open with. Sign In. Main menu. Displaying projects ...

Morphologically open image - MATLAB imopen.pdf
Morphologically open image - MATLAB imopen.pdf. Morphologically open image - MATLAB imopen.pdf. Open. Extract. Open with. Sign In. Main menu.

Accelerating MATLAB Image Processing Toolbox ...
Mar 14, 2010 - works on using GPUs to accelerate programs in MATLAB [21] .... Register File. A high number of registers (1k float4 registers or. 16kB) per core implies more computational work in each core. A relatively small number of registers (2k f

digital signal & image processing [matlab] -
Bio m etrics. PSDIP519. Gabor wavelet transform based facial expression recognition using PCA and LBP ... video surveillance. Video. Surveillance. 2014.

An Introduction to Programming and Numerical Methods in MATLAB ...
An Introduction to Programming and Numerical Methods in MATLAB - S.R. Otto & J.P. Denier.pdf. An Introduction to Programming and Numerical Methods in ...

digital image processing using matlab by gonzalez pdf free download
digital image processing using matlab by gonzalez pdf free download. digital image processing using matlab by gonzalez pdf free download. Open. Extract.

man-15\matlab-code-for-image-segmentation-pdf.pdf
man-15\matlab-code-for-image-segmentation-pdf.pdf. man-15\matlab-code-for-image-segmentation-pdf.pdf. Open. Extract. Open with. Sign In. Main menu.

Method for segmenting a video image into elementary objects
Sep 6, 2001 - Of?ce Action for JP App. 2002-525579 mailed Dec. 14, 2010. (Continued) ..... A second family calls upon the implementation of active contours ...

Method for segmenting a video image into elementary objects
Sep 6, 2001 - straints relating to two sets: the background of the image and the objects in motion. ..... to tools for creating multimedia content satisfying the. MPEG-4 ... 3c shoWs, by Way of illustration, the parts of the object on Which the ...

Download Microeconometrics and MATLAB: An ...
... guide for theory-based empirical analysis in economics that guides the reader through ... more advanced features that can be used to optimise use of MATLAB, including parallel computing. Each ... Time Series and Panel Data Econometrics.

An fMRI investigation on image generation in different ...
e ITAB, Institute for Advanced Biomedical Technologies, ''G. d' Annunzio” University .... mental imagery generation in different sensory modalities. The ...... cloud. To hear a snap. To touch something sticky. The rancid taste. To see a book.

Chinua.Achebe, "An Image of Africa: Racism in ...
Jan 9, 2008 - superstitions of an African tribe. 1. I propose to draw from these rather trivial encounters rather heavy conclusions which at first .... you just the faintest trace of a response to the terrible frankness of that noise, a dim suspicion

An Ontology of Economic Objects
1999 American Journal of Economics and sociology, Inc. ..... sour apple pie if, for example, the apples were artificially ripened so they look red and delicious but ...

An Ontology of Economic Objects
goods, commodities, money, value, price, and exchange which together give rise to the ... which will influence his saving and spending decisions. When making eco- ..... flicting ways. Most accounts of value, for example, attempt to reduce it.