thermal_base
thermal_base copied to clipboard
Decoding and common processing for thermographs / thermograms. Currently supports FLIR's TIFF and PNG encoded metadata, and DJI-encoded metadata
Base codes for Thermography
A python package for decoding and common processing for thermographs / thermograms
Install
- This tool requires exiftool to be installed.
-
Linux: Run command
sudo apt-get install exiftool
- Windows: Download binary from https://exiftool.org/
-
Linux: Run command
- This tool also requires you to have Python 3+ installed. You can install it from the official website (https://www.python.org/downloads/)
- Install this package with
python3 -m pip install git+https://github.com/detecttechnologies/thermal_base.git@main
Usage
Import and use the package as follows:
- Decoding
from thermal_base import ThermalImage
image = ThermalImage(image_path="path/to/image", camera_manufacturer="dji/flir")
thermal_np = image.thermal_np # The temperature matrix as a np array
raw_sensor_np = image.raw_sensor_np # The raw thermal sensor excitation values as a np array
meta = image.meta # Any other metadata that exiftool picked up
- Manipulation
from thermal_base import utils
print(dir(utils)) # View manipulation tools available
thermal_np = utils.change_emissivity_for_roi(...) # Sample: Change the emissivity of an RoI
This repo can be used in conjunction with Thermal-Image-Analysis for an interactive experience.
Supported formats
Data Format | Sample Cameras | Support |
---|---|---|
FLIR RJPG with TIFF-format of thermal embedding | Zenmuse XT-2 | :heavy_check_mark: |
FLIR RJPG with PNG-format of thermal embedding | FLIR E-4, T640, T660 | :heavy_check_mark: |
DJI-encoded thermal image | Zenmuse H20-T | :heavy_check_mark: |
FLIR SEQ Thermal Video | Zenmuse XT-2 | :heavy_check_mark: |
FLIR CSQ Thermal Video | Zenmuse XT-2 | :x: |
Seek HIR Format Images | Seek Shot | :x: |
*RJPG is also known as R-JPEG
Notes
- The use case for h20T camera can also be developed with dji-thermal-tool-analysis. Refer to this link to know more about the implementation. Also note that this method can be performed only with a 32 bit python interpreter and only on windows platform.
Credits
- Exiftool is used to read metadata and raw values from thermal image files.
- The
flyr_unpack.py
file for PNG-encoded FLIR metadata was derived from the flyr library. - The conversion from raw to temperature values is done using raw2temp from ThermImage-R