Giter Club home page Giter Club logo

flir_roi_viewer's Introduction

Radiometric Region of Interest (ROI) viewer for FLIR Lepton thermal cameras

Developed & tested with a Lepton 3.5 mounted on PureThermal3 USB-C board (www.groupgets.com).

Using pyQt 5 and pyQTgraph as GUI toolkit.

Features

  • Radiometric data processing, display using selectable color maps
  • up to 10 rectangular ROIs (draggable by mouse, rotatable & scalable via small handles)
    • add ROI via button, delete via right click on ROI or button (last ROI is deleted)
  • min/max & average temperatures displayed in table for full frame and each ROI
  • screenshot capture (via GUI button or TCP client, default port 8123)
  • reports temperature data to TCP client in JSON format
  • load/store ROI configurations and screenshot folder to YAML config file
  • simulated frame data (4 temp. zones with noise) if USB device is not present

Screenshot

FLIR ROI Viewer GUI screenshot (Simulation mode is shown: test pattern with four different temperature zones plus noise. Three ROI rectangles, one is highlighted.)

Requirements

Usage

$ git clone https://github.com/ozel/FLIR_ROI_Viewer.git
$ cd FLIR_ROI_Viewer
$ python3 main.py

# testing TCP remote control feature in a separate terminal
# for each sent message (here 'test'), a screenshot is taken with that file name prefix
# and a JSON string with all temperatures (full frame and ROIs) is returned
$ nc localhost 8123
test 
{
 "file name": "screenshots/test_2024-02-20_15-52-27_heatmap.tiff",
 "frame": {
  "min.": 15.0,
  "avg.": 35.0,
  "max.": 55.0
 },
 "ROI 0": {
  "min.": 25.0,
  "avg.": 40.6,
  "max.": 55.0
 },
 "ROI 1": {
  "min.": 25.0,
  "avg.": 35.2,
  "max.": 45.0
 },
 "ROI 2": {
  "min.": 15.0,
  "avg.": 20.0,
  "max.": 25.0
 }
}

Hardware

A 3D-printed holder for the PureThermal3 USB-C board is located inside the hardware folder. It was designed for attaching the camera to the lens of a microscope inside a wafer proper.

References & Copyright

Further notes and implementation details are commented in ROIviewer.py. Reading of raw frame data via libuvc (using uvctypes.py) follows the example of the PureThermal manufacturer: https://github.com/groupgets/purethermal1-uvc-capture/blob/master/python/

Author: Oliver Keller (GSI/FAIR), o.keller [at] gsi.de, 2023-2024 Released as open source under the permissive BSD 2-Clause License.


General Info on Programming FLIR Cameras

The FLIR Lepton/Boson thermal camera modules have been available for years from www.groupgets.com. Still, the information about programming & using them is somewhat spread out and often outdated. I've compiled here the information that I gathered in winter 2023/2024 and that is relevant for using the Lepton 3.5 in radiometric mode via USB.

The PureThermal3 USB board emulates a webcam device via the USB device class UVC (USB Video Class). Any modern OS like Linux has standard kernel drivers for this, but a modified version of libuvc is needed to deal with the custom data format of the pixels. In general, there is little example code for the radiometric feature via USB and on python. For example, pylepton only supports the SPI interface.

Main Online Ressources for Radometric Applications using USB

Udev Rules for Linux

allows USB access on Linux as regular non-root user

create /etc/udev/rules.d/99-purethermal.rules with content:

#UVC cameras
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1e4e", ATTRS{idProduct}=="0100", MODE="0666"

Create usb group and add desired user name

$ sudo groupadd -r usb
$ sudo usermod -a -G usb <user name>

Compilation of libuvc

Tested on Ubtuntu 20.04 LTS Requirements:

$ sudo apt-get install libusb-1.0-0-dev
$ sudo apt-get install python3-opencv

Compile custom libuvc:

git clone https://github.com/groupgets/libuvc
cd libuvc
mkdir build
cd build
cmake ..
make && sudo make install

Notes:

  • CMAKE will complain about missing JPEG library (even if libjpeg-dev is installed!) => this can be safely ignored
  • libuvc.so will be installed into /usr/local/lib
  • add /usr/local/lib permanently to LD_LIBRARY_PATH via ldconfig:
    $ sudo echo "/usr/local/lib" > /etc/ld.so.conf.d/usr-local.conf
    $ ldconfig
    

Emissivity

Adjusting the 'scene emissivity' would help measure very reflective surfaces. The default emissivity is set for rough surfaces of low reflectivity. It seems the Lepton SDK allows to access and modifiy the internal parameters that control calculation of the temperature values.

flir_roi_viewer's People

Watchers

Oliver Keller avatar  avatar

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.