compare using centroiding algorithm of image or binary image
2 次查看(过去 30 天)
显示 更早的评论
Hi.
I want to calculate an object center(x,y) in an image.
There are two ways:
1.
(This is a centroid algorithm) I didn't convert into a binary image. Use these formula to calculate center
2.
Convert into a binary image first.
and also use these formula to calculate center...
I have tried, but the results from the two ways are just a little different I want to ask which way is better??? I want calculate the accurate center x,y. In other words, do I convert into a binary image to calculate the centroid or not?
0 个评论
采纳的回答
Image Analyst
2015-11-24
The first way is the weighted centroid. The weighted centroid takes into account the gray levels of the image. A centroid based on the binary image alone does not. So if your image is brighter on the left side, then the weighted centroid will be to the left of the centroid just based on the binary image. You can get both with regionprops by passing in both the gray scale image and the binary image into regionprops:
measurements = regionprops(labeledImage, grayImage, 'Centroid', 'WeightedCentroid');
0 个评论
更多回答(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!