/pcdmeshing

Point cloud meshing with CGAL

Primary LanguageC++Apache License 2.0Apache-2.0

Fast meshing of clean point clouds in Python

pcdmeshing is a Python package to reconstruct meshes from point clouds using CGAL.

  • Based on the Advancing Front surface reconstruction algorithm by [Cohen-Steiner & Da, The Visual Computer, 2004].
  • Optionally uses point visibility, e.g. from Lidar, to constrain or cleanup the reconstruction.
  • Scales to large scenes by performing block-wise parallel reconstruction.
  • Compared to Poisson surface reconstruction, AF does not assume watertightness, does not resample the point cloud, and does not work at a fixed resolution. It is thus more accurate and produces fewer artifacts if the input point cloud is noise-free.

Installation

  1. Clone the repository and its submodules by running:
git clone --recursive git@github.com:cvg/pcdmeshing.git
cd pcdmeshing
  1. Install Boost>=1.71. The builds of the Ubuntu package manager libboost-all-dev is usually too old, so we build from the header-only sources:
wget https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_1_77_0.tar.gz
tar xzf boost_1_77_0.tar.gz
  1. Build the package and install the dependencies listed in requirements.txt:
pip install .

Usage

from pcdmeshing import run_block_meshing

mesh, _ = run_block_meshing(
        pcd: Union[Path, o3d.geometry.PointCloud],
        voxel_size: float = 20,
        margin_seam: float = 0.2,
        margin_discard: float = 0.2,
        num_parallel: int = 10,
        tmp_dir: Optional[Path] = None,
        use_visibility: bool = False,
        pcd_all_path: Optional[Path] = None,
        pcd_obs_path: Optional[Path] = None,
        opts: Dict = dict(max_edge_length=1., max_visibility=10),
        simplify_fn: Optional[Callable] = None,
        cleanup: bool = True,
) -> o3d.geometry.TriangleMesh

License

The code of this repository is provided under the Apache-2.0 license. Please note that the implementation of the underlying Advancing Front algorithm follows the GPLv3+ license of CGAL.