필터 지우기
필터 지우기

Gray(scale) image with a colormap - how to turn into double?

조회 수: 2 (최근 30일)
John Kau
John Kau 2015년 7월 30일
댓글: MatlabEnthusiast 2019년 12월 22일
Hi,
I have an 8-bit image that consists only of gray colors. On checking the characteristics of the image in Matlab with imfinfo, it turns out that it is ColorType "indexed" and has a colormap of 256x3. I would like to transform this image into a simple grayscale image of a n x m matrix (according to its size) class double.
The function ind2gray demands a colormap and using the colormap of this image didn't work on my end. Probably I'm doing something wrong.
Any help is much appreciated.
I'm struggling finding a solution.
Thanks

채택된 답변

David Young
David Young 2015년 7월 30일
편집: David Young 2015년 7월 30일
This works OK:
[imInd, cmap] = imread('10.bmp');
imGrayUint8 = ind2gray(imInd, cmap);
imGrayDouble = im2double(imGrayUint8);
imshow(imGrayDouble);
  댓글 수: 3
Image Analyst
Image Analyst 2015년 7월 31일
What did you do when you said "The function ind2gray demands a colormap and using the colormap of this image didn't work on my end"? Because that is exactly what David did. And casting to double shouldn't really be necessary.
MatlabEnthusiast
MatlabEnthusiast 2019년 12월 22일
hello. now how do you regain the rgb image from the double image?

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Colormaps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by