I want to find the centroid of an image.How to proceed?

1 comentario

Dipti S
Dipti S el 1 de Mzo. de 2019
Something like
stats1=regionprops(BW,'MajorAxisLength','MinorAxisLength','Centroid','Orientation','Area','EquivDiameter')
centers = stats1.Centroid;

Iniciar sesión para comentar.

 Respuesta aceptada

Chandra Kurniawan
Chandra Kurniawan el 14 de Feb. de 2012

6 votos

Hi,
did you mean 'find centroid of objects in an image'??
use regionprops with property : centroid
Eg : stat = regionprops(Ilabel,'centroid');
I = imread('coins.png');
Ibw = im2bw(I);
Ibw = imfill(Ibw,'holes');
Ilabel = bwlabel(Ibw);
stat = regionprops(Ilabel,'centroid');
imshow(I); hold on;
for x = 1: numel(stat)
plot(stat(x).Centroid(1),stat(x).Centroid(2),'ro');
end

1 comentario

J Shaw
J Shaw el 20 de Feb. de 2018
Hi,
If I use this code, I get a centroid array that has 255 elements. What is the meaning for each element? Thanks!

Iniciar sesión para comentar.

Más respuestas (1)

Sean Lawson
Sean Lawson el 14 de Feb. de 2012

0 votos

Broad question, if the image is your input, simply find the center of the image. But I assume you are asking a more complicated question: like find the centroid of a specific object in an image? if so, need to segment the object out of the image, then find the center point.

4 comentarios

Dhrubajyoti Das
Dhrubajyoti Das el 25 de Sept. de 2013
I want to find the centroid of a face but the face is not in the center of the image... How to find the centroid. Can you please give an answer
Image Analyst
Image Analyst el 25 de Sept. de 2013
Editada: Image Analyst el 25 de Sept. de 2013
Start your own new discussion. And be sure to attach your image.
Dhrubajyoti Das
Dhrubajyoti Das el 28 de Oct. de 2013
Biswas Lohani V K
Biswas Lohani V K el 25 de En. de 2016
HEllo everyone, What is the syntax for this bb = stats(object).BoundingBox; bc = stats(object).Centroid;
could you please define how this code works
Thank you

Iniciar sesión para comentar.

Preguntada:

el 14 de Feb. de 2012

Comentada:

el 1 de Mzo. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by