Regionprops returns NaN as centroid value for a Label
Mostrar comentarios más antiguos
Hi This I encountered while trying to relabel my labeling matrices for each of the 97 images I have. My Image Labels as got from below command: unique(filteredimagelabels{19}.L(filteredimagelabels{19}.L~=0)) % Here 19 number is my Image No.19
ans =
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
17
18
19
20
21
22
Total number of labels present in this Label matrix, as in the below command: length(unique(filteredimagelabels{19}.L(filteredimagelabels{19}.L~=0)))
ans =
21
After I applied region props, to the above Label matrix to generate new centroids and other properties, as in the below command:
testforimage19=regionprops(filteredimagelabels{19}.L,{'Centroid','Pixelidxlist'});
The number of fields I am getting in my testforimage19 are 22 (to the expected 21).
I checked my Centroid values for each of the fields in the testforimage19, turns out to be that: testforimage19(16).Centroid % 16 is ofcourse the ROI/Label in Image 19
ans =
NaN NaN
and, I also tried to get Pixel-ids (indices of label 16, for which Centroids were NaN, as seen above)
testforimage19(16).PixelIdxList
ans =
Empty matrix: 0-by-1
What mistake am I doing? I need some inputs. If not clear, shall try to explain more.
Thanks in advance
Harish
Respuesta aceptada
Más respuestas (1)
Anand
el 29 de Ag. de 2013
0 votos
The regionprops function tries searching for the component with label 16, which you seem to have filtered out. So, this component doesn't exist. So, whats the centroid of a component that has no pixels in it or is non-existant?
NaN seems like a good answer to me.
1 comentario
SreeHarish Muppirisetty
el 30 de Ag. de 2013
Categorías
Más información sobre Region and Image Properties en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!