covert true colour image to gray

조회 수: 2 (최근 30일)
Rakesh V
Rakesh V 2020년 8월 5일
댓글: Rakesh V 2020년 8월 10일
I have an image 768X1024X3 true colour in bmp, how do I convert to gray 768X1024 only. I used rgb2gray which converts to gray but still 768X1024X3, But it has to just 768X1024, because i need to further process the image,
  댓글 수: 2
per isakson
per isakson 2020년 8월 8일
How did you use rgb2gray? rgb2gray isn't supposed to work the way you describe.
What does
which rgb2gray -all
return?
Rakesh V
Rakesh V 2020년 8월 10일
ff=imread('diffplane.tiff');
>> gg=rgb2gray(ff);
>> imshow(gg);
This did convert the true colour image to gray image.
If you have any doubts, please check with your truecolour image.
How to read red, green and blue elements of true colour image. please help me with the code,

댓글을 달려면 로그인하십시오.

답변 (1개)

Anmol Dhiman
Anmol Dhiman 2020년 8월 8일
Hi Rakesh,
Working on the example given in rgb2gray
RGB = imread('peppers.png'); % RGB
size(RGB) % It gives 384 512 3
I = rgb2gray(RGB); % It creates a new Image I which is grayscale , but RGB is not modified.
size(I) % It gives 384 512.
If you want to modify the same Image variable give
RGB = rgb2gray(RGB); % where RGB is name of the image variable
Incase you aface similar issue , attach your image file for further investigation.
Thanks,
Anmol Dhiman
  댓글 수: 1
Rakesh V
Rakesh V 2020년 8월 10일
Hi Anmol,
It worked. thanks good, may be it was not doing it properly before.
how to get each red, green and blue values of true colur image.
can you tell me.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Modify Image Colors에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by