Skip to main content

flirextractor

PyPI GitHub Actions Status PyPI - Python Version Code style: black GitHub: License

An efficient GPLv3-licensed Python package for extracting temperature data from FLIR IRT images.

Differences from existing libraries

There is an existing Python package for extracting temperature values from raw IRT images, see nationaldronesau/FlirImageExtractor. However, it has some issues that I didn't like:

  • Most importantly, it is forked from the UNLICENSED Nervengift/read_thermal.py, so until Nervengift/read_thermal.py#4 is answered, this package cannot be legally used.
  • Secondly, it is quite inefficient, as it runs a new exiftool process for each image, and it converts the temperature for each pixel, instead of using numpy's vectorized math.

Installing

You can install flirextractor from pip.

pip3 install flirextractor

Or, using the python package manger poetry (recommended):

poetry add flirextractor

Make sure you install exiftool as well.

On RHEL, this can be installed via:

sudo yum install perl-Image-ExifTool

On Debian, this can be installed via:

sudo apt update && sudo apt install libimage-exiftool-perl -y

Usage

Each FLIR infrared image is loaded in Celsius as a 2-dimensional numpy.ndarray.

To load data from a single FLIR file, run:

from flirextractor import FlirExtractor
with FlirExtractor() as extractor:
    thermal_data = extractor.get_thermal("path/to/FLIRimage.jpg")

Data can also be loaded from multiple FLIR files at once in batch mode, which is slightly more efficient:

from flirextractor import FlirExtractor
with FlirExtractor() as extractor:
    list_of_thermal_data = extractor.get_thermal_batch(
        ["path/to/FLIRimage.jpg", "path/to/another/FLIRimage.jpg"])

Once you have the numpy.ndarray, you can export the data as a csv with:

import numpy as np
np.savetxt("output.csv", thermal_data, delimiter=",")

You can display the image for debugging by doing:

from PIL import Image
thermal_image = Image.fromarray(thermal_data)
thermal_image.show()

See ./scripts/example.py for more example usage.

Testing

Use the Python package manager poetry to install test dependencies:

poetry install

Then run pytest to run tests.

poetry run pytest

You can run linters with pre-commit:

poetry run pre-commit run --all-files

Acknowledgements

This work was supported by the Engineering and Physical Sciences Research Council [Doctoral Training Partnership Grant EP/R513325/1].

Additionally, many thanks to Glenn J. Tattersall, for their gtatters/Thermimage R package. This work uses an image and adapts part of gtatters/Thermimage under the GPLv3.0 License.

Release files for flirextractor 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flirextractor 1.0.2
File Size Uploaded
flirextractor-1.0.2.tar.gz 22.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flirextractor 1.0.2
File Interpreter ABI Platform
flirextractor-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size:44.5 kB

Release files / flirextractor-1.0.2.tar.gz

Download URL flirextractor-1.0.2.tar.gz
Size 22.0 kB
Tags Source
SHA-256 checksum
How to use checksums
cbd2d6988df4834da5f33e7796248237dead1e110858b882514cdfc08c959b9b
BLAKE2b-256 checksum
How to use checksums
8e94ea062661d329122a2785ebea0ad9ba4823a435c328c05b80bf8e591da1b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.10 CPython/3.8.5 Linux/5.3.0-1034-azure

Release files / flirextractor-1.0.2-py3-none-any.whl

Download URL flirextractor-1.0.2-py3-none-any.whl
Size 22.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
14cf86441b86c6ddf4bc660e13f7bcde371497fa8f384c6b4a3b60a7dcbe7440
BLAKE2b-256 checksum
How to use checksums
39a1ba55c0eed5a4b008b60004eca930f942103a81d7292f1bb2818b4cf1f1d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.10 CPython/3.8.5 Linux/5.3.0-1034-azure

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page