Skip to main content

Python Utilities for TLS LiDAR Scans of Trees

Project description

pyQSM: Python Utilities for TLS LiDAR Scans of Trees

pyQSM is a Python library for processing Terrestrial Laser Scanning (TLS) LiDAR point clouds and extracting information regarding tree structural traits from trees found in said scans. The library provides comprehensive tools for tree isolation, structural trait estimation, and 3D surface-reconstruction from point cloud data.

Overview

pyQSM focuses on three primary use cases:

  1. Tree Isolation: Separating individual trees from surrounding man-made objects and other vegetation.
  2. Epiphyte Segmentation: Isolating and analyzing different parts of trees (trunk, branches, leaves) as well as plants in and around the trees.
  3. Ray Casting Similations: Creation of 3D meshes representing objects and examining their characteristics via tensor intersection calculations.

Key Features

๐ŸŒณ Tree Processing Pipeline

  • Point Cloud Preprocessing: Cleaning, filtering, and statistical outlier removal
  • Tree Isolation: Advanced algorithms to separate individual trees from complex environments
  • Structural Segmentation: Automatic identification of trunk, branches, and foliage components
  • Skeletonization: Extract tree skeletal structure using robust Laplacian-based methods
  • QSM Generation: Create quantitative structural models with cylindrical approximations

๐Ÿ”ง Core Algorithms

  • Skeleton Extraction: Robust Laplacian-based point cloud skeletonization
  • Clustering: DBSCAN and K-means clustering for point cloud segmentation
  • Geometric Fitting: RANSAC-based cylinder and sphere fitting
  • Tree Topology: Graph-based representation of tree structure
  • Surface geometry.reconstruction: Mesh generation and processing

๐Ÿ“Š Analysis & Visualization

  • Canopy Metrics: Comprehensive tree structure analysis
  • 3D Visualization: Interactive point cloud and mesh visualization using Open3D
  • Color Analysis: HSV-based foliage classification and analysis
  • Ray Casting: Advanced geometric analysis and projection methods
  • UI Interface: GUI components for interactive data exploration

Architecture

pyQSM/
โ”œโ”€โ”€ pyQSM/                                # Main source code
โ”‚   โ”œโ”€โ”€ geometry/                       # Geometric processing modules
โ”‚   โ”‚   โ”œโ”€โ”€ skeletonize.py              # Skeleton/Wireframe extraction algorithms
โ”‚   โ”‚   โ”œโ”€โ”€ point_cloud_processing.py   # Point cloud utilities
โ”‚   โ”‚   โ”œโ”€โ”€ zoom_and_filter.py          # Bounded filtering utilities
โ”‚   โ”‚   โ””โ”€โ”€ mesh_processing.py          # Triangle Mesh manipulation
|   |   โ””โ”€โ”€ reconstruction.py               # 3D geometry.reconstruction tools
โ”‚   โ”œโ”€โ”€ math/                          # Utility functions
โ”‚   โ”‚   โ”œโ”€โ”€ fit.py                      # RANSAC, DBSCAN, etc. clustering
โ”‚   โ”‚   โ””โ”€โ”€ math_utils.py               # Basic math (i.e. finding center, percentiles)
โ”‚   โ”œโ”€โ”€ utils/                          # Utility functions
โ”‚   โ”‚   โ”œโ”€โ”€ io.py                       # Input/output operations
โ”‚   โ”‚   โ”œโ”€โ”€ logging_utils.py            # Logging helper functions
โ”‚   โ”‚   โ”œโ”€โ”€ plotting.py                 # Matplotlib scatter plots, histograms, etc.
โ”‚   โ”‚   โ””โ”€โ”€ lib_integration.py          # External library integration
โ”‚   โ”œโ”€โ”€ viz/                            # Visualization modules
โ”‚   โ”‚   โ”œโ”€โ”€ viz_utils.py                # Open3D visualization utilities
โ”‚   โ”‚   โ”œโ”€โ”€ color.py                    # Color analysis and mapping
โ”‚   โ”‚   โ””โ”€โ”€ tables.py                   # for outputing tabular data
โ”‚   โ”œโ”€โ”€ tree_isolation.py               # Tree isolation algorithms
โ”‚   โ”œโ”€โ”€ qsm_generation.py               # QSM generation pipeline
โ”‚   โ”œโ”€โ”€ canopy_metrics.py               # Tree analysis metrics
โ”‚   โ””โ”€โ”€ ray_casting.py                  # Ray casting operations
โ”œโ”€โ”€ scripts/                            # Processing scripts and workflows
โ”œโ”€โ”€ data/                               # Data storage and examples
โ””โ”€โ”€ requirements.txt                    # Dependencies

Installation

Prerequisites

  • Python 3.8+
  • CUDA support (optional, for GPU acceleration)

Dependencies

pip install -r requirements.txt

Key dependencies include:

  • open3d - 3D data processing
  • numpy - Numerical computing
  • scipy - Scientific computing
  • matplotlib - Plotting and visualization
  • networkx - Graph processing
  • scikit-learn - Machine learning algorithms
  • polyscope - 3D visualization
  • robust_laplacian - Laplacian mesh processing

Configuration

The library uses TOML configuration files for algorithm parameters:

  • src/pyqsm_config.toml - Main configuration file
  • Environment variables: PY_QSM_CONFIG, PY_QSM_LOG_CONFIG

Configuration

Algorithm parameters can be customized in pyqsm_config.toml:

[skeletonize]
moll = 1e-6
n_neighbors = 20
max_iter = 20
init_contraction = 7
init_attraction = 1

[dbscan]
epsilon = 0.1
min_neighbors = 10

[sphere]
min_radius = 0.01
max_radius = 1.5

Processing Scripts

The scripts/ directory contains ready-to-use processing workflows:

  • tree_isolation_script.py - Complete tree isolation pipeline
  • tree_iso_from_feature_branch.py - Feature-based tree isolation
  • visualize_o3d_ml.py - Machine learning-based visualization

Research Applications

pyQSM is designed for:

  • Tree Canopy Segmentation: Automated identification of individual trees and epipytes there-in

  • Environmental Simulation: Triangle meshes can be used along side ray-casting to simulate different angles of sunlight, cloud cover and rain angle

License

This project is licensed under the Mozilla Public License Version 2.0. See LICENSE for details.

Citation

If you use pyQSM in your research, please cite:

[Publication details to be added when available]

Support

For questions, issues, or contributions:

  • Open an issue on GitHub
  • Check the documentation in the data/notes/ directory
  • Review example workflows in the scripts/ directory

Note: This library is under active development. Features and APIs may change between versions. Please check the changelog for breaking changes and updates.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyqsm-0.1.0.tar.gz (73.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyqsm-0.1.0-py3-none-any.whl (77.8 kB view details)

Uploaded Python 3

File details

Details for the file pyqsm-0.1.0.tar.gz.

File metadata

  • Download URL: pyqsm-0.1.0.tar.gz
  • Upload date:
  • Size: 73.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pyqsm-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0761ddeb6fe0b94c4922029c4ec72f5916870d94d269c2b78d0c5d5db2334560
MD5 665f23b4a9752c271acddb442b6c6cb6
BLAKE2b-256 b83e22e4673890856bc911364c5ab62f70b30a686684eb7a94aa18d7e71b99e3

See more details on using hashes here.

File details

Details for the file pyqsm-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyqsm-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 77.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pyqsm-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b98b2fb62b500adbca74964bd6c773caed2e716b911c5e831f62886e2876c63c
MD5 428fece711576ad17789dfde287d286b
BLAKE2b-256 71357448cf64ebbd432f448c317e50dce56fe23998d560309d9e83d46e41934a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page