How to open 2D image as file attached.
1 次查看(过去 30 天)
显示 更早的评论
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
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
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 个评论
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 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!