Skip to content

qforestlab/treeseg_propagation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

14 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Tree Instance Propagation to Original Plot Point Cloud

This repo contains two scripts aimed at removing points present in tree instances from original plot point clouds using distance-based thresholding.
Given a set of segmented tree point clouds, and the original, unedited plot point cloud, in the same coordinate system, the segmented tree points will be propagated to the plot point cloud and removed.


πŸ“„ propagate_predictions.py

This script creates a propagated point cloud (i.e., the original plot point cloud without the segmented trees).

How to run: Replace the paths in the main function at the bottom of the script and execute the Python file.

Dependencies:

  • open3d
  • laspy
    (Tested using Ubuntu + Python 3.10)

Notes:

  • The trees must be in the original coordinate system (e.g. the same coordinate system as the plot point cloud).
  • With minor adaptations, the same code can be used to label (instead of remove) points β€” e.g., for instance segmentation training/testing data.
  • The script reads .las files. To use .ply or .txt, write a custom reader function with the same output format as read_las_np, and adjust other functions accordingly.
  • The algorithm is split into two steps due to potential memory issues, especially with undownsampled data.
    • If the function fails in the second step, a plot mask is saved as an .npy file.
    • You can load the saved mask in the main function to avoid recomputing.

Contact:
πŸ“§ wout.cherlet@ugent.be


πŸ“„ tree_extraction.py

This script creates both:

  1. A propagated point cloud in .las format
  2. Individual tree point clouds in .las format using points from the original plot point cloud.

How to run:
Execute from the command line:

python tree_extraction.py <input_file.las> <input_directory> <output_directory> <propagated_file.las> --distance_th <value>

Example:

python tree_extraction.py /path/to/input.las /path/to/input_dir/ /path/to/output_dir/ /path/to/propagated.las --distance_th 0.015

Dependencies:

  • open3d
  • laspy
  • laz backends
    • lazrs or,
    • laszip
  • argparse

Notes:

  • The trees must be in the original coordinate system (e.g. the same coordinate system as the plot point cloud).
  • The script reads .las, .laz and .ply files automatically. It recognizes if you have a laz backend installed.
  • As with the other script, the algorithm is split into two steps due to memory constraints.
    • If the second step fails, the plot mask is saved as an .npy file and can be reloaded later.

Contact:
πŸ“§ geike.desloover@ugent.be
πŸ“§ louise.terryn@ugent.be

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages