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.pyis 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.
Metadata
Release files for flyr 0.4.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| flyr-0.4.5.tar.gz | 15.0 kB | Details |
Release files / flyr-0.4.5.tar.gz
| Download URL | flyr-0.4.5.tar.gz |
|---|---|
| Size | 15.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
39e316a59f7c28944f1860cd4ec38044fb34da67010678127f10c5e69cc996ff
|
|
BLAKE2b-256 checksum How to use checksums |
3b061d39ab7acbcfc23f356c5d7fe5e3e0bb222c62705d29af77b7fc93fa4fa4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2
|