gtatters / Thermimage

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

Importing images causes loss of resolution #7

Closed cambriec closed 4 years ago

cambriec commented 4 years ago

Hi Glenn,

When I am importing images and then using dim(), it'll read a resolution much smaller than the original picture. For example, the original resolution is 320x240, but the output of the function reads 80x60. I'm not sure why this happens since I followed the your tutorial and this didn't happen with your sample image. Any help or insight to why this is happening is much appreciated!

Thanks!

gtatters commented 4 years ago

Hi there,

Any chance you could attach a sample image otherwise this is difficult to diagnose. Many of the entry level consumer flir cameras deceive the user into thinking the resolution is 320x240 when the fundamental sensor is only 80x60, but I cannot tell for sure.

Glenn

cambriec commented 4 years ago

FLIR1351

This is shot with a Flir C2, I just looked up the model online and it does say that the IR sensor is 80x60. Not really related to the R package, but this just makes it more difficult, or perhaps less accurate, when analyzing in Image J. That's why I was wondering why importing the images made the resolution so low.

gtatters commented 4 years ago

From the terminal window:

exiftool -*width* -*height* FLIR_C2.jpg

Exif Image Width                : 320
Raw Thermal Image Width         : 80
Embedded Image Width            : 640
Image Width                     : 320
Exif Image Height               : 240
Raw Thermal Image Height        : 60
Embedded Image Height           : 480
Image Height                    : 240

There are multiple "images" inside the file. The thermal cam is only 80x60, while the digital image is either 320x240 or even as high as 640x480. FLIR creates an overlay image from the digital camera's halo/outline of the field of view to overlay on top of the raw thermal image. The thermal image must be artificially increased in size, but not in actual resolution, producing the blurry thermal image you see in the native jpg.

The Thermimage package is only designed to extract the raw thermal signal contained in these jpg files, so unfortunately, the resolution is only as great as the sensor size. Thermimage relies on Exiftool's -rawthermalimage extraction function at this time.

Sometimes FLIR employs a supermax resolution whereby they digitally increase resolution by sampling the 'jitter' from handheld cameras but usually this supermax only doubles the resolution (i.e. 160x120). I don't think they can bump it any higher but I could be wrong.

The problem with the thumbnail jpg loaded into ImageJ is contamination from the digital image overlay (the dull white halo). That will obscure and influence temperature estimates, plus we don't know what FLIR has done to upsample the image to create that effect. I would argue that the raw data are better than any digitally manipulated data, and it is likely that the upsampled image has averaged some of the temperatures by smoothing across pixels.

The consumer grade thermal cameras are not rated highly accurate as well. Use cautiously if you need accurate temperatures.

Closing issue as being beyond Thermimage to fix. If a more astute observer of exif headers can point to where the upsampled thermal image is in the file without the digital image overlay, please comment.