covert true colour image to gray
1 view (last 30 days)
Show older comments
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 Comments
per isakson
on 8 Aug 2020
How did you use rgb2gray? rgb2gray isn't supposed to work the way you describe.
What does
which rgb2gray -all
return?
Answers (1)
Anmol Dhiman
on 8 Aug 2020
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
See Also
Categories
Find more on Modify Image Colors in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!