How to get the pixel value at centroid point
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Elysi Cochin
le 20 Sep 2017
Réponse apportée : Walter Roberson
le 20 Sep 2017
how i get the pixel value at the centroid of image
i did as below
cn = s(1).Centroid;
rc = round(cn);
pixelValue = img(rc(1),rc(2));
but in some cases error is shown as
Index exceeds matrix dimensions.
Error in exe_demo (line 73)
pixelValue = img(rc(1),rc(2))
But the centroid point is plotted correctly. How to get the pixel value at that point without error.
0 commentaires
Réponse acceptée
Walter Roberson
le 20 Sep 2017
pixelValue = img(rc(2), rc(1));
The centroid coordinate order is X, Y, but image arrays are in the order Y, X.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Read, Write, and Modify Image dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!