3-Staged Python Script Which Utilizes Provided Digital Aerial Photogrammetry To Create High Quality Point Clouds For Use In Geospatial Analysis Of Forest Canopies.
Program Uses WebODM As The Main Software Facilitator For Point Cloud Generation, With Custom Python-Based Gap Detection Algorithms For Advanced Forestry Analysis. The End-To-End Pipeline Processes Raw UAV Imagery Into Actionable Ecological Insights Through An Intuitive PyQt5 GUI Or Command Line Interface
- ๐ Directory Structure
- ๐ Quick Start
- ๐ The Breakdown
- ๐ Features
- ๐๏ธ Additional Documentation
.
โโโ README.md # Project overview and team introduction
โโโ run_qgis_setup.bat # Batch script for setting up QGIS environment
โโโ setup.py # Setup script for the project
โโโ requirements.txt # Project dependencies
โโโ main.py # Main application script (likely launches the GUI)
โโโ .gitignore # Specifies intentionally untracked files
โโโ config/ # Configuration files
โ โโโ config.yaml # Main configuration for the pipeline
โ โโโ default_config.yaml # Default configuration settings
โโโ data/ # UAV imagery and output datasets
โ โโโ raw/ # Placeholder for raw UAV image data (user-provided)
โ โโโ processed/ # Intermediate processed data (e.g., validated images, temporary files)
โ โ โโโ (timestamped_subfolders_during_processing)/
โ โโโ output/ # Final output data from pipeline runs
โ โโโ point_cloud/ # Point cloud related outputs (DSM, DTM, Orthophotos, CHM, reports from WebODM)
โ โ โโโ (timestamped_task_subfolders)/ # Each subfolder for a processing task
โ โ โโโ dsm.tif
โ โ โโโ dtm.tif
โ โ โโโ orthophoto.tif
โ โ โโโ chm.tif
โ โ โโโ report.pdf
โ โโโ analysis/ # Geospatial analysis outputs (gap polygons, statistics)
โ โโโ (timestamped_task_subfolders)/
โ โโโ gaps.geojson
โ โโโ gap_analysis_report.txt
โโโ logs/ # Log files from application runs
โ โโโ resilient_geodrone.log # Main log file
โโโ src/ # Source code for the application
โ โโโ __init__.py
โ โโโ front_end/ # PyQt5 GUI components
โ โ โโโ __init__.py
โ โ โโโ client_window.py # Main application window
โ โ โโโ drag_drop_widget.py # Widget for image input
โ โ โโโ pipeline_worker.py # QThread for running pipeline tasks
โ โ โโโ progress_bar.py # Custom progress bar widget
โ โ โโโ result_dialog.py # Dialog for showing results (likely obsolete or integrated)
โ โ โโโ result_viewer.py # Widget for viewing pipeline outputs
โ โ โโโ settings_window.py # Window for application settings
โ โโโ preprocessing/ # Scripts for UAV image preprocessing
โ โ โโโ __init__.py
โ โ โโโ batch_processor.py # Processes batches of images
โ โ โโโ image_validator.py # Validates image properties
โ โ โโโ quality_metrics.py # Calculates image quality metrics
โ โโโ point_cloud/ # Scripts for point cloud generation
โ โ โโโ __init__.py
โ โ โโโ cloud_processor.py # Processes outputs from WebODM (CHM generation etc.)
โ โ โโโ webodm_client.py # Client for interacting with WebODM API
โ โโโ geospatial/ # Scripts for geospatial analysis
โ โ โโโ __init__.py
โ โ โโโ gap_detector.py # Performs gap detection analysis
โ โโโ utils/ # Utility scripts
โ โโโ __init__.py
โ โโโ config_loader.py # Loads and manages YAML configuration
โ โโโ file_handler.py # Handles file and directory operations
โ โโโ logger.py # Sets up and provides logging services
โโโ tests/ # Unit and integration tests
โ โโโ __init__.py
โ โโโ conftest.py # Pytest fixtures and configuration
โ โโโ pytest.ini # Pytest configuration file
โ โโโ data/ # Test data (e.g., sample images, mock config files)
โ โ โโโ (various_test_files_and_folders)/
โ โโโ unit/ # Unit tests for individual modules
โ โโโ __init__.py
โ โโโ test_batch_processor.py
โ โโโ test_config_loader.py
โ โโโ test_file_handler.py
โ โโโ test_gap_detector.py
โ โโโ test_image_validator.py
โ โโโ test_logger.py
โ โโโ test_pipeline_worker.py
โ โโโ test_quality_metrics.py
โ โโโ test_result_viewer.py
โ โโโ test_settings_window.py
โ โโโ test_webodm.py
โโโ gap_detection/ # Standalone or experimental gap detection scripts (separate from src/geospatial)
โโโ gap_detection_demo.py
โโโ gap_renderer.py
โโโ requirements_gap.txt
git clone https://github.com/Resilient-Forestry-Capstone/Resilient_Geo_Drone.git
cd Resilient_Geo_Drone/ResilientGeoDrone# Create virtual environment
python -m venv venv
# Activate virtual environment
venv\Scripts\activate # Windows
source venv/bin/activate # macOS/LinuxInstead of activating the virtual environment, you can run directly:
# Install dependencies without activation
venv\Scripts\python.exe -m pip install -r requirements.txt # Windows
venv/bin/python -m pip install -r requirements.txt # macOS/Linux
# Run the application
venv\Scripts\python.exe main.py # Windows
venv/bin/python main.py # macOS/Linux
# View help and CLI options
venv\Scripts\python.exe main.py --help # Windows
venv/bin/python main.py --help # macOS/Linuxpip install -r requirements.txtInstall Docker Desktop first
# Clone and start WebODM
git clone https://github.com/OpenDroneMap/WebODM --depth 1
cd WebODM
./webodm.sh startCreate an account at http://localhost:8000
nano config/config.yaml # Linux/macOS
notepad config/config.yaml # WindowsGUI Mode (Recommended):
python main.py
# OR
python main.py --guiCLI Mode:
# View all CLI options and examples
python main.py --help
# Quick example - process drone images
python main.py --input ./drone_images --output ./resultsGUI: Click "View Results" button to browse processed files
CLI: Check your output directory (Determined In Your config.yaml) for DSM, DTM, CHM, and analysis files (formatted like YYYYMMDD_HHMMSS/)
The Process Will Be Initialized With A Raw Digital Aerial Image-Set As One Of The Main Inputted Arguments--With The Other Being A Provided Environmental Tag For Fine-Tuning Of Parameters For The WebODM Software.
The System Can Be Accessed Through Either CLI Or Our Modern PyQt5-Based GUI Interface. The GUI Provides Drag-and-Drop Functionality For Image Sets, Real-Time Progress Visualization, Environment Selection, And Parameter Customization Through An Intuitive Settings Interface.
After The Setup Script Initializes The Environment, Our main.py Launches The GUI Interface Or Pipeline Backend Based On The Context. The PipelineWorker Class (A QThread Subclass) Manages The Execution Of Our 3-Stage Pipeline. In Our Architecture, There Are Several Key Components:
A Logger Class LoggerSetup: Provides Detailed, Timestamped Logs Across All Pipeline Stages. Allows Users And Developers To Know Who, What, Where, And Why Specific Operations Are Going On.
A Config Loader ConfigLoader: For Our Tunable Parameters For Our User Through A YAML-Formatted Settings File. Applied To Allow Users Freedom To Change Specific Parameters Throughout Codebase's Lifetime.
A File Handler FileHandler: Orchestrates File Operations And Directory Management Throughout Runtime. Mainly Being Utilized To Allow A More Modifiable, Debuggable, And Dynamic Means Of File Management Than Simple Operations In-Line.
A API Interfacer With WebODM WebODMClient: Interfaces With WebODM For Our Point-Cloud Generation, Including Adaptive Parameter Tuning Based On Environmental Conditions. Manages The Asynchronous Processing Of Image Sets Through A REST API And Provides Progress Monitoring. As Well As Post-Processes WebODM Point-Cloud Outputs To Generate Canopy Height Models (CHMs) By Computing The Difference Between Digital Surface Models (DSMs) And Digital Terrain Models (DTMs). This Layer Converts Raw Point-Cloud Data Into Forest-Specific Metrics.
A Gap Detector GapDetector: Analyzes The Canopy Height Models To Automatically Identify, Measure, And Characterize Forest Gaps. The Gap Detection Algorithm Uses Configurable Height Thresholds And Morphological Operations To Create Vector Polygons Of Gap Areas With Associated Metrics.
The Pipeline Begins By Creating Timestamped Output Directories Through The FileHandler. In Stage 1, The System Collects All Digital Aerial Photographs From The Input Directory And Passes Them Through The BatchProcessor. This Component:
- Validates Image Formats Against User-Configured Acceptable Types
- Checks Resolution Against Minimum Requirements
- Applies Blur Detection Algorithms To Filter Out Blurry Images
- Assesses Image Brightness To Ensure Adequate Lighting
- Processes Images In Parallel Using Multiple Worker Threads For Efficiency
- Outputs A Collection Of Valid Images Ready For Point Cloud Generation
The GUI Displays Real-Time Progress During This Stage And Indicates Any Issues With Specific Images.
With A Valid Image Set, The Pipeline Proceeds To WebODM Processing. The WebODMClient Component:
- Establishes A Connection With The Running WebODM Instance
- Creates A Project And Task With Environment-Specific Parameters (Sunny, Rainy, Foggy, Night)
- Uploads Images And Initializes Processing With Optimized Settings
- Asynchronously Polls The WebODM API For Task Status And Progress
- Downloads Generated Assets Including DSM, DTM And Orthophoto Files
- Generates A Canopy Height Model (CHM) By Computing DSM-DTM Difference
- Creates Timestamped Output Directories For All WebODM Products
This Stage Features Robust Error Handling And Progress Updates, With The GUI Reflecting The Real-Time Status Of The WebODM Processing Tasks.
Once The Point Cloud And CHM Are Generated, The GapDetector Module Performs Advanced Analysis:
- Loads And Processes The CHM To Identify Areas Below User-Specified Tree Height Thresholds
- Applies Configurable Morphological Operations (Dilation, Erosion, Smoothing) To Refine Gap Identification
- Filters Gaps By Size Parameters To Focus On Ecologically Significant Openings
- Generates Vector Polygons For Each Identified Gap With Rich Metadata
- Calculates Gap Metrics Including Area, Perimeter, And Shape Characteristics
- Creates Visualizations Of Gaps Overlaid On The CHM Or Orthophoto
- Exports Results To GIS-Compatible Formats (GeoJSON, Shapefiles)
- Generates Statistical Summaries Of Gap Distribution And Characteristics
The GUI Shows Progress During This Stage And Visualizes Results Upon Completion.
In The Final Stage, The Pipeline Organizes All Outputs Into A Structured Format:- Creates A Comprehensive Results Package In The Designated Output Directory
- Generates A Summary YAML File With Pipeline Statistics And Metadata
- Provides Direct Access To Vector Layers For Further GIS Analysis
- Includes Quality Reports And Visualizations For Quick Assessment
- All Results Are Accessible Through The Result Viewer In The GUI
The Output Is Organized In Timestamped Folders For Clear Tracking Of Different Processing Runs.
Project Document
Scope Document
Design Document
ResilientGeoDrone User Manual
ResilientGeoDrone Documentation
ResilientGeoDrone Flow Diagram
