Borrar filtros
Borrar filtros

how to convert a grayscale image to rgb image

20 visualizaciones (últimos 30 días)
KRISHNA MOORTHY
KRISHNA MOORTHY el 18 de Abr. de 2012
Respondida: DGM el 29 de Dic. de 2023
how to covert a grayscale image to rgb image

Respuestas (3)

Walter Roberson
Walter Roberson el 18 de Abr. de 2012
cat(3, YourImage, YourImage, YourImage)
The result will be a truecolor image that happens to only use gray tones.
  2 comentarios
amir
amir el 22 de Ag. de 2012
Movida: DGM el 29 de Dic. de 2023
Dear Walter could you please clarify the process? i didn't get how to execute the commend? many thanks
Walter Roberson
Walter Roberson el 22 de Ag. de 2012
Movida: DGM el 29 de Dic. de 2023
For example:
YourImage = rgb2gray( imread('lena.tif') );
newImage = cat(3, YourImage, YourImage, YourImage);

Iniciar sesión para comentar.


Image Analyst
Image Analyst el 22 de Ag. de 2012
This should also work:
rgbImage = ind2rgb(grayImage, gray(256));
though I usually use the cat() method given by Walter.
  1 comentario
Walter Roberson
Walter Roberson el 23 de Ag. de 2012
The cat() method will work when the grayscale image is class single or double, or uint8 or uint16, but ind2rgb() requires uint8 or uint16.

Iniciar sesión para comentar.


DGM
DGM el 29 de Dic. de 2023
This answer covers multiple ways, depending on what your expected results are:

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by