Grayscale of RGB channels

1 visualizzazione (ultimi 30 giorni)
SNEHA P S
SNEHA P S il 13 Lug 2017
Modificato: Jan il 18 Lug 2017
Is it possible to convert the matrix values of R, G and B channels to its own grayscale values respectively?
  3 Commenti
SNEHA P S
SNEHA P S il 18 Lug 2017
Am not sure that whether the R G and B matrices itself display grayscales ?
Adam
Adam il 18 Lug 2017
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.

Accedi per commentare.

Risposta accettata

Jan
Jan il 18 Lug 2017
Modificato: Jan il 18 Lug 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))

Più risposte (0)

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by