Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aloisklink/flirextractor
An efficient GPLv3 Python package for extracting temperature data from FLIR IRT images
https://github.com/aloisklink/flirextractor
flir infrared-images python
Last synced: 2 months ago
JSON representation
An efficient GPLv3 Python package for extracting temperature data from FLIR IRT images
- Host: GitHub
- URL: https://github.com/aloisklink/flirextractor
- Owner: aloisklink
- License: gpl-3.0
- Created: 2019-10-09T16:15:29.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-11-24T15:44:18.000Z (about 4 years ago)
- Last Synced: 2024-09-18T11:31:19.333Z (3 months ago)
- Topics: flir, infrared-images, python
- Language: Python
- Homepage:
- Size: 1.3 MB
- Stars: 12
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# flirextractor
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](https://github.com/nationaldronesau/FlirImageExtractor).
However, it has some issues that I didn't like:- Most importantly, it is forked from the UNLICENSED
[Nervengift/read_thermal.py](https://github.com/Nervengift/read_thermal.py),
so until
[Nervengift/read_thermal.py#4](https://github.com/Nervengift/read_thermal.py/issues/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.
```bash
pip3 install flirextractor
```Or, using the python package manger [poetry](https://poetry.eustace.io/)
(recommended):```bash
poetry add flirextractor
```**Make sure you install exiftool as well.**
On RHEL, this can be installed via:
```bash
sudo yum install perl-Image-ExifTool
```On Debian, this can be installed via:
```bash
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`](https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html).To load data from a single FLIR file, run:
```python3
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:```python3
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:
```python3
import numpy as np
np.savetxt("output.csv", thermal_data, delimiter=",")
```You can display the image for debugging by doing:
```python3
from PIL import Image
thermal_image = Image.fromarray(thermal_data)
thermal_image.show()
```See [./scripts/example.py](./scripts/example.py) for more example usage.
## Testing
Use the Python package manager `poetry` to install test dependencies:
```bash
poetry install
```Then run pytest to run tests.
```bash
poetry run pytest
```You can run linters with pre-commit:
```bash
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](https://github.com/gtatters/Thermimage) R package.
This work uses an image and adapts part of
[gtatters/Thermimage](https://github.com/gtatters/Thermimage)
under the GPLv3.0 License.