How can i get RGB value if i have position(x,y)

 Akzeptierte Antwort

Image Analyst
Image Analyst am 22 Jan. 2012

2 Stimmen

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);

Weitere Antworten (2)

Andrew Fowler
Andrew Fowler am 21 Jan. 2012

0 Stimmen

Since RGB images are really 3D matrices, you can use the squeeze command :
pixelRGB = squeeze(yourImage(x,y,:));
Sukuchha
Sukuchha am 22 Jan. 2012

0 Stimmen

use function impixel if you have image processing toolbox
P = impixel(RGB,c,r)

Kategorien

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by