A small program to calculate the volume of the cloud point from las file
We use Python environment variables to avoid configuration issues and etc.
$ python -m venv env
$ source env/bin/activate
To use the program, we navigate to the desired directory with cd!
$ cd Task_Fatemetarashi/
We see four directories:
- Codes
- Screenshot
- Exports
- Information_Data
Due to the fact that our ".las" file is a part of the whole and because paths are not hardcoded in the program, we have the configuration file cp.cfg
Due to the fact that we have multiple files and probably we want to perform tasks in parallel, as well as the limited power of my laptop, we have several Python files!
This file contains 2 functions:
Reads the initial cloud points from the .las file and displays them. like our .las file:
Reads the numpy array cloud points from the .npy file and displays them.
This file contains 3 functions:
It finds the group of the points with the same height, then selects the group that has the maximum member and the lowest height and returns the height of that point.
We use the simplest method, Minimum Height Extraction. This function takes a cloud point and a height (which is basically obtained from the previous function) and recognizes the ground based on that.
For this purpose, you can use other methods such as RANSAC(Random Sample Consensus), PCA (Principal Component Analysis), or Smoothing methods like Moving Average Filtering. I think this method works better for bigger cloud point.
This function is the opposite of the ground_detection function
SOR (Statistical Outlier Removal) identifies and removes outlier points based on statistical analysis of the information present in the point cloud.
You can use Voxel Grid Filter, Radius Outlier Removal, or Conditional Outlier Removal.
DBSCAN (Density-Based Spatial Clustering of Applications with Noise). DBSCAN is a density-based clustering algorithm used to detect clusters in heterogeneously distributed data as well as detect noisy points. But, here we return the largest cluster as output!
This is probably not a good method, but anyway! It can be said that the shadow of the cloud sticks to it.
Creates a triangulation of cloud points
It calculates the volume based on ConvexHull, based on ground or height percentage. But, You can calculate the volume based on triangulation with mesh.volume
Because this main is not supposed to be the main, no principles have been written, and mostly written for testing functions and working with cloud points. For this reason, many commands are commented!!!
screenshots used in the readme.
Due to the speed and conditions of my system, we have a series of outputs in the form of Python files that are produced in different stages and then used.
numpy array of cloud points after the SOR filter
numpy array of cloud points after DBSCAN function( DBSCAN filter and choose the largest part
numpy array of cloud points after shadow function
mesh from triangulation
Volume calculation output
The pdf file contains the purpose of this repository, i.e. the problem and its indicators
The .las file contains the cloud point, a subset of a larger data cloud.
If you are having trouble viewing this file, you can use Grip or similar tools.