Image Processing Toolbox    
bweuler

Compute the Euler number of a binary image

Syntax

Description

eul = bweuler(BW,n) returns the Euler number for the binary image BW. The return value, eul, is a scalar whose value is the total number of objects in the image minus the total number of holes in those objects. The argument n can have a value of either 4 or 8, where 4 specifies 4-connected objects and 8 specifies 8-connected objects; if the argument is omitted, it defaults to 8.

Class Support

BW can be numeric or logical and it must be real, nonsparse and two-dimensional. The return value, eul, is of class double.

Example

Algorithm

bweuler computes the Euler number by considering patterns of convexity and concavity in local 2-by-2 neighborhoods. See [2] for a discussion of the algorithm used.

See Also

bwmorph, bwperim

References

[1]  Horn, Berthold P. K., Robot Vision. New York: McGraw-Hill, 1986. pp. 73-77.

[2]  Pratt, William K. Digital Image Processing. New York: John Wiley & Sons, Inc., 1991. p. 633.


  bwdist bwfill