Image Processing Toolbox User's Guide |
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.)
Use the find
command to return the component label of the grain of rice with this area.
Find the mean of all the rice grain sizes.
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.
10. Measure Object Properties in the Image | Getting Help |
© 1994-2005 The MathWorks, Inc.