High-performance Python wrapper for the Cloth Simulation Filter (CSF) algorithm using Pybind11, OpenMP parallelization, and zero-copy NumPy array buffers.
uv pip install cc_csf-1.0.0-cp312-cp312-linux_x86_64.whl
# or
pip install cc_csf-1.0.0-cp312-cp312-linux_x86_64.whluv pip install -e . # or pip install .
import numpy as np import cc_csf # Initialize filter csf = cc_csf.CSF() # Configure parameters: # set_params(bSloopSmooth, cloth_resolution, iterations, class_threshold, rigidness) csf.set_params(True, 0.5, 500, 0.3, 1) # Pass Nx3 float64 numpy array (zero-copy buffer) xyz = np.random.rand(100000, 3) * 50.0 csf.set_point_cloud(xyz) # Execute OpenMP-accelerated filtering # Returns list of integer indices belonging to ground points ground_indices = csf.do_filtering() print(f"Detected {len(ground_indices)} ground points out of {len(xyz)}")
Ensure a C++14-compliant compiler and OpenMP libraries are installed:
sudo apt update sudo apt install -y build-essential g++ libomp-dev python3-dev
Install build tools in your virtual environment:
# Using uv (recommended) uv pip install pybind11 wheel build setuptools # Or using standard pip pip install pybind11 wheel build setuptools
From the project root, run:
# Using uv with --no-isolation (avoids Debian/Ubuntu ensurepip issues)
uv run python -m build --no-isolation --wheel cc_csf --outdir wheelsNote
The --no-isolation flag uses the current environment's pybind11 and setuptools, bypassing Debian/Ubuntu minimal python ensurepip constraints.
The compiled binary wheel is stored in wheels/:
ls -lh wheels/
# Output: cc_csf-1.0.0-cp312-cp312-linux_x86_64.whl