MATLAB: Grayscale of RGB channels

grayscale

Is it possible to convert the matrix values of R, G and B channels to its own grayscale values respectively?

Best Answer

RGB = rand(100, 100, 3); % RGB array
R = RGB(:, :, 1); % Gray image of the red channel
G = RGB(:, :, 2); % Gray image of the green channel
B = RGB(:, :, 3); % Gray image of the blue channel
figure
image(R)
figure
image(cat(3, R, R, R))