function a = bwarea(b)
%BWAREA	Area of objects in binary image.
%	BWAREA(BW) returns an estimate for the area of digitized objects
%	in a binary image.  BW must be a binary image and contain
%	only 0's and 1's.
%
%	See also BWPERIM, BWEULER.

%	Clay M. Thompson 11-17-92
%	Copyright (c) 1992 by The MathWorks, Inc.
%	$Revision: 1.6 $  $Date: 1993/08/10 19:08:01 $

% Reference: William Pratt, Digital Image Processing, John Wiley and Sons, 1991,
% pp. 630-634.

error(nargchk(1,2,nargin));

lut = [0 0.25 0.25 0.5 0.25 0.5 0.75 0.875 0.25 0.75 0.5 0.875 0.5 0.875 0.875 1];
h = [1 4;2 8];

a = sum(sum(lut(filter2(h,b,'full')+1)));