How to save an image converted from RGB to greyscale?

조회 수: 1 (최근 30일)
Kavorka
Kavorka 2016년 3월 16일
답변: Walter Roberson 2016년 3월 16일
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);

채택된 답변

Walter Roberson
Walter Roberson 2016년 3월 16일
imwrite(a, 'OutputFile.png')

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by