Algorithm used to find centroids in regionprops.
    10 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Naseeb Gill
      
 el 31 de Mayo de 2016
  
    
    
    
    
    Comentada: Veena Chatti
 el 8 de Jul. de 2020
            I used regionprops to find centroids in image processing. But now I have to put algorithm to show how code works to find these centroids. Someone please tell me the algorithm used for the same.
1 comentario
  Veena Chatti
 el 8 de Jul. de 2020
				I am also looking for further information on the algorithms underlying the regionprops function's outputs. Did you manage to find further information from MATLAB? Thanks!
Respuesta aceptada
  Image Analyst
      
      
 el 31 de Mayo de 2016
        It's a good question but I don't know that we have an answer. I know the area from regionprops is simply the pixel count, because it says so, unlike bwarea which gives the area differently depending on how many pixels are on the outer edge of the blob. Now the unweighted centroid formula is normally just the average of the x and y coordinates of all the pixels in the blob, but whether they weight pixels differently depending on whether they are near the edge (background) is not stated.
Another flavor of centroid, the weighted centroid is just sum(g*x)/sum(g) - where g is the gray level. Note how the g "cancels out" so you're left with something with units of x. The weighted centroid may be further weighted by whether a pixel is near the edge. That said, I don't think they weight pixels differently depending on their adjacency to an edge like they do for bwarea(), though I'm not 100% sure.
5 comentarios
  Image Analyst
      
      
 el 1 de Jun. de 2016
				This is not true:
% centx and centy are the centroid of first column
It should say
% centx and centy are the centroid of the first blob.
And it looks like sizx is simply the number of pixels in the first blob, not of a column in the blob. And so, since sizx is just a scalar, sizex is just 1. The whole thing is just a mess and you should just use mean() like Walter suggested.
Más respuestas (1)
  Walter Roberson
      
      
 el 31 de Mayo de 2016
        1 comentario
  Walter Roberson
      
      
 el 31 de Mayo de 2016
				For images with a single region:
[R, C] = find(YourImage);
Y_centroid = mean(R);
X_centroid = mean(C);
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




