Select Git revision
compute_area.m
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
compute_area.m 250 B
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(:));