Hi there,
I have a 32bit tif image https://we.tl/t-H0WliT3O50 . This image is 'single' but Matlab assumes by default 32bit means int32 and when the image is open with imread() the image is binary. I would to read the image using grey scale. How can I do this? I´ve tried itconvert in double but the image is open as binary image.
Any help would be very much appreciated , thanks

8 件のコメント

Ameer Hamza
Ameer Hamza 2020 年 6 月 14 日
編集済み: Ameer Hamza 2020 年 6 月 14 日
In R2020a, MATLAB reads the image as uint32, and imshow shows it correctly as a grayscale image
img = imread('lh.average.CURVATURE.tif');
imshow(img);
Can you show the code to read the image? Also, can you show the output of
class(img)
where img is variable in which image is loaded.
Pamela Garcia
Pamela Garcia 2020 年 6 月 14 日
編集済み: Pamela Garcia 2020 年 6 月 14 日
Thanks for answer quickly.
I would to see the image like this https://we.tl/t-VCQDOLoBcr but imread() open as binary
The result of class(img)
ans =
'int32'
Ameer Hamza
Ameer Hamza 2020 年 6 月 14 日
Which MATLAB release are you using?
Pamela Garcia
Pamela Garcia 2020 年 6 月 14 日
Matlab R2020a
Ameer Hamza
Ameer Hamza 2020 年 6 月 14 日
I am also using R2020a, and it reads the tiff image as uint32. Also, does the tiff and png files you shared corresponds to the same image?
Pamela Garcia
Pamela Garcia 2020 年 6 月 14 日
Yes, I just updated the images and the initial file.
Ameer Hamza
Ameer Hamza 2020 年 6 月 14 日
This tiff file seems to have very unusual encoding. How did you generate the png file from the tiff file?
Pamela Garcia
Pamela Garcia 2020 年 6 月 14 日
It is the result of windows photo visualizer

サインインしてコメントする。

 採用された回答

Walter Roberson
Walter Roberson 2020 年 6 月 14 日

0 投票

If you look at imfinfo() of the file, you can see that the headers say it is a collection of nine images with 32 bit signed integer. If it is intended to be single instead, then the metadata is wrong.
for IDX = 1 : 9
imgint32 = imread('lh.average.CURVATURE.tif','index',IDX);
imgsingle{IDX} = reshape(typecast(imgint32(:), 'single'), size(img32));
end

1 件のコメント

Pamela Garcia
Pamela Garcia 2020 年 6 月 14 日
Thank's a lot !

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeConvert Image Type についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by