Coder Social home page Coder Social logo

nationaldronesau / flirimageextractor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nervengift/read_thermal.py

33.0 33.0 16.0 4.06 MB

A small tool/lib to read temperatures and original photos from FLIR® thermal camera images.

License: MIT License

Python 99.92% Jupyter Notebook 0.08%
extract-images flir flirtools thermal

flirimageextractor's People

Contributors

aidankinzett avatar bahloulmostafa avatar conorbros avatar h3ct0r avatar nervengift avatar williams9438 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

flirimageextractor's Issues

Obtaining RGB in the same size and visual field as thermal

Hello, we are trying to create a mask using the RGB picture and then superpose this mask with the thermal data. However, the thermal image has a smaller visual field and is smaller than the extracted RGB one. Is there any way to know which transformations need to be applied to the RGB in order to match the thermal one, or to extract the adequate RGB image directly?

Thank you in advance.

ModuleNotFoundError: No module named '_tkinter'

Installed via brew:

$ pip --version
pip 22.1.2 from /usr/local/lib/python3.10/site-packages/pip (python 3.10)

$ pip install flir-image-extractor-cli
[... omitted ...]

$ flir-image-extractor-cli --help
Traceback (most recent call last):
  File "/usr/local/bin/flir-image-extractor-cli", line 5, in <module>
    from flir_image_extractor_cli.__main__ import main
  File "/usr/local/lib/python3.10/site-packages/flir_image_extractor_cli/__main__.py", line 5, in <module>
    import flir_image_extractor_cli.processing as processing
  File "/usr/local/lib/python3.10/site-packages/flir_image_extractor_cli/processing.py", line 10, in <module>
    matplotlib.use("TkAgg")
  File "/usr/local/lib/python3.10/site-packages/matplotlib/__init__.py", line 1144, in use
    plt.switch_backend(name)
  File "/usr/local/lib/python3.10/site-packages/matplotlib/pyplot.py", line 288, in switch_backend
    class backend_mod(matplotlib.backend_bases._Backend):
  File "/usr/local/lib/python3.10/site-packages/matplotlib/pyplot.py", line 289, in backend_mod
    locals().update(vars(importlib.import_module(backend_name)))
  File "/usr/local/Cellar/[email protected]/3.10.5/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/usr/local/lib/python3.10/site-packages/matplotlib/backends/backend_tkagg.py", line 1, in <module>
    from . import _backend_tk
  File "/usr/local/lib/python3.10/site-packages/matplotlib/backends/_backend_tk.py", line 7, in <module>
    import tkinter as tk
  File "/usr/local/Cellar/[email protected]/3.10.5/Frameworks/Python.framework/Versions/3.10/lib/python3.10/tkinter/__init__.py", line 37, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
ModuleNotFoundError: No module named '_tkinter'

the exception should caught and suggestion be offered.

also, if this is a cli program why it would require Tk which is Gui widget?

Cannot find file specified

No matter where I put it, I cannot get the program to open the .jpg file. I have used Flir One pro and Flir C3.

filenames containing '.' are not parsed properly

Please change this line

thermal_output_filename_array = self.flir_img_filename.split(".")

to e.g. this:

thermal_output_filename_array = os.path.splitext(self.flir_img_filename)

to handle dots in filenames properly. Thanks!

RGB image initialisation

Is there a reason the initialisation of the RGB image (line 94 of build/lib/flirimageextractor/init.py) is commented out?

Use global range for term value

Hi

Congratulations for this library, I use it to convert my flir image fff to jpg
Is it possible use a range of global value instead of use min,max data get from file?

I need to process more flir data captured in different day

Many thanks

pip install error: mistune has no attribute 'BlockGrammar'

I see the pip lib has the version 1.5.3
Since I am new, I tried to install the latest version of the flirimageextractor, but it fails.
The error message like below.

root:/usr/src/app# pip install -U flirimageextractor

Looking in indexes: https://dsiartifactory.research.corteva.com/artifactory/api/pypi/pypi/simple, https://dsiartifactory.research.corteva.com/artifactory/api/pypi/pypi/simple
Requirement already satisfied: flirimageextractor in /opt/venv/lib/python3.9/site-packages (1.2.7.1)
Collecting flirimageextractor
  Using cached https://dsiartifactory.research.corteva.com/artifactory/api/pypi/pypi/packages/packages/2d/2d/f56f886138f85d9bfb5a93ed6cf379077ade791d95cf79f536368943b447/flirimageextractor-1.5.3-py3-none-any.whl (29 kB)
Collecting keyring==23.13.1 (from flirimageextractor)
  Using cached https://dsiartifactory.research.corteva.com/artifactory/api/pypi/pypi/packages/packages/62/db/0e9a09b2b95986dcd73ac78be6ed2bd73ebe8bac65cba7add5b83eb9d899/keyring-23.13.1-py3-none-any.whl (37 kB)
Collecting loguru==0.7.0 (from flirimageextractor)
  Using cached https://dsiartifactory.research.corteva.com/artifactory/api/pypi/pypi/packages/packages/71/bd/337f7a0cd2628c4c77512d78e26f93b13c327a2ddf2132001dd78c000bf4/loguru-0.7.0-py3-none-any.whl (59 kB)
Collecting logzero==1.7.0 (from flirimageextractor)
  Using cached https://dsiartifactory.research.corteva.com/artifactory/api/pypi/pypi/packages/packages/b3/68/aa714515d65090fcbcc9a1f3debd5a644b14aad11e59238f42f00bd4b298/logzero-1.7.0-py2.py3-none-any.whl (16 kB)
Collecting m2r==0.3.1 (from flirimageextractor)
  Using cached https://dsiartifactory.research.corteva.com/artifactory/api/pypi/pypi/packages/packages/94/65/fd40fbdc608298e760affb95869c3baed237dfe5649d62da1eaa1deca8f3/m2r-0.3.1.tar.gz (16 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [8 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-rhomrp3a/m2r_e2e3a455770048528a274a680b21ab08/setup.py", line 13, in <module>
          from m2r import parse_from_file
        File "/tmp/pip-install-rhomrp3a/m2r_e2e3a455770048528a274a680b21ab08/m2r.py", line 51, in <module>
          class RestBlockGrammar(mistune.BlockGrammar):
      AttributeError: module 'mistune' has no attribute 'BlockGrammar'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Crash due missing parent dirs: _thermal_bwr./bwr

$ flir-image-extractor-cli
Processing the provided filepath...
 100.0% [=======================================================================================>]   4/  4 eta [00:00]
2022-08-06 19:03:54.540 | INFO     | flir_image_extractor_cli.__main__:main:104 - Processing the images...
2022-08-06 19:03:54.808 | SECTION  | flir_image_extractor_cli.processing:multiple_images:87 - Getting thermal information for all images
2022-08-06 19:03:55.629 | SECTION  | flir_image_extractor_cli.processing:multiple_images:110 - Processing and saving the images to disk
Traceback (most recent call last):
  File "/usr/local/bin/flir-image-extractor-cli", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/flir_image_extractor_cli/__main__.py", line 105, in main
    processing.multiple_images(folder_path=path, palettes=palettes, custom_temperature=custom_temperature)
  File "/usr/local/lib/python3.9/site-packages/flir_image_extractor_cli/processing.py", line 114, in multiple_images
    flir.save_images(minTemp=dataset_min, maxTemp=dataset_max)
  File "/usr/local/lib/python3.9/site-packages/flir_image_extractor_cli/flir_image_extractor.py", line 442, in save_images
    img_thermal.save(filename, "jpeg", quality=100)
  File "/usr/local/lib/python3.9/site-packages/PIL/Image.py", line 2317, in save
    fp = builtins.open(filename, "w+b")
FileNotFoundError: [Errno 2] No such file or directory: '_thermal_bwr./bwr/flir_20220801T231233'

$ ls
_thermal./     Screenshot_20220801-231344.png  flir_20220801T231233.jpg
thermal-data/  Screenshot_20220801-231400.png  flir_20220801T231238.jpg

$

math domain error

When trying to get temperature reading for multiple images getting math domain error. Can anyone help with this issue

Image captured by PureThermal 2 - FLIR Lepton

I captured image from Pure Thermal - FLIR Lepton camera, but its not working with FlirImageExtractor. Its throwing the following error:
KeyError: 'RawThermalImageType' And when I run exiftool <flir_image>, lots of meta-data are missing? How should I do to capture image with full image meta-data details?
Any kind of suggestions / references will be helpful to me.

When I run exiftool <on-my-image>, its just showing the following data:

ExifTool Version Number : 10.80
File Name : my_photo-1.jpg
Directory : .
File Size : 5.7 kB
File Modification Date/Time : 2020:05:04 20:28:10+05:30
File Access Date/Time : 2020:05:04 20:28:47+05:30
File Inode Change Date/Time : 2020:05:04 20:28:10+05:30
File Permissions : rw-rw-r--
File Type : JPEG
File Type Extension : jpg
MIME Type : image/jpeg
JFIF Version : 1.02
Resolution Unit : inches
X Resolution : 120
Y Resolution : 120
Image Width : 160
Image Height : 120
Encoding Process : Baseline DCT, Huffman coding
Bits Per Sample : 8
Color Components : 3
Y Cb Cr Sub Sampling : YCbCr4:2:2 (2 1)
Image Size : 160x120
Megapixels : 0.019

Thank you!

saving rgb images as well is missing

I propose adding this to the end of save_image():

    if self.rgb_image_np is not None:
        img_rgb = Image.fromarray(self.rgb_image_np)
        if bytesIO:
            bytes = io.BytesIO()
            img_rgb.save(bytes, "jpeg", quality=100)
            return_array.append(bytes)
        else:
            rgb_output_filename_array = os.path.splitext(self.flir_img_filename)
            filename = (
                rgb_output_filename_array[0]
                + "_rgb"
                + rgb_output_filename_array[1]
            )
            if self.is_debug:
                logger.debug("Saving Rgb image to:{}".format(filename))

            img_rgb.save(filename, "jpeg", quality=100)
            return_array.append(filename)

using FlirImageExtractor with Pydroid. ExifTool as itself cannot be installed

I would like to use FlirImageExtractor but despite there is an exiftool app for android, the script looks for the executable in path folders as if it was run in windows.
This is the simple script i would like to get running before going further improving the script in my computer.

I would truly appreciate if someone could provide any useful tip. Best regards

import flirimageextractor
from glob import glob
import os

flir = flirimageextractor.FlirImageExtractor()
files = glob("C:/FLIR/*.JPG")
files = [texto.replace("\", "/") for texto in files]
files = [os.path.basename(file) for file in files]
for file in files:
try:
flir.process_image('FLIR/'+file)
flir.save_images()
thermal=flir.get_thermal_np()
flir.plot()
except Exception as e:
print(f"Error al procesar el archivo {file}: {e}")

Multiple images

This takes only one input file and gives the output csv file , how to automate this for multiple images in a folder and get separate csv files with temperature readings for each of them

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.