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

 采纳的回答

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

更多回答(2 个)

Since RGB images are really 3D matrices, you can use the squeeze command :
pixelRGB = squeeze(yourImage(x,y,:));
use function impixel if you have image processing toolbox
P = impixel(RGB,c,r)

类别

帮助中心File Exchange 中查找有关 Matrix Indexing 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by