Image Processing Toolbox User's Guide Previous page   Next Page

Finding the Area of the Foreground of a Binary Image

The bwarea function returns the area of a binary image. The area is a measure of the size of the foreground of the image. Roughly speaking, the area is the number of on pixels in the image.

bwarea does not simply count the number of pixels set to on, however. Rather, bwarea weights different pixel patterns unequally when computing the area. This weighting compensates for the distortion that is inherent in representing a continuous image with discrete pixels. For example, a diagonal line of 50 pixels is longer than a horizontal line of 50 pixels. As a result of the weighting bwarea uses, the horizontal line has area of 50, but the diagonal line has area of 62.5.

This example uses bwarea to determine the percentage area increase in circbw.tif that results from a dilation operation.

See the reference page for bwarea for more information about the weighting pattern.


Previous page  Selecting Objects in a Binary Image Finding the Euler Number of a Binary Image Next page

© 1994-2005 The MathWorks, Inc.