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

3 Comments

Sneha - please clarify what you mean by ...R, G, and B channels to its own grayscale values respectively.
Am not sure that whether the R G and B matrices itself display grayscales ?
Each of the R, G and B channels can already be considered greyscale by itself. Whether it is useful to do so or not is another matter, but you haven't given any information so it's impossible to say.

Sign in to comment.

 Accepted Answer

Jan
Jan on 18 Jul 2017
Edited: Jan on 18 Jul 2017
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))

More Answers (0)

Tags

Asked:

on 13 Jul 2017

Edited:

Jan
on 18 Jul 2017

Community Treasure Hunt

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

Start Hunting!