cheminfo / irb-converter

0 stars 0 forks source link

Create parser #1

Open lpatiny opened 2 years ago

lpatiny commented 2 years ago

We need to be able to parse IRB files from https://www.infratec.eu/thermography/service-support/manuals/

Ref: https://www.eevblog.com/forum/thermal-imaging/the-story-of-an-unusual-thermal-camera-purchase-by-fraser/

I did reverse engineer some file from a 1024x768 Variocam some time ago - basic file reading display should be easy. The file layout is a bit off from what I have seen on other IR camera (FLIR .ptw, .sfmov and so on). Here is roughly what it is about: Code: [Select] private const int IRBISFileHeaderSize = 512; private const int IRBISDummyDataSize = 6400; private const int IRBISFrameHeaderSize = 512; private const int IRBISFrameFooterSize = 6400; private const int IRBISImageHeaderSize = 7761; //where Video structure is: //FileHeader + Dummy+FrameHeader+Frame+FrameFooter + Dummy+FrameHeader+Frame+FrameFooter + ... + + Dummy+FrameHeader+Frame+FrameFooter //offset to data of frame N is: //offset = 512 + 6400 + 512 + N(wh2 + 6400 + 6400 + 512) //and file size is: //size = 512 + N(6400 + 512 + wh2 + 6400) //or N from file size: //N = (size - 512) / (6400 + 512 + wh2 + 6400)

The nasty thing is that image width and height can not be found in the header, but instead in each frame footer. So I choose to read the last frame footer and get image size from there to be able to read all the rest of the data. :palm: For the camera data I dealt with image width was at offset 196 and height at offset 198 in each frame footer encoded as 16-bit integer.

I did not mess around with any of the calibration data - just reading the raw pixel data and displaying it. Hope this helps...

lpatiny commented 2 years ago

@maasencioh Could you upload an example file with the corresponding expected result ?

maasencioh commented 2 years ago

I added a tif image and the original value

https://drive.google.com/drive/folders/1rQCTHkvXHtFGkBBX35qRi2sdca1oEwC6?usp=sharing

Magic number seems to be FF 49 52 42 00 49 52 42 49 53 33

maasencioh commented 2 years ago

This looks promising, but the current output is null https://github.com/jonathanschilling/irb

Screen Shot 2022-03-30 at 16 49 10