gtatters / ThermImageJ

ImageJ functions and macros for working with thermal image files
Other
45 stars 6 forks source link

converted FLIR jpeg images result in 0 Byte files #1

Closed RomyWichmann closed 4 years ago

RomyWichmann commented 4 years ago

Describe the bug While running ConvertFLIRJPG function with FLIR jpgs (even the sample files) I encounter 2 different problems 1) I get a Macro Error MacroError

If i then restart image J, the script runs fine as indicated by the log log

but the resulting image in the coverted folder has 0 byte 0 byte

Desktop (please complete the following information):

gtatters commented 4 years ago

Aha, I see. indeed, I'll need to fix that. I rarely use the single convert jpg option, I simply have been using the Import-FLIR-JPG function for most of my applications. I can reproduce that error on my system, so it is a bug. I'll look into fixing it and update here. Meanwhile, please see if the Import function works on your computer, as it would verify most things are properly installed.

If you need one file converted, the function to convert the whole folder of jpgs will work also on one file. It will look a little messy but it tries every jpg and attempts to extract the raw thermal data.

gtatters commented 4 years ago

yes, it's officially my first bug (at least that i've shared). I'll upload a fix shortly, having found where the issue was. Invariably it comes down to writing the path information accurately.

gtatters commented 4 years ago

Hopefully it is fixed now in v2.2 (https://github.com/gtatters/ThermImageJ/releases/tag/v2.2)

The easiest way to update is to simply download this text file and copy into your ImageJ/Macros/toolsets folder:

https://github.com/gtatters/ThermImageJ/blob/master/toolsets/ThermImageJ.ijm

Please let me know if that fixes it for you.

RomyWichmann commented 4 years ago

Hi, it definitely fixed the issue. The sample images work great now - when i use the import function. The SampleJPG is still not working when i use the convert function though.

Unfortunately, my own images, taken with a FLIR TG267, still don't work. This is the error I get when running the import function: png issue

This is the error I still get when running the Convert function: convert error

This might be a camera problem though?

thanks

gtatters commented 4 years ago

Could you try running the function called "Flir Calibration Values Tool" on your image and on the sample image? You will likely get a weird error if the file is not of the correct radiometric type, whereas it will print out a series of constants if it is the correct type.

I may need to eventually add a check for file type problems as sometimes use of non-research grade IR cameras create non-radiometric jpgs, or the jpgs get altered by other programs that have been used to edit them.

If you are able to share a sample image taken from your camera here (or emailed if data sensitive), I can more effectively check. But if the import function is working, then it suggests you have installed most things properly. I can better assist if I have a sample image.

gtatters commented 4 years ago

or, one simple suggestion is to rename your file to .jpg, not .jpeg. Without checking my code it is possible that I assume users are using .jpg file extensions. It is not something I check for.

RomyWichmann commented 4 years ago

Ran the tool and don't get an error - it is extracting the values. I've tried to convert but it is not helping. here is a sample file: FLIR1000003

RomyWichmann commented 4 years ago

i can also take one without the numbers and writing. If that would be better

gtatters commented 4 years ago

oh no, not one of those MSX fusion images. I don't like those. Usually I can extract the thermal data from them, but they are inconsistent. I think that is messing up the convert function since inside the flir file are multiple jpg headers and exiftool and my functions can't translate them all efficiently.

Any chance you can turn that feature off and take new images?

gtatters commented 4 years ago

I've tried opening that file up in FLIR's programs and it does not open up as a radiometric image. Despite the appearance of being a radiometric file, FLIR's program thinks it is a simple RGB JPG as well, so I'm not likely to solve a problem generated by their software. This might truly be a problem with the hybrid images. I get the same error with importing your image into ThermimageJ and it is based on the quality of the camera and the firewalled capabilities that the camera is limited to saving, unless you can find a way to turn the fusion part off, or change a save setting.

gtatters commented 4 years ago

for future reference try in the terminal window:

exiftool -*RawThermalImageType* yourfilename.JPG

If you should obtain either:

Raw Thermal Image Type : TIFF

or

Raw Thermal Image Type : PNG

If you get nothing as a result, it is likely you do not have a radiometric jpg.

RomyWichmann commented 4 years ago

Hey, just wanted to let you know that we have exchanged the camera and everything is working now! I can import all images and analyse them. thanks again so much for your help with this!!

gtatters commented 4 years ago

Thanks for the feedback and update! Sorry for the trouble with the camera, but I'm glad the new files import better. This is good news for me.

shojajm commented 3 years ago

Hi there. I am currently trying to use your ThermImageJ plugin to import a thermal image and have been recieving this error -- --

"Warning -- Raw Thermal Type Unknown. This file might not be a radiometric JPG. Setting Raw Thermal Type to tiff and attempting conversion. If resulting file is 0 bytes, the jpg cannot be converted. Examine the settings on your camera to ensure radiometric jpgs are being saved. Raw Thermal Type: tiff Converting 02 C1.jpg to 02C1.tif

FLIR JPG files converted into tiff format. Import these and convert to temperature using the Raw2Temp macro.

Use the File->Import->Image Sequence function to load in images Some images may require that the pixel byte order be swapped. Use the Byte Swapper plugin after importing if necessaary Done"

How can I check to see if the image is a radiometric JPG and furthermore if it is what is causing the issue? Thank you.

gtatters commented 3 years ago

at the terminal window type:

exiftool -*RawThermalImageType* yourfilename.JPG

If you should obtain either:

Raw Thermal Image Type : TIFF

or

Raw Thermal Image Type : PNG

If you get nothing as a result, it is likely you do not have a radiometric jpg.

If you can't import, chances are your camera is not capable of taking a radiometric jpg or you have to examine the camera software settings. This package of macros assumes you have a camera capable of research grade radiometric jpgs.