FLIR® thermal cameras like the FLIR ONE® include both a thermal and a visual light camera. The latter is used to enhance the thermal image using an edge detector.
The resulting image is saved as a jpg image but both the original visual image and the raw thermal sensor data are embedded in the jpg metadata.
This small Python tool/library allows to extract the original photo and thermal sensor values converted to temperatures.
This tool relies on exiftool
. It should be available in most Linux distributions (e.g. as perl-image-exiftool
in Arch Linux or libimage-exiftool-perl
in Debian and Ubuntu).
It also needs the Python packages numpy and matplotlib (the latter only if used interactively).
Calling it as python read_thermal.py flir_example.jpg
will show an interactive plot of the thermal image using matplotlib and create two image files flir_example_thermal.png and flir_example_visual.jpg. Both are RGB images, the original temperature array is only available using the extract_thermal
function.
The functions extract_thermal
and extract_visual
yield numpy arrays and can be called from your own script after importing this lib.
I only tested this on photos taken with a FLIR ONE®. Other cameras might need some small tweaks (the embedded raw data can be in multiple image formats, I only support png thermal and jpg visual for now)
Raw value to temperature conversion is ported from this R package: https://github.com/gtatters/Thermimage/blob/master/R/raw2temp.R