This repository is a desktop GUI application (PyQt6) for processing DJI thermal imagery. The app loads a DJI SD-card-like folder structure, extracts radiometric thermal data via DJI tooling, provides interactive visualization/measurements, and supports batch export and Word report generation.
-
main.py- Main GUI application entry point.
- Defines
DroneIrWindow(QMainWindow)which wires UI actions to processing/export/report functionality. - Orchestrates loading datasets, maintaining the current
ProcessedIm, and updating the viewers.
-
main.spec- PyInstaller spec (build packaging).
-
dialogs.py- GUI dialogs (measurement dialogs, fusion/overlay dialogs, hotspot detection, alignment UI, etc.).
- Many dialogs delegate heavy image work to
tools.thermal_tools.
-
widgets.py- Custom PyQt6 widgets used by the main window and dialogs.
- Key widgets:
PhotoViewer: main image canvas that supports drawing measurements and showing overlays.DualViewer: side-by-side synchronized viewer.QRangeSlider: double-ended slider used for temperature range selection.
This folder contains most of the application’s “business logic”.
-
tools/core.py- Core data types and low-level helpers.
- Key responsibilities:
- DJI thermal raw extraction (
read_dji_image,extract_raw_data). - Camera undistortion (
CameraUndistorter). - Drone-specific calibration/offset parameters (
DroneModel). - Central image object storing state + annotations:
ProcessedIm. - Measurement objects:
PointMeas: single temperature spot.LineMeas: line profile + extrema.RectMeas: ROI statistics (min/max/mean/std, area) and markers.
- DJI thermal raw extraction (
-
tools/thermal_tools.py- High-level thermal processing functions and export routines.
- Key responsibilities:
- Palette/colormap registry (DJI-like palettes + custom palettes).
- Edge overlay generation from RGB into thermal images.
- Converting thermal float data to colored renderings (
process_raw_data). - Batch export worker classes (
RunnerDJI,RunnerMiniature) usingQThreadPool/QRunnablepatterns.
-
tools/report_tools.py- Word report generation using
python-docx. - Adds images and measurement summaries (tables) into structured sections.
- Word report generation using
-
tools/thermal_3d.py- 3D visualization utilities (Open3D-based), used for voxel/surface-like views.
-
tools/thermal_parser.py- Alternative/legacy thermal parsing logic (derived from an external project).
- Includes DJI/FLIR parsing helpers and SDK bindings.
-
tools/ai_tools.py- AI-related helpers (e.g., object detection/segmentation integrations), consumed from dialogs and/or the main window.
-
utils/config.py- Strongly-typed app settings via Pydantic:
AppConfig: app constants (folder names, UI paths, view/legend labels).ThermalConfig: default radiometric parameters and edge defaults.
- Strongly-typed app settings via Pydantic:
-
utils/logger.py- Logging helpers (
info,debug,warning,error).
- Logging helpers (
-
utils/exceptions.py- App-specific exceptions (e.g.,
ThermogramError,FileOperationError).
- App-specific exceptions (e.g.,
.uifiles loaded at runtime byPyQt6.uic.loadUi.main_window.uiis the primary window layout.- Dialog UIs (export dialog, fusion dialog, measurement dialogs, etc.) are also stored here.
- Accessed via
resources.find(rel_path). - Contains:
- App images/icons.
- Calibration XMLs used for undistortion.
- External tooling (e.g., DJI thermal SDK executable, exiftool) that the app calls via subprocess.
- Triggered from
DroneIrWindow.load_folder_phase1(via menu action). - The app enumerates image files and builds lists of RGB / IR paths.
- For each IR image, a
tools.core.ProcessedImis created. ProcessedImmaintains:- Paths (IR, RGB, cropped RGB, original RGB).
- Radiometric parameters (
thermal_param). - Raw temperature data (
raw_data,raw_data_undis). - Display parameters (palette, shown range, post-processing).
- User measurements (rect/line/point lists) and report flags.
tools.core.extract_raw_data()calls the DJI tooling (read_dji_image()) to produce a temporary.raw, reads it into a float32 matrix, undistorts it, then deletes the.raw.
tools.thermal_tools.process_raw_data()maps float temperatures to a colormap.widgets.PhotoViewerdisplays the resulting pixmap and manages measurement drawing.- Optional overlays (edge overlays, picture-in-picture) are composed in
tools.thermal_toolsand/or dialogs.
- The user draws measurements in
PhotoViewer. - The main window converts these into measurement objects:
PointMeas,LineMeas,RectMeas
- Measurements are stored on the active
ProcessedIminstance and displayed in the tree view.
- Batch exports use
RunnerDJIto process multiple images in background threads. - Reports are generated by
tools.report_tools.create_word_report()using the currentProcessedImlist.
- External binaries: thermal extraction relies on tools located under
resources/(invoked viasubprocess). - UI loading:
.uifiles are loaded dynamically at runtime; missing files will raiseFileOperationError. - State ownership:
DroneIrWindowowns the active dataset list (self.images) and active image index; eachProcessedImowns its own measurements/settings.
There are currently ad-hoc test scripts (e.g., test_*.py) in the repo root. These are intended to be moved into a dedicated tests/ folder.