Author Topic: enhancement: extract binary data from FLIR radiometric jpg  (Read 178315 times)

Videogamer555

  • Newbie
  • *
  • Posts: 6
Re: enhancement: extract binary data from FLIR radiometric jpg
« Reply #105 on: January 17, 2014, 10:55:22 AM »
Since the FLIR PNGs are in the wrong endian (compared to official PNG standard), what software do you use to decode them after you've extracted them from the FLIR JPEG files? As as I know, there is no software capable of decoding 16-bit grayscale PNG images where the image data's endianness is reversed (short of custom hacking software, built by hackers for the sole purpose of hacking FLIR pics, and these aren't publicly released by the hackers). Does ANYONE here know if there is some software I'm overlooking that COULD decode PNG files with little-endian image data?

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14425
    • ExifTool Home Page
Re: enhancement: extract binary data from FLIR radiometric jpg
« Reply #106 on: January 17, 2014, 11:00:43 AM »
This post gives the technique that Tomas used to swap the endianness of the PNG image.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).


tomas123

  • Sr. Member
  • ****
  • Posts: 101
Re: enhancement: extract binary data from FLIR radiometric jpg
« Reply #108 on: January 17, 2014, 11:04:02 AM »
@phil
see my first link above
we talk about your work in developers forum of ImageMagick  :)

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14425
    • ExifTool Home Page
Re: enhancement: extract binary data from FLIR radiometric jpg
« Reply #109 on: January 17, 2014, 11:08:41 AM »
Thanks Tomas,

I see this has been a hot topic recently. :)

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Videogamer555

  • Newbie
  • *
  • Posts: 6
Re: enhancement: extract binary data from FLIR radiometric jpg
« Reply #110 on: January 17, 2014, 11:51:21 AM »
What do you mean wrong topic?
And I'm not looking for a perl script. I'm looking for an EXE file I can run (I don't have perl, and by looking at your console command lines, I can tell you are using linux, which I don't have. I have windows), one which upon loading a 16 bit grayscale PNG image asks the user (via a dialog box) if they wish to decode it the normal way (BE image data) or the FLIR way (LE image data). Then decodes the image according to the user's choice in the dialog box.

tomas123

  • Sr. Member
  • ****
  • Posts: 101
Re: enhancement: extract binary data from FLIR radiometric jpg
« Reply #111 on: January 17, 2014, 05:52:06 PM »
sorry for misunderstanding
this forum only supports Exiftool and you ask for image manipulations
... there is no software capable of decoding 16-bit grayscale PNG images where the image data's endianness is reversed

see my links above

I can tell you are using linux, which I don't have. I have windows
my first link goes to a windows .exe solution
http://www.imagemagick.org/discourse-server/viewtopic.php?f=2&t=24818#p106958

Videogamer555

  • Newbie
  • *
  • Posts: 6
Re: enhancement: extract binary data from FLIR radiometric jpg
« Reply #112 on: January 21, 2014, 02:08:09 PM »
Seeing a lack of such software, I have made a Visual Basic 6 program that automatically looks at an FFF (raw only) or JPEG+FFF (JPEG with raw embedded, in which case it locates the start of the embedded FFF file) FLIR image file and can automatically determine if the data is PNG compressed (looks for the first four unique bytes of a PNG file). If it is, it extracts it, and simply removes any JPEG tags that may be separating the segments of data. It does not parse the JPEG tags in any way (nor does it handle any of the proprietary FFF header and FFF data chunks). It simply locates the start and end of the embedded PNG file by searching for the strings "‰PNG" and "IEND" (completely ignoring all the proprietary FLIR FFF junk). Then it uses ZLIB to decompress the PNG image data, and reverses the endianness of the now decompressed image data. It then recompresses the image data, recalculates the CRC32 and chunk size for the compressed image data (IDAT) chunk, and saves the resulting fixed IDAT chunk and along with the original header (IHDR) chunk and ending (IEND) chunk to a PNG file. This file is loadable in any software that supports PNG images, and is the correct image. Note this program does NOT handle uncompressed FFF or JPEG+FFF files that store uncompressed raw data (only PNG compressed raw data supported). Also this gives raw thermal IR sensor array values, not temperature readings. I have worked on other programs that do work with the proprietary FLIR stuff, but they only handle uncompressed raw data (not PNG compressed data). Some day I may write a program that combines these and can do "everything" regarding reading FLIR FFF images, but today isn't that day. It would take a LOT of time to combine these as they are both self contained, and don't have the ability to easily be expanded beyond their current capabilities, as my code is kind of "one task" code (would basically require completely rewriting my code in both of my programs, and the rewrite would have to be made into a single program, and that would take many many days of hours long work each day, as long as my 2 current programs took to write, and then some, as combining concepts together is harder than writing code for two different concepts separately).

tomas123

  • Sr. Member
  • ****
  • Posts: 101
Re: enhancement: extract binary data from FLIR radiometric jpg
« Reply #113 on: January 21, 2014, 05:43:45 PM »
I have made a Visual Basic 6 program that automatically looks at an FFF (raw only) or JPEG+FFF (JPEG with raw embedded

please publish your Flir informations in this Flir user thread (I posted the link above, over 3000 post):
http://www.eevblog.com/forum/testgear/flir-e4-thermal-imaging-camera-teardown/
daves posts there some windows binaries for decoding flir images
http://www.eevblog.com/forum/testgear/flir-e4-thermal-imaging-camera-teardown/msg350556/#msg350556

all php scripts here are only proof of concepts for the decoded exif tags

thanks

jskala

  • Newbie
  • *
  • Posts: 5
Re: Atmosphere transmissivity
« Reply #114 on: February 28, 2014, 02:49:46 AM »
Hello,
I came across a description of a few more values in the CameraInfo record.
Code: [Select]
0x70: alpha1 (single)
0x74: alpha2 (single)
0x78: beta1 (single)
0x7c: beta2 (single)
0x80: X (single)
They are used to compute the atmosphere transmissivity tau. The alpha coefficients are the attenuation for atmosphere without water vapour, the beta coefficients are the attenuation for water vapour, and the X is the scaling factor for attenuation.
Code: [Select]
tAtmC = tAtm - 273.15  // in degrees Celsius

h2o = humidity * exp(1.5587 + 6.939e-2 tAtmC - 2.7816e-4 tAtmC^2 + 6.8455e-7 tAtmC^3)

tau = X * exp(-sqrt(distance) * (alpha1 + beta1 * sqrt(h2o))) + (1-X) * exp(-sqrt(distance) * (alpha2 + beta2 * sqrt(h2o)))

Source:
Minkina, Dudzik: Infrared Thermography: Errors and Uncertainities, Appendix A, page 171, http://books.google.cz/books?id=6H3HyacPxnMC&pg=PA171

tomas123

  • Sr. Member
  • ****
  • Posts: 101
Re: enhancement: extract binary data from FLIR radiometric jpg
« Reply #115 on: February 28, 2014, 05:03:33 AM »
A great discovery. There are many questions for atmosphere transmissivity.

I think, it's float. Can you post a sample calculation with specific values?

save this as config.txt
Code: [Select]
# The %Image::ExifTool::UserDefined hash defines new tags to be added to existing tables.
%Image::ExifTool::UserDefined = (
    'Image::ExifTool::FLIR::CameraInfo' => {
          0x070 => { Name => 'AtmosphereTransmissivityAlpha1', Format => 'float', PrintConv => 'sprintf("%f",$val)'},
          0x074 => { Name => 'AtmosphereTransmissivityAlpha2', Format => 'float', PrintConv => 'sprintf("%f",$val)'},
          0x078 => { Name => 'AtmosphereTransmissivityBeta1', Format => 'float', PrintConv => 'sprintf("%f",$val)'},
          0x07C => { Name => 'AtmosphereTransmissivityBeta2', Format => 'float', PrintConv => 'sprintf("%f",$val)'},
          0x080 => { Name => 'AtmosphereTransmissivityX1', Format => 'float', PrintConv => 'sprintf("%f",$val)'},
    },
);   

I run this config file accross all 41 Flir cameras from http://owl.phy.queensu.ca/~phil/exiftool/sample_images.html
Flir never changed this fixed values (this is a good sign)
Code: [Select]
>exiftool -config config.txt -AtmosphereTransmissivity* FLIR-Samples/*.jpg
======== FLIR-Samples/FLIR_B20HS.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_B335.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_b40.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_b50.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_Bertha3.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_E30.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_E30bx.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_E4.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_E40.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_E40bx.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_E50.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_E60.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_i3.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_i5.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_i50.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_i60.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_i7.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_P60.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_P60NTSC.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_P60PAL.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_P640.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_P660.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_T250_Western.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_T360_Western.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_T400.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_T400Western.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_T425.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_T620.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_T620bx.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_T640.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_ThermaCAM_A320.jpg
======== FLIR-Samples/FLIR_ThermaCAM_E65.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_ThermaCAM_EX320.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_ThermaCAM_P640.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_ThermaCAM_P660West.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_ThermaCAM_SC640.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_ThermaCAM_SC660Wes.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_ThermaCAM_T-400.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_ThermaCamP660Wes.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_ThermaCamSC660WES.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
======== FLIR-Samples/FLIR_Z-Camera.jpg
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
   41 image files read


as attachment the source
Minkina, Dudzik: Infrared Thermography: Errors and Uncertainities, Appendix A, page 171, http://books.google.com/books?id=6H3HyacPxnMC&pg=PA171
« Last Edit: February 28, 2014, 11:31:47 AM by tomas123 »

tomas123

  • Sr. Member
  • ****
  • Posts: 101
Re: enhancement: extract binary data from FLIR radiometric jpg
« Reply #116 on: February 28, 2014, 11:15:07 AM »
I hacked your formula in an Excel sheet
Can you please validate this sheet?

the result 0,98 looks good


In every camera manual Flir prints a sample "The measurement formula" with
tau=0,88
Tatm=20°C

I need a distance from 345 meter to get tau = 0,88
I'm unsure....
« Last Edit: February 28, 2014, 09:09:56 PM by tomas123 »

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14425
    • ExifTool Home Page
Re: enhancement: extract binary data from FLIR radiometric jpg
« Reply #117 on: February 28, 2014, 11:47:07 AM »
To me it looks like Alpha2 and Beta1 may be swapped.  If you exchange these, you get tau=0.88 for a distance of 1.4 m.

- Phil

Edit:  Or, with Alpha2 and Beta1 swapped, you also get tau=0.88 for a distance of 1 m and a humidity of 75% (still 20 C).
« Last Edit: February 28, 2014, 12:41:41 PM by Phil Harvey »
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

tomas123

  • Sr. Member
  • ****
  • Posts: 101
Re: enhancement: extract binary data from FLIR radiometric jpg
« Reply #118 on: February 28, 2014, 08:53:41 PM »
@jskala
you formula for tau is correct !!!

I extended the Excel Sheet with a complete temperature calculation (see this snip from Flir E4 camera manual).


for this purpose I created a Flir radiometric jpg with 4x4=16 Pixel and RAW values from 10000 to 25000 (step 1000)
RAW 10000 to 25000 is a good range for a Flir E4 (Temperature Range –20° to 250°C)

Code: [Select]
$ i=0; echo "P2 4 4 65535 "> 1.txt;while [ $i -lt 16 ]; do echo $((10000+$i*1000))>>1.txt; i=$(($i+1));done
$ convert pgm:1.txt 4x4.tif

//check the new image, better use "exiftool 4x4.tif" ;-)
$ identify 4x4.tif
4x4.tif TIFF 4x4 4x4+0+0 16-bit Grayscale Gray 224B 0.000u 0:00.000

// create a flir jpg with splitjpg.php from my post here
// http://www.eevblog.com/forum/testgear/flir-e4-thermal-imaging-camera-teardown/msg348715/#msg348715
// you need a real flir image for injection
$ ./splitjpg.php -i FLIR0008.jpg -r 4x4.tif -o 4x4.jpg

// check the new raw values
$ exiftool -b -RawThermalImage 4x4.jpg | convert - -compress none pgm:-
P2
4 4
65535
10000 11000 12000 13000 14000 15000 16000 17000 18000 19000 20000 21000 22000
23000 24000 25000

now open the 4x4.jpg with Flir Tools, change the values for atmosphere and distance and export the object temperature of every pixel in a csv file

As attachment two files with 4x4 Pixels
4x4-0m.jpg (Distance 0m, meaning no influence of air) ->  temperature 4x4-0.csv
4x4-100m.jpg (Distance 100m) -> temperature 4x4-100.csv

now compare the exported temperature of 16 Pixel from Flir Tools (°C)
Code: [Select]
$ cat 4x4-100.csv | tr ";" "\n" | tr "\n" " "
-17,98 1,64 17,56 31,233 43,372 54,383 64,521 73,962 82,828 91,211 99,18 106,79 114,085 121,1 127,865 134,403

with the result of Excel calculation for a distance of 100 meters
Code: [Select]
-17,980 1,640 17,560 31,233 43,372 54,383 64,521 73,962 82,828 91,211 99,180 106,790 114,085 121,100 127,865 134,403
PERFECT



used input values in Excel
Code: [Select]
$ exiftool -config config.txt -Atmos* -Planck* -Object* -Emis* -Reflected* -Relativ* 4x4-100m.jpg
Atmospheric Temperature         : 20.0 C
Atmosphere Transmissivity Alpha 1: 0.006569
Atmosphere Transmissivity Alpha 2: 0.012620
Atmosphere Transmissivity Beta 1: -0.002276
Atmosphere Transmissivity Beta 2: -0.006670
Atmosphere Transmissivity X1    : 1.900000
Planck R1                       : 14168.402
Planck B                        : 1386
Planck F                        : 2.5
Planck O                        : -7363
Planck R2                       : 0.026881648
Object Distance                 : 100.00 m
Emissivity                      : 0.95
Reflected Apparent Temperature  : 30.0 C
Relative Humidity               : 50.0 %

@Phil
the config.txt from http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,4898.msg27532.html#msg27532 works fine !!
you certainly find better names  ;)
« Last Edit: February 28, 2014, 10:00:23 PM by tomas123 »

tomas123

  • Sr. Member
  • ****
  • Posts: 101
Re: enhancement: extract binary data from FLIR radiometric jpg
« Reply #119 on: March 01, 2014, 09:29:43 AM »
google is your friend

with informations from jskala I found a Flir document with the atmosphere transmissivity calculation and the corresponding names of constants

Toolkit IC2 Dig 16 Developers Guide 1.01; FLIR Publication number: 557 344 version B.
http://www.workswell.cz/manuals/flir/hardware/Toolkit_IC_2_Dig_16/Toolkit_IC2_Dig16_Developers_Guide_1_01_AGEMA_550_570_ThermaCAM_PM5X5_and_the_ThermoVisionFamily.pdf

as attachment the pages with the formulas and names
(ignore further calculations with K1/K2 , use formulas from excel sheet from my last post)