How to convert centroid values to array
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
distance=l(1).centroid; %works fine
1 2
1 12.79 9.970
*while performing loop I am getting an error of array mismatch.(I think centroid has two values but I am trying to assign it to single array.)
for i=1:N
distance(i)=l(i).Centroid % getting an error
end
centroid values
[12.7956777996070,9.97053045186637]
[12.3260393873085,45.6477024070019]
[12.2386934673366,63.8693467336681]
[17.4170755642790,86.2463199214916]
[13.3798076923078,118.569711538463]
0 Kommentare
Antworten (1)
Image Analyst
am 7 Mai 2017
I wouldn't call it l - It's probably the single worst name, other than O that you could use. I looks too much like 1(one) and l (lower case L). Call it props since it comes from regionprops(). So
allCentroids = [props.Centroid];
xCentroids = allCentroids(1:2:end);
yCentroids = allCentroids(2:2:end);
0 Kommentare
Siehe auch
Kategorien
Mehr zu Convert Image Type finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!