WHY IN GRAY IMAGE HAVE RGB??

3 visualizzazioni (ultimi 30 giorni)
mohd akmal masud
mohd akmal masud il 16 Apr 2022
Commentato: Image Analyst il 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?

Risposta accettata

Image Analyst
Image Analyst il 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 Commenti
mohd akmal masud
mohd akmal masud il 17 Apr 2022
But I got error
Unrecognized function or variable 'rgbImage'.
Image Analyst
Image Analyst il 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.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Image Processing Toolbox in Help Center e File Exchange

Prodotti


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by