Euler number of binary image
eul = bweuler(BW,n)
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.
BW can be numeric or logical and it must be real, nonsparse, and two-dimensional. The return value eul is of class double.
 Horn, Berthold P. K., Robot Vision, New York, McGraw-Hill, 1986, pp. 73-77.
 Pratt, William K., Digital Image Processing, New York, John Wiley & Sons, Inc., 1991, p. 633.