Skip to main content

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

Project description

flirextractor

PyPI 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flirextractor-0.1.1.tar.gz (21.8 kB view details)

Uploaded Source

Built Distribution

flirextractor-0.1.1-py3-none-any.whl (22.4 kB view details)

Uploaded Python 3

File details

Details for the file flirextractor-0.1.1.tar.gz.

File metadata

  • Download URL: flirextractor-0.1.1.tar.gz
  • Upload date:
  • Size: 21.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.17 CPython/3.8.0 Linux/5.0.0-1023-azure

File hashes

Hashes for flirextractor-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2018f28ba9e5adc743f2f16e361c4b80e8fca9d2028daae3f5d7321569b82086
MD5 7ea50022f9eeaccdbec3f9ec6efc545b
BLAKE2b-256 1f4b436be6767a8064806057be2ad3f6fbae5befe0b18a8aba3524980ea41103

See more details on using hashes here.

File details

Details for the file flirextractor-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: flirextractor-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 22.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.17 CPython/3.8.0 Linux/5.0.0-1023-azure

File hashes

Hashes for flirextractor-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3f70766b1204aaf5e7624b3ac98c1b6ab19aac574722c35a128cee9557e65535
MD5 1a1f3d428e554e62d7ff9240df6d5ce7
BLAKE2b-256 61f69381ef2209ffe9fbdf51404a9037e3e641bb5603461c36cf8a3b5ed33a31

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page