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.
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:
open3dlaspy
(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
.lasfiles. To use.plyor.txt, write a custom reader function with the same output format asread_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
.npyfile. - You can load the saved mask in the
mainfunction to avoid recomputing.
- If the function fails in the second step, a plot mask is saved as an
Contact:
π§ wout.cherlet@ugent.be
This script creates both:
- A propagated point cloud in
.lasformat - Individual tree point clouds in
.lasformat 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.015Dependencies:
open3dlaspy- laz backends
lazrsor,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,.lazand.plyfiles 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
.npyfile and can be reloaded later.
- If the second step fails, the plot mask is saved as an
Contact:
π§ geike.desloover@ugent.be
π§ louise.terryn@ugent.be