Rgb images

To get RGB values:

RGB = imread('C:\Documents and Settings\student2\Desktop\Water lilies.jpg');
R = RGB(:, :, 1);
G = RGB(:, :, 2);
B = RGB(:, :, 3);

      

Can someone tell me why we are using 1, 2, and 3 to get the red, green and blue matrices respectively?

+3


source to share


1 answer


If you look at the RBG: size size(RGB)

, you can see that it is width X height X 3. Each pixel is represented by three values ​​- red, green and blue; the actual pixel color is a mixture of this base color - Wikipedia .



If you want to know the reason why R is 1, G is 2 and B is 3, and R is 3, and B is 1 or whatever, this is just a convention. My guess is that red light is the lower frequency of the light, blue is higher, and green is in between - Wikipedia .

+3


source







All Articles