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

1 回表示 (過去 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 Center および File ExchangeOrange についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by