%
% BlobCount.m
%
% Function performs blob counting.  Array BlobLabels contains the blob
% colors (labels).  Array BlobCounts is returned with the counts.
% MaxLabel is the dimension of array BlobCounts and also the largest blob
% color (label) that was assigned in the BlobColor routine.
% 
% jph 20 April 2002
%

function [BlobCounts] = BlobCount(size,BlobLabels,MaxLabel)

%
% Count the blob labels; but don't count the background -- the blob with label
%   zero.
%
BlobCounts = zeros(MaxLabel,1);
for row=1:size
  for col=1:size
    if (BlobLabels(row,col) > 0)
      BlobCounts(BlobLabels(row,col)) = BlobCounts(BlobLabels(row,col)) + 1;
    end
  end
end

return;
