How to save an image converted from RGB to greyscale?

1 visualización (últimos 30 días)
Kavorka
Kavorka el 16 de Mzo. de 2016
Respondida: Walter Roberson el 16 de Mzo. de 2016
I'm new to matlab and when I convert an RGB image to a greyscale intensity map, I can't get the output to save as a greyscale...it saves an an RGB. Is this because I am using imshow and then saving the figure? If so, can someone help me figure out how to work imwrite into this code? I'm using:
i = imread('sample.png');
i = im2double(i);
a = .299*i(:,:,1) + .587*i(:,:,2) + .114*i(:,:,3);
imshow(a);

Respuesta aceptada

Walter Roberson
Walter Roberson el 16 de Mzo. de 2016
imwrite(a, 'OutputFile.png')

Más respuestas (0)

Categorías

Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by