Python tool to compute the envelope (alpha shape) of a 3D point cloud, save it as .obj, and save some related metrics (volume and area of the alpha shape, projected area on the ground, accuracy of the alpha shape, number of envelopes) in a csv file.
Only .txt files are supported as inputs for now but this can be improved with some minor modifications.
The code relies on:
- Open3d for point cloud manipulation, 3d alpha shape creation, and (optional) visualisation,
- PyVista for mesh/point cloud intersection and 2d mesh creation,
- PyMeshFix for alpha shape mesh repair.
Below are two example images demonstrating the functionality of the project:
The code outputs in the console and in the output file the alpha value, the alpha shape volume and area, the projected surface on the ground, the accuracy of the alpha shape regarding the point cloud (checks the ratio of points inside the envelope to the full set of points), and the number of meshes in case of multiple envelopes.
After installing the code (see instructions below), you can run it as you want by modifying the following parameters in the main program (envelope_cloud.py):
########################## Inputs ##############################
# relative or absolute path to the directory containing files to study
directory = './test_data'
alpha=0.3
minimal_distance = 0.035 # voxel size for downsampling by voxelisation
output_file_name = 'results.csv' # written in "directory"
plot_results = False # option to plot results using open3d
################################################################Do not forget to activate your dedicated conda environment (see instructions below),
conda activate envelopethen run the code !
python envelope_cloud.pyTo install and set up the project, follow these steps:
Ensure you have the following installed on your system:
-
Clone the Repository
Open a terminal (or Anaconda prompt on Windows) and run the following command to clone the repository:
git clone git@github.com:cyrilbz/envelope_cloud.git
-
** Move to the directory, create a dedicated Conda environement, and install all requirements**
cd envelope_cloud conda create --name envelope python=3.12.0 conda activate envelope pip install -r requirements.txt -
LINUX USERS You might have to install an additional library to have the open3d viewer option to work:
conda install -c conda-forge libstdcxx-ng
-
Modify the input parameters as you want and run the code!
python envelope_cloud.py

