www.gusucode.com > images 案例代码 matlab源码程序 > images/CalculateEulerNumberForBinaryImageExample.m

    %% Calculate Euler Number for Binary Image
% 
%%
% Read binary image into workspace, and display it.

% Copyright 2015 The MathWorks, Inc.

BW = imread('circles.png');
imshow(BW)
%%
% Calculate the Euler number. In this example, all the circles touch so
% they create one object. The object contains four "holes", which are the
% black areas created by the touching circles. Thus the Euler number is 1
% minus 4, or -3.
bweuler(BW)