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

2 vues (au cours des 30 derniers jours)
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 commentaire
Geoff Hayes
Geoff Hayes le 26 Fév 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?

Connectez-vous pour commenter.

Réponses (1)

Matt
Matt le 26 Fév 2018
Modifié(e) : Matt le 26 Fév 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)

Catégories

En savoir plus sur Modify Image Colors dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by