How to open 2D image as file attached.

조회 수: 1 (최근 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 CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by