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
Image Analyst am 6 Apr. 2017

0 Stimmen

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.
Walter Roberson
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
Yuri Minami am 6 Apr. 2017
Thank you. yes I want to know the center of mass of a blighter area.

Melden Sie sich an, um zu kommentieren.

Produkte

Tags

Gefragt:

am 6 Apr. 2017

Kommentiert:

am 6 Apr. 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by