Get the Centroid of a specific object in an image
1 次查看(过去 30 天)
显示 更早的评论
Hi,
I have a binarized image with a circle as shown below, and I wish to get the centroid of the circle.
Can anyone please guide me how?
I have tried with using 'regionprops' with 'Centroid', however it does not provide me the centroid of the circle but the centroid of the whole image.
props = regionprops(binaryImage,'Centroid');
boundingBox = props.Centroid;
Also, I tried using 'BoundingBox' with 'regionprops' as well. But I am not sure whether the value given is location of the circle or the centroid of it.
props = regionprops(binaryImage,'BoundingBox');
boundingBox = props.BoundingBox;
Thank you if anyone would like to help me.
0 个评论
采纳的回答
KSSV
2020-3-4
I = imread("image.png") ;
[y,x] = find(I==0) ;
iwant = [mean(x) mean(y)] ;
% check
imshow(I)
hold on
plot(iwant(1),iwant(2),'+r')
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Segmentation and Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!