How can i get RGB value if i have position(x,y)
14 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
if i have position of image(pixel) . How can i get RGB value of this position?
0 Commenti
Risposta accettata
Image Analyst
il 22 Gen 2012
Note that row = y and is the first index, not the second index.
redValue = rgbImage(y, x, 1);
greenValue = rgbImage(y, x, 2);
blueValue = rgbImage(y, x, 3);
0 Commenti
Più risposte (2)
Andrew Fowler
il 21 Gen 2012
Since RGB images are really 3D matrices, you can use the squeeze command :
pixelRGB = squeeze(yourImage(x,y,:));
0 Commenti
Sukuchha
il 22 Gen 2012
use function impixel if you have image processing toolbox
P = impixel(RGB,c,r)
0 Commenti
Vedere anche
Categorie
Scopri di più su Matrix Indexing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!