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
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
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)
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!