From separate channels to RGB
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Claudio Esposito
el 2 de Feb. de 2022
Comentada: Stephen23
el 2 de Feb. de 2022
Hello everyone,
I have images in single bands ( Red, Blue and Green) and I need to combine them to obtain an RGB image.
R = imread('red.png');
G = imread('green.png');
B = imread('blue.png');
RGB = cat(3,R,G,B);
I wrote this code: how can I write and save the so obtained RGB image?
Thanks for your kind help.
0 comentarios
Respuesta aceptada
Stephen23
el 2 de Feb. de 2022
Editada: Stephen23
el 2 de Feb. de 2022
I am guessing that the image files are actually Truecolor RGB (with all channels identical) rather than true Grayscale (a sadly all-too-common mixup made by many apps and users), in which case this should work:
RGB = cat(3,R(:,:,1),G(:,:,1),B(:,:,1));
imwrite(RGB, 'rgb.png');
Note that this does not scale/weight the channels!
5 comentarios
Stephen23
el 2 de Feb. de 2022
"I was just trying what would have happen because R-G-B seems too reddish purple in colour."
You might need to consider this:
Más respuestas (1)
Ver también
Categorías
Más información sobre Image Processing Toolbox en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!