How to open 2D image as file attached.

2 ビュー (過去 30 日間)
mohd akmal masud
mohd akmal masud 2023 年 6 月 22 日
コメント済み: DGM 2023 年 7 月 2 日
Dear all,
I have the file as attached, the format is .int
Actually this is 2D planar image.
Anyone can help me to open it in Matlab?
  1 件のコメント
DGM
DGM 2023 年 6 月 23 日
This does not appear to be an SGI .INT file. In fact, it doesn't appear to have any header. What is it, where did it come from, and did it come with a header file?

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

採用された回答

DGM
DGM 2023 年 6 月 23 日
編集済み: DGM 2023 年 6 月 23 日
Nevermind. That was simpler than I thought.
fid = fopen('jaszak1.int', 'r', 'ieee-le');
data = fread(fid, inf, '*uint16');
fclose(fid);
data = reshape(data,64,64);
imagesc(data)
  2 件のコメント
mohd akmal masud
mohd akmal masud 2023 年 7 月 2 日
編集済み: mohd akmal masud 2023 年 7 月 2 日
this is correct @DGM,
But what I confused is, why the matrix become 64x64, because the original matrix setting is 128x128?
Can you explain?
DGM
DGM 2023 年 7 月 2 日
I don't know anything about where this image came from or what it used to be. All I know is that you have 8192 bytes of data. Assuming there is no compression, that would either make a 64x64 image at 16b/pixel or a nonsquare 128x64 or 64x128 image at 8b/pixel. In order to arrange the file into 128x128, it would need to be 4b/pixel, which would be unlikely.
We could try using 4b/pixel:
... but it doesn't work out.
When I look at the file, I see a gradual transition from a zero field to some larger values. The way each nonzero byte is separated by a zero byte suggests that it's a 2-byte encoding. Reading the file at 8 or 4 bits per pixel will always produce an image with periodic gaps between nonzero pixels
So if the image used to be 128x128, I don't know how it got to be in this form. All I can do is look at what I see.

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

その他の回答 (0 件)

カテゴリ

Help Center および 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