Skip to content
Snippets Groups Projects
Commit d95b179b authored by Leonardo de Lima Gaspar's avatar Leonardo de Lima Gaspar
Browse files

Upload New File

parent 4be2a015
No related branches found
No related tags found
No related merge requests found
function output = getCenterOfMass2DActual(input)
inputSize = size(input);
weightedArrayY = uint32(input);
weightedArrayX = uint32(input);
for y = 1:inputSize(1)
for x = 1:inputSize(2)
weightedArrayY(y, x) = weightedArrayY(y, x) * y;
weightedArrayX(y, x) = weightedArrayX(y, x) * x;
end
end
inputSum = sum(input);
yCenter = round(sum(weightedArrayY) / inputSum);
xCenter = round(sum(weightedArrayX) / inputSum);
output = [yCenter, xCenter];
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment