How to open 2D image as file attached.

2 views (last 30 days)
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 Comment
DGM
DGM on 23 Jun 2023
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?

Sign in to comment.

Accepted Answer

DGM
DGM on 23 Jun 2023
Edited: DGM on 23 Jun 2023
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 Comments
mohd akmal masud
mohd akmal masud on 2 Jul 2023
Edited: mohd akmal masud on 2 Jul 2023
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 on 2 Jul 2023
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.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!