Skip to content

Anand-EB/random-walker-seg-pointcloud

 
 

Repository files navigation

Random walker segmentation for Point Cloud Data

This repository contains a C++ header-only implementation and Python wrapper of marker-based 3D point cloud segmentation, directly based on the following papers:

Installation

Docker (Recommended)

To build the docker container

git clone --recursive https://github.com/kasparas-k/random-walker-seg-pointcloud.git
cd random-walker-seg-pointcloud
make build-docker

To run the docker container (in an interactive way)

make run-docker

To stop and clean up the container

make clean-docker

System

This package's C++ dependencies are: Eigen3, OpenMP and pybind11. They can be installed via conda:

conda install -c conda-forge eigen libgomp pybind11

The Python package can then be installed locally:

git clone --recursive https://github.com/kasparas-k/random-walker-seg-pointcloud.git
cd random-walker-seg-pointcloud
pip install -e python/

Or directly from github:

pip install "git+https://github.com/kasparas-k/random-walker-seg-pointcloud.git#subdirectory=python"

Usage

The segmentation markers need to be user-provided, so this algorithm needs to be part of a GUI point cloud processing app's backend, or to consume automatically generated markers from another algorithm.

from pc_rwalker import random_walker_segmentation

# assume an xyz point cloud and markers, a list of point index lists, are available

# by default, (n,) shape numpy array will be returned, where each element is each point's segment id
pointwise_segment_ids = random_walker_segmentation(
    xyz, markers, n_neighbors=15, return_flat=True
)

# alternatively, a list of point index lists can be returned,
# corresponding to the indices assigned to each initial marker list
segment_list = random_walker_segmentation(
    xyz, markers, n_neighbors=15, return_flat=False
)

An example of segmenting a bunny point cloud is provided in examples/segment_bunny.py with an additional dependency on laspy. This code will generate a new point cloud you can inspect in a software of your choice, such as CloudCompare.

python examples/segment_bunny.py

About

Segmentation of point clouds using random walker algorithm

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 50.0%
  • C++ 46.6%
  • CMake 2.3%
  • Makefile 1.1%