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

3 Ansichten (letzte 30 Tage)
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 Kommentar
Geoff Hayes
Geoff Hayes am 26 Feb. 2018
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?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Matt
Matt am 26 Feb. 2018
Bearbeitet: Matt am 26 Feb. 2018
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)

Community Treasure Hunt

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

Start Hunting!

Translated by