Image Processing Toolbox User's Guide Previous page   Next Page

11. Compute Statistical Properties of Objects in the Image

Now use MATLAB functions to calculate some statistical properties of the thresholded objects. First use max to find the size of the largest grain. (In this example, the largest grain is actually two grains of rice that are touching.)

returns

Use the find command to return the component label of the grain of rice with this area.

returns

Find the mean of all the rice grain sizes.

returns

Make a histogram containing 20 bins that show the distribution of rice grain sizes. The histogram shows that the most common sizes for rice grains in this image are in the range of 150 to 250 pixels.


Previous page  10. Measure Object Properties in the Image Getting Help Next page

© 1994-2005 The MathWorks, Inc.