function centroid = getCentroid(r)
% function centroid = getCentroid(r)
%
% Returns the centroid of a binary image.
%
% Dr. A. I. Hanna (2007)
[y, x] = find(r);
if isempty(x) || isempty(y)
    centroid = [0 0];
else
    centroid = [mean(x), mean(y)];
end
return