Borrar filtros
Borrar filtros

how to converty gray image to color image?

3 visualizaciones (últimos 30 días)
Sivakumaran Chandrasekaran
Sivakumaran Chandrasekaran el 25 de Sept. de 2012
how to converty gray image to color image?

Respuestas (1)

Image Analyst
Image Analyst el 25 de Sept. de 2012
Depending on what you want the gray to be....
grayImage = rgb2gray(rgbImage);
OR
grayImage = rgbImage(:, :, 1); % Extract red channel.
grayImage = rgbImage(:, :, 2); % Extract green channel.
grayImage = rgbImage(:, :, 3); % Extract blue channel.
  4 comentarios
Ryan
Ryan el 25 de Sept. de 2012
To build on Matt's answer, here is a reference for colormaps in Matlab: http://www.mathworks.com/help/matlab/ref/colormap.html
Image Analyst
Image Analyst el 25 de Sept. de 2012
Sorry. I didn't notice, since this is much much less common than the other way. You can use cat() or ind2rgb():
rgbImage = cat(3, grayImage, grayImage, grayImage);
rgbImage = ind2rgb(grayImage, cmap); % e.g. cmap = gray(256)

Iniciar sesión para comentar.

Categorías

Más información sobre Red en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by