I need a way to assign a value for each pixel based on RGB values. which will be based on equations for red,blue and green

1 次查看(过去 30 天)
So for blue (0-255) it will have a value between 0 and 10 for green (0-255) it will have a value between 10 and 20 for red (0-255) it will have a value between 20 and 90. And when a pixel is selected I want get the value based on the equations based on the pixel's RGB values.
  1 个评论
Geoff Hayes
Geoff Hayes 2018-2-26
Nasser - are you assigning one value for each pixel? How would you convert or assign the value for
(70, 140, 210) ---> (R, G, B)
What equations are you using to map (say) the 210 to a value between 0 and 10?

请先登录,再进行评论。

回答(1 个)

Matt
Matt 2018-2-26
编辑:Matt 2018-2-26
The imread function in MATLAB does something like this. It will output a matrix with rows, columns (each element corresponding to a pixel) and 3 pages. Each page corresponds to a primary color present in the image: red, green and blue.
A = imread('ngc6543a.jpg');
imshow(A)
R = A(:,:,1);
G = A(:,:,2);
B = A(:,:,3);
figure
subplot(2,2,1)
imshow(R)
subplot(2,2,2)
imshow(G)
subplot(2,2,3)
imshow(B)

类别

Help CenterFile Exchange 中查找有关 Modify Image Colors 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by