function area = compute_area(B)
%COMPUTE_AREA   Area of the binarized object
%   AREA = COMPUTE_AREA(B)

Ax = B(2:end,:,:)~=B(1:end-1,:,:);
Ay = B(:,2:end,:)~=B(:,1:end-1,:);
Az = B(:,:,2:end)~=B(:,:,1:end-1);
area = sum(Ax(:))+sum(Ay(:))+sum(Az(:));