Hello, I have a binary image with one object. How can I calculate the center of this object, to mark it in my image and to write the coordinates in the corner of this image, like this: object: X, Y
I used this code to calculate the center of mass:
s = regionprops(bw, 'centroid');
centroids = cat(1, s.Centroid);
plot(centroids(:,1), centroids(:,2), 'b*')
but how can i plot this coordinates on my image in the left corner?
Thank you for help
No products are associated with this question.
use text command:
your_string = strcat( num2str(centroids(:,1)),'-', num2str(centroids(:,2))); text(10,10,your_string)
change the position by changing the "10,10" values