I have a binary image and divided this image into multiple blocks. e.g. a (60x60) image divided into 4 blocks
(30x30) (30x30)
(30x30) (30x30)
Now I want to calculate the centroid of each block, I look up for a formula to do that and ended up with
How can I do that using matlab, and what is the difference between this method and regionprops(...,'Centroid')
Update 1: This is what I've written so far...
m = 2;
n = 2;
im = imread('C:\Users\Home\Desktop\Samples\0_1.bmp');
flippedIm = 1-im;
boundary = regionprops(flippedIm, 'BoundingBox');
boundedIm = vertcat(boundary(1).BoundingBox);
xmin = boundedIm(1);
ymin = boundedIm(2);
width = boundedIm(3);
height = boundedIm(4);
croppedIm = imcrop(flippedIm,[xmin ymin width height]);
%USE X TO TEST
x = reshape(1:9,3,3)';
x = myPadding(x,m,n);
%a contains cells (blocks)
a = mySplit(x,m,n);
measurements = regionprops(x,'Centroid');
display(measurements(1));
And the result of that code is ...
measurements =
9x1 struct array with fields:
Centroid