Skip to main content

Flyr is a library for extracting thermal data from FLIR images written fully in Python, without depending on ExifTool.

Project description

Flyr

Flyr is a library for extracting thermal data from FLIR images written fully in Python, without depending on ExifTool.

Other solutions are wrappers around ExifTool to actually do the hard part of extracting the thermal data. Flyr is a reimplementation of the ExifTool's FLIR parser. Practically, this offers the following benefits:

  • Faster decoding because no new process needs to be started and in-memory data does not need to be communicated to this other process
  • Easier and robust installation and deployment, because flyr.py is not an external executable
  • Arguably simpler use: no need to create a superfluous extraction object; simply call thermal = flyr.unpack(flir_file_path) and done
  • Arguably more accurate, because other Python packages uses ExifTool's rounded results, while Flyr uses the exact values specified in the metadata

Installation

Flyr is installable through PyPi: pip install flyr.

Alternatively, download flyr.py and include in your source tree.

Flyr depends on three external packages, all installable through pip: pip install numpy nptyping pillow. Pillow does the conversion from PNG file to an array, nptyping allows for high quality array type annotations. Numpy provides the two dimensional array type containing the thermal data.

Usage

Call flyr.unpack on a filepath to receive a numpy array with the thermal data. Alternatively, first open the file in binary mode for reading and and pass the the file handle to flyr.unpack.

import flyr

flir_path = "/path/to/FLIR9121.jpg"  
thermogram = flyr.unpack(flir_path)  # Reading directly

with open(flir_path, "rb") as flir_handle:  # In binary mode!
	thermogram = flyr.unpack(flir_handle)  # Reading from file handle
	
# Temperatures available in Kelvin and in Celsius
thermal = thermogram.celsius
thermal = thermogram.kelvin 

Alternatively, if you already have the file in memory as a BytesIO, you can directly call flyr.unpack on that byte stream.

Lastly, flyr.py can be run as a script to unpack a single image:

$ ./flyr.py ./FLIR123l.jpg

Status

Currently this library has been tested to work with:

  • FLIR E5
  • FLIR E8XT
  • FLIR E53
  • FLIR E75
  • FLIR T630SC
  • FLIR T660

However, the library is still in an early phase and lacks robust handling of inconsistent files. When it encounters such an image it immediately gives up raising a ValueError, while it could also do a best effort attempt to extract anyway. This is planned.

Camera's found not to work (yet):

  • FLIR One
  • FLIR E60BX
  • FLIR Thermocam B400

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Acknowledgements

This code would not be possible without ExifTool's efforts to document the FLIR format. Previous work in Python must also be acknowledged for creating a workable solution.

License

Flyr is licensed under The European Union Public License 1.2. The English version is included in the license file. Translations for all EU languages, each fully legally valid, can be found at the EUPL website.

Download files

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

Source Distribution

flyr-0.4.5.tar.gz (15.0 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page