centroid of a image
Ältere Kommentare anzeigen
I dont undertand how we can find a centroid of a image. I want to know x and y of the place where the centroid is set. Also I want to plot the point in the image.
thank you
Antworten (2)
Image Analyst
am 6 Apr. 2017
The centroid will be in the center of the image. The "weighted" centroid, or center of mass, will depend on the gray levels in the image. Both can be gotten from regionprops() as my Image Segmentation Tutorial shows: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862&sort=downloads_desc
labeledImage = bwlabel(true(size(grayImage)));
props = regionprops(labeledImage, grayImage, 'Centroid', 'WeightedCentroid');
props is a structure with fields for both of those measurements.
1 Kommentar
Yuri Minami
am 6 Apr. 2017
Walter Roberson
am 6 Apr. 2017
0 Stimmen
The centroid of an image is always at the exact center of the image. Every pixel has the same "weight" as every other pixel for the purposes of determining centroids.
If you want bright pixels to be more important than dark pixels, then possibly you are interested in centre of mass rather than centroid.
If you want to find the centroid of a portion of the image, then create an ROI (a binary mask) and use regionprops() to calculate its centroid.
1 Kommentar
Yuri Minami
am 6 Apr. 2017
Kategorien
Mehr zu Region and Image Properties finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!