enhancement: extract binary data from FLIR radiometric jpg

Started by tomas123, March 20, 2013, 12:49:46 PM

Previous topic - Next topic

hectorb79

#180
Hello tomas123 / Phil, how are you

Sorry for the next question, I am not sure if this is the right forum... here we go: When I try to run the pipe suggested by tomas, I receive the  error messages shown below:

Code:
$ exiftool C:/Users/Bastidas/Documents/fotos_pruebas/DJI_0866.jpg -b -RawThermalImage | convert.exe - gray:- | convert.exe -depth 16 -endian msb -size 320x240 gray:- -auto-level C:/Users/Bastidas/Documents/fotos_pruebas/DJI_0866_outraw.png

Errors:
convert.exe: unexpected end-of-file '-': No such file or directory @ error/gray.c/ReadGRAYImage/241.
convert.exe: no images defined `C:/Users/Bastidas/Documents/fotos_pruebas/DJI_0866_outraw.png' @ error/convert.c/ConvertImageCommand/3288.


Do you know what is the problem?

I am attentive to your commentes

StarGeek

What is the result when you run
exiftool C:/Users/Bastidas/Documents/fotos_pruebas/DJI_0866.jpg -RawThermalImage

You should get back something like
RawThermalImage: (Binary data ##### bytes, use -b option to extract)

If you don't get something like that, then there isn't a RawThermalImage to extract.

Also, make sure you're using CMD, not Powershell.  Powershell doesn't play nice with piping binary data.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

hectorb79

#182
Hello StarGeek, good day!

Thanks for you feedback! This is the result

$ exiftool C:/Users/Bastidas/Documents/fotos_pruebas/DJI_0866.jpg -RawThermalImage
Raw Thermal Image               : (Binary data 655564 bytes, use -b option to extract)

Software which I'm using:
- Windows 10 and CMD
- Exiftool 11.1.0.0
- ImageMagick-7.0.8-11-Q16-x64-dll

The picture DJI_0866.jpg was taken with a cam Flir Zenmuse XT-R. I can read this picture in Flir Tools without problems, edit variables as emissivity and reflected temperature, then, return the temperatures absolutes.

I am attentive if you have other suggestions to my problem!

Thanks!!

Phil Harvey

Try each step in the chain separately, taking a look at the image produced by each step, starting with the raw thermal image:

exiftool -rawthermalimage -b C:/Users/Bastidas/Documents/fotos_pruebas/DJI_0866.jpg -W raw_image.%s

This command will produce a file called "raw_image" in the current directory with an appropriate extension.

- 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 ($).

hectorb79

Quote from: Phil Harvey on September 21, 2018, 09:42:00 AM
Try each step in the chain separately, taking a look at the image produced by each step, starting with the raw thermal image:

exiftool -rawthermalimage -b C:/Users/Bastidas/Documents/fotos_pruebas/DJI_0866.jpg -W raw_image.%s

This command will produce a file called "raw_image" in the current directory with an appropriate extension.

- Phil

Hello Phil ! Thanks for your comments!

The command produce the .TIFF correctly (see attachment). I think that exiftool works perfect. Then I guess my problem is with ImageMagick when I try to do the next steps in the pipe to produce the .png.

What do you recommend me?

I am attentive to your comments.

Phil Harvey

Now try the "convert" commands one at a time.  To see which one fails.   You will probably have to read the "convert" documentation to figure this out.

- 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 ($).

Lawdefined

Hi Phil, Hectorb79,

Even I am facing the same issue.

When I execute the command

exiftool  DJI_0014.jpg -b -RawThermalImage | convert.exe -size 640x512 gray:- C114.png

It gives me following error

convert.exe: Unknown field with tag 63 (0x3f) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/1029.
convert.exe: Unknown field with tag 6656 (0x1a00) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/1029.
convert.exe: Unknown field with tag 6912 (0x1b00) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/1029.
convert.exe: Unknown field with tag 7168 (0x1c00) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/1029.
convert.exe: Unknown field with tag 10240 (0x2800) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/1029.
convert.exe: Bogus "StripByteCounts" field, ignoring and calculating from imagelength. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/1029.
convert.exe: must specify image size `-' @ error/gray.c/ReadGRAYImage/147.


I could make sense out of the last error "convert.exe: must specify image size `-' @ error/gray.c/ReadGRAYImage/147."

and executed the rectified command

exiftool  DJI_0014.jpg -b -RawThermalImage | convert.exe -size 640x512 gray:- C114.png

and then error pops up saying

convert.exe: unexpected end-of-file '-': No such file or directory @ error/gray.c/Read
convert.exe: no images defined `C114.png' @ error/convert.c/ConvertImageCommand/3273.


I am a newbie to this field and would like to learn about it in more depth.


Thanks

Phil Harvey

Can you attach the jpg file or email it to me so I can take a look?  My email is philharvey66 at gmail.com

- 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 ($).

Lawdefined

Hi Phil,

I have mailed you the image as an attachment to the email id you provided.


Phil Harvey

I got the sample, thanks.  The extracted RawThermalImage looks perfectly formed.  My guess is that you are executing this in PowerShell, which is known to mess with piped binary files.  Try using cmd.exe instead.

- 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 ($).

Lawdefined

Hi Phill,

You were right, cmd.exe  solved my problem.

Thanks

zarg404

Hi,

How can I copy all the Exiff tags while extracting the IR layer of a RJPG file ?

exiftool -b -RawThermalImage  test.jpg > a.jpg
With this command, I just copy few EXIF tags to the a.jpg file.

Thank you

Phil Harvey

Run this command after extracting the thermal image:

exiftool -tagsfromfile test.jpg a.jpg

- 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 ($).

zarg404

Quote from: Phil Harvey on November 04, 2020, 08:51:10 PM
Run this command after extracting the thermal image:

exiftool -tagsfromfile test.jpg a.jpg

- Phil

Thanks

hmargera

Hi,

I know that the FLIR EmbeddedImage tag is not writable.

I am wondering if there is a way to replace an embedded image by another one in a FLIR file.

Same for replacement of the raw thermal image.