Image Processing Toolbox User's Guide |
7. Determine the Number of Objects in the Image
After converting the image to a binary image, you can use the bwlabel
function to determine the number of grains of rice in the image. The bwlabel
function labels all the components in the binary image bw
and returns the number of components it finds in the image in the output value, numObjects
.
The accuracy of the results depends on a number of factors, including
4
, passed to the bwlabel
function, means that pixels must touch along an edge to be considered connected. For more information about the connectivity of objects, see Pixel Connectivity.
6. Create a Binary Version of the Image | 8. Examine the Label Matrix |
© 1994-2005 The MathWorks, Inc.