WHY IN GRAY IMAGE HAVE RGB??

조회 수: 3 (최근 30일)
mohd akmal masud
mohd akmal masud 2022년 4월 16일
댓글: Image Analyst 2022년 4월 17일
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?

채택된 답변

Image Analyst
Image Analyst 2022년 4월 16일
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
mohd akmal masud
mohd akmal masud 2022년 4월 17일
But I got error
Unrecognized function or variable 'rgbImage'.
Image Analyst
Image Analyst 2022년 4월 17일
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.

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by