gtatters / Thermimage

R Package for working with radiometric thermal image files and data
GNU General Public License v3.0
166 stars 42 forks source link

Bug in readflirJPG function? #10

Closed cambriec closed 4 years ago

cambriec commented 4 years ago

Hi there,

I've used the package previously (just a few months ago) and everything worked fine before, but now when I try to use the readflirJPG function the error below occurs.

Screen Shot 2020-02-06 at 11 27 44 AM

I'm not sure how to fix this since I didn't code for cams$Info$RawThermalImageType yet an error for it pops up, and I can't seem to find the argument within the Thermimage cran or the github page. I'm using a Mac, I updated R, Rstudio, and the package.

The error occurs when I try to use readflirJPG singly and when I set up a loop as shown below Screen Shot 2020-02-10 at 12 58 56 PM imgDir is just defined as the directory to find the files, and the variables for raw2temp are defined within the chunk above this code.

Thanks!

gtatters commented 4 years ago

could you include sample image? Often these errors kick up from something with exiftool or assumptions I have had to make regarding the jpgs. Although I have added features and fixed other issues with readflirJPG, I usually preserve the defaults that typically work for older versions, I cannot guarantee that.

One bug I've never managed to get working across all platforms is dealing with white space in file names or folder names. Is it possible anywhere in your path that there is a space? I don't have an error check for that. But if you don't mind sharing an image I can look into it.

cambriec commented 4 years ago

FLIR0271

Here is a sample image I'm trying to convert. I have also installed and reinstalled exiftool to see if that was the issue, but the error still occurs. There aren't any white spaces in my directory or files, and that's more of an R thing where R doesn't like spaces. It's not just your package!

gtatters commented 4 years ago

hmmm...so, that file does not appear to be a radiometric jpg

Try the following from a terminal window (I renamed your file to test.jpg)

exiftool -*Planck* test.jpg

It returns nothing since there are no Planck constants saved in the file since it appears not to be a radiometric jpg. I don't use the FLIR C2 cameras, but I think they either 1) do not have this capacity 2) not research grade and thus FLIR prefers not to save them as radiometric jpgs as they might give the erroneous impression or accuracy, or 3) the file was not saved as a radiometric jpg 4) the file has been opened and resaved using another program.

Not sure what files you were using previously, but check them using exiftool -Planck to verify.

I have not added an error check for this. Might be required for the future.

cambriec commented 4 years ago

Ah, I see. Alright, thank you for the insight!

gtatters commented 4 years ago

sorry. :( I don't know what files you were previously analysing that were working. I would be very cautious about using a C2 for research purposes, unless it has a setting that allows you to save radiometric files. Even then I worry.

FYI, if there is a "~" in front of the spot temperature, that means that the camera is still "warming up" and the temperature estimates can be wildly off even the less than accurate values the consumer grade cams provide.

see here for a comparison of an iPhone FLIR one working in a laboratory environment and showing substantial variation from an accurate temperature: https://tattersalllab.com/2016/03/01/thermal-camera-showdown-flir-one-vs-flir-sc660/

There may be ways to get accurate temperatures with these cameras, but would require some calibrations in the field and/or image to be certain.