new Tags in Flir Images (MeterLink)

Started by tomas123, October 09, 2013, 02:29:26 PM

Previous topic - Next topic

tomas123

I connected my Flir E40 over Bluetooth with a MO297 Moisture/Humidity Meter
see http://www.extech.com/meterlink/

now we get a new FLIR Record 0x2c with the measured values from MO297

I decoded the record 0x2c ;-)
exiftool -config config.txt -value* IR_03*.jpg
======== IR_0303.jpg
Value Unit Name 1               : %
Value Name 1                    : Humidity
Value Mess 1                    : 54.8
Value Unit Name 2               : C
Value Name 2                    : DewPoint
Value Mess 2                    : 12.6
======== IR_0305.jpg
Value Unit Name 1               : g/kg
Value Name 1                    : Humidity
Value Mess 1                    : 0.0091
Value Unit Name 2               : C
Value Name 2                    : AirTemp
Value Mess 2                    : 22.1
======== IR_0307.jpg
Value Unit Name 1               : rel
Value Name 1                    : MOIST
Value Mess 1                    : 8
Value Unit Name 2               : C
Value Name 2                    : AirTemp
Value Mess 2                    : 22
======== IR_0309.jpg
Value Unit Name 1               : rel
Value Name 1                    : MOIST
Value Mess 1                    : 3.1
Value Unit Name 2               : C
Value Name 2                    : IRTemp
Value Mess 2                    : 20.2
======== IR_0311.jpg
Value Unit Name 1               : C
Value Name 1                    : DiffTemp
Value Mess 1                    : 7.5
Value Unit Name 2               : C
Value Name 2                    : DewPoint
Value Mess 2                    : 20
    5 image files read


as attachment the config file and the sample images with the imprint values

The config file is only a dirty hack. I'm poor perl hacker.
I can't recursive split a Exiftool Record, so I simply repeated the code for first and second measured value.

furthermore there are two bad corners:
- the saved temperature is Kelvin
- the value for the Absolute humidity is [g/kg] but the saved value is [kg/kg]

you can
- combine the tags (i.e. 9.6 g/kg)
- find better tag names ;-)



explanation

The Record contains as many values, as user saved in Camera:
- 8 Byte Header
- 100 Byte first measured value
- 100 Byte first second value
... and so on

the code is simple

here the first values
at 0x1A stand the Quantity Name and the Unit Name (3 Byte)
RH %        1b 00 00 Humidity
INT/MOIST %     1d 00 03   Pinless Moisture Measurements with INTernal sensor
Air °C      0d 00 08      Air Temperatur
DEW °C      0d 00 07   DewPoint
Hum g/kg    24 00 00  Humidity
IR °C       0d 00 09   IR-Thermometer
Diff °C     0d 00 0b   Difference Temp: IR-Temp and DewPoint


at 0x20 -> Device Name (I think 16 Byte)
at 0x60 -> measured value (double!)
at 0x 69 ->the ASCII counter for saved values (0x31, 0x32 etc.)

for the second values add 100 Byte...


QuoteC:\util\exiftool>exiftool -v4 IR_0311.jpg | grep -A 40 "FLIR Record 0x2c"
  | FLIR Record 0x2c, offset 0x26740, length 0x0198
  |    26740: 01 00 08 00 10 00 00 00 64 00 01 01 50 00 04 00 [........d...P...]
  |    26750: 00 00 01 00 01 00 00 00 01 00 0d 00 0b 00 00 00 [................]
  |    26760: 4d 4f 32 39 37 00 00 00 00 00 00 00 00 00 00 00 [MO297...........]
  |    26770: 3c e5 03 b7 1f 00 00 00 4d 8c 55 52 93 00 00 00 [<.......M.UR....]
  |    26780: 02 01 00 00 00 00 00 00 00 00 00 00 03 00 03 00 [................]
  |    26790: 01 00 01 00 00 00 00 00 00 00 00 00 08 00 00 00 [................]
  |    267a0: 00 00 00 00 00 00 1e 40 31 00 00 00
64 00 01 01 [.......@1...d...]
  |    267b0: 50 00 04 00 00 00 01 00 02 00 00 00 01 00 0d 00 [P...............]
  |    267c0: 07 00 00 00 4d 4f 32 39 37 00 00 00 00 00 00 00 [....MO297.......]
  |    267d0: 00 00 00 00 3c e5 03 b7 1f 00 00 00 4d 8c 55 52 [....<.......M.UR]
  |    267e0: 93 00 00 00 02 01 00 00 00 00 00 00 00 00 00 00 [................]
  |    267f0: 03 00 03 00 00 00 01 00 00 00 00 00 00 00 00 00 [................]
  |    26800: 08 00 00 00 66 66 66 66 66 52 72 40 32 00 00 00 [....fffffRr@2...]
  |    26810: 64 00 01 01 50 00 04 00 00 00 01 00 03 00 00 00 [d...P...........]
  |    26820: 02 00 1b 00 00 00 00 00 4d 4f 32 39 37 00 00 00 [........MO297...]
  |    26830: 00 00 00 00 00 00 00 00 3c e5 03 b7 1f 00 00 00 [........<.......]
  |    26840: 6d 8c 55 52 06 01 00 00 30 01 00 00 00 00 00 00 [m.UR....0.......]
  |    26850: 00 00 00 00 03 00 03 00 00 00 01 00 00 00 00 00 [................]
  |    26860: 00 00 00 00 08 00 00 00 cd cc cc cc cc 8c 4b 40 [..............K@]
  |    26870: 33 00 00 00 00
00 01 01 50 00 04 00 00 00 01 00 [3.......P.......]
  |    26880: 04 00 00 00 02 00 0d 00 08 00 00 00 4d 4f 32 39 [............MO29]
  |    26890: 37 00 00 00 00 00 00 00 00 00 00 00 3c e5 03 b7 [7...........<...]
  |    268a0: 1f 00 00 00 6d 8c 55 52 06 01 00 00 30 01 00 00 [....m.UR....0...]
  |    268b0: 00 00 00 00 00 00 00 00 03 00 03 00 00 00 01 00 [................]
  |    268c0: 00 00 00 00 00 00 00 00 08 00 00 00 66 66 66 66 [............ffff]
  |    268d0: 66 72 72 40 34 00 00 00                         [frr@4...]





Phil Harvey

This is GREAT!  Thanks!!  Well done!!!

Attached is an edited version of the config file.  I made a number of changes to fit in with the ExifTool coding style, and have changed the names from Value to Reading because this is the terminology that FLIR used in their documentation.  Please let me know if you would like anything done differently.

If you are happy with this, I will combine it into the next version of ExifTool.

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

tomas123

It is always a pleasure to work with you together.

I thought you hacked the multiple values with a perl loop like for(;;) {...}
The IR_0311.jpg contains 4 values.

there is a minor bug:
From the difference temp. dont subtract 273,15Kelvin (you misstyped 237,15..)

I have changed the config file for 4 values  :)  and corrected the difference temperature

RawConv => '$$self{Reading4Description} = $val',
...
return $val - 273.15 if $$self{Reading4Units} == 0x0d and $$self{Reading4Description} != 11;


what you mean with ...
DataMember => 'Reading4Units',
PrintHex => 1,


as attachment the new config file.
now all values indentical with the imprint values (in jpg)

Phil Harvey

Hi Tomas,

Quote from: tomas123 on October 10, 2013, 05:47:50 AM
It is always a pleasure to work with you together.

Likewise!

QuoteI thought you hacked the multiple values with a perl loop like for(;;) {...}
The IR_0311.jpg contains 4 values.

I could do this, but it would be a bit complex to generate different tag names for each reading.  Eventually this may be the thing to do, but until we understand more about the MeterLink structure it makes sense to keep it simple.  I am guessing that the two bytes at the beginning of each structure (0x0064) give the size of the structure, and the bytes following this could indicate the type of structure.  It is possible that different devices generate different types of structures.  The decoding logic may have to be changed completely if/when other devices are tested.

Quotethere is a minor bug:
From the difference temp. dont subtract 273,15Kelvin (you misstyped 237,15..)

Oops.  Thanks.

QuoteI have changed the config file for 4 values  :)  and corrected the difference temperature

Excellent!

Quotewhat you mean with ...
DataMember => 'Reading4Units',
PrintHex => 1,

The DataMember is technically only used when writing EXIF, but I include it out of habit for completeness.  From the lib/Image/ExifTool/README documentation:

                  'DataMember' - name of exiftool data member associated with
                  this tag if it should be stored as a special data member when
                  writing information.  Necessary only if the value of the tag
                  affects other written information.  Currently only used for
                  tags in EXIF tables where it triggers the execution of the
                  RawConv to convert and store the value as an ExifTool data
                  member when writing.


PrintHex is also explained in this document:

                  'PrintHex' - specifies that unknown PrintConv values should
                  be printed in hex (ie. 'Unknown (0x01)').  Also causes
                  numerical tag values to be printed in hex in the HTML tag name
                  documentation.


Quoteas attachment the new config file.
now all values indentical with the imprint values (in jpg)

Great, thanks!  I've combined your update into my working code.

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

tomas123

painful  :'( -  I never read the document /Image/ExifTool/README
my solution was reading the Flir.pm and then "trial and error"

--
It's possible, that 0x64 = 100 Byte marks the structure
I'm wonder, that Flir waste 100 Byte for a 8 Byte value and not save the strings for "quantity name" and "unit name". It's not flexible for new MeterLink Devices. Every Flir Camera with MeterLink need a firmware update for imprinting the new values in their display.

That's enough - it works
thanks

Phil Harvey

Quote from: tomas123 on October 10, 2013, 09:04:02 AM
painful  :'( -  I never read the document /Image/ExifTool/README

This is a complete reference that I need because my memory isn't great.  I don't suggest reading the whole thing, but  it may be a good reference for helping to understand specific parts of the tag definitions.

Quotemy solution was reading the Flir.pm and then "trial and error"

Yes.  This is the best/easiest way to do it.  And you did very well too!

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