WHY IN GRAY IMAGE HAVE RGB??

4 views (last 30 days)
mohd akmal masud
mohd akmal masud on 16 Apr 2022
Commented: Image Analyst on 17 Apr 2022
Dear Sir,
I have image below as gray image. The index value (439) indicate as gray level. But what I dont understand is, why the RGB value on it image?
Because as I know this is gray image.
The set of my images as attached.
Anyone can help me to explained to me?

Accepted Answer

Image Analyst
Image Analyst on 16 Apr 2022
It's an RGB image. It's just that the red channel, the green channel, and the blue channel are all the same so it appears as gray scale. You can convert it to grayscale by taking any one of the color channels:
grayImage = rgbImage(:, :, 1);
  2 Comments
mohd akmal masud
mohd akmal masud on 17 Apr 2022
But I got error
Unrecognized function or variable 'rgbImage'.
Image Analyst
Image Analyst on 17 Apr 2022
When I actually opened the dicom file I found out it's 256x256x1x142 so it's a 3-D image. You can do this:
fileName = 'I-13125610N1.dcm'
rgbImage = dicomread(fileName);
imageSize = size(rgbImage)
for slice = 1 : imageSize(4)
grayImage = rgbImage(:, :, 1, slice);
imshow(grayImage, []);
caption = sprintf('#%d of %d', slice, imageSize(4));
title(caption, 'FontSize', 14);
drawnow;
end
to display them all.

Sign in to comment.

More Answers (0)

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!