Skip to main content

linefit ground segmentation algorithm Python bindings

Project description

linefit

linefit is a ground segmentation algorithm for 3D point clouds. This repo we setup a python binding for the original C++ code and push to pypi for easy installation through pip install linefit.

Author: C++ code from Lorenz Wellhausen, nanobind by Qingwen Zhang.

Running on macOS, Windows and Linux, with Python Version >= 3.8.

0. Setup

Choose one of the following options to install the package (recommended to use Option A pip install linefit):

Option A: Install from pypi pip install linefit

Option B: Clone this repo and run following to build:

cmake -B build && cmake --build build
pip install .
python3 -c 'import linefit; print("success")'

1. Run the example

After installation, you can run the example by, it will directly show a default effect of demo data.

python example.py

A window will pop up and show the ground segmentation result.

Parameter description

TL;DR: tune the sensor_height to offset the ground point z to 0. Others are optional for better performance. If you are interested in the details, please read the following.

Parameters are set in assets/config.toml

This algorithm works on the assumption that you known the height of the sensor above ground. Therefore, you have to adjust the sensor_height to your robot specifications, otherwise, it will not work.

The default parameters should work on the KITTI dataset.

Ground Condition

  • sensor_height Sensor height above ground.
  • max_dist_to_line maximum vertical distance of point to line to be considered ground.
  • max_slope Maximum slope of a line.
  • min_slope Minimum slope of a line.
  • max_fit_error Maximum error a point is allowed to have in a line fit.
  • max_start_height Maximum height difference between new point and estimated ground height to start a new line.
  • long_threshold Distance after which the max_height condition is applied.
  • max_height Maximum height difference between line points when they are farther apart than long_threshold.
  • line_search_angle How far to search in angular direction to find a line. A higher angle helps fill "holes" in the ground segmentation.

Segmentation

  • r_min Distance at which segmentation starts.
  • r_max Distance at which segmentation ends.
  • n_bins Number of radial bins.
  • n_segments Number of angular segments.

Other

  • n_threads Number of threads to use.

Acknowledgement & Citation

The original C++ code is from the repo we forked: lorenwel/linefit_ground_segmentation.

The original methods are described in the following paper:

@inproceedings{himmelsbach2010fast,
  title={Fast segmentation of 3d point clouds for ground vehicles},
  author={Himmelsbach, Michael and Hundelshausen, Felix V and Wuensche, H-J},
  booktitle={Intelligent Vehicles Symposium (IV), 2010 IEEE},
  pages={560--565},
  year={2010},
  organization={IEEE}
}

More python binding examples can be found in our other project:

  • dufomap: a dynamic awareness mapping framework. Remove dynamic points in a raw map.
  • dztimer: a breakout timer for python code.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

linefit-0.2.4-pp310-pypy310_pp73-win_amd64.whl (126.1 kB view hashes)

Uploaded PyPy Windows x86-64

linefit-0.2.4-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (154.6 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

linefit-0.2.4-pp310-pypy310_pp73-macosx_10_14_x86_64.whl (112.5 kB view hashes)

Uploaded PyPy macOS 10.14+ x86-64

linefit-0.2.4-pp39-pypy39_pp73-win_amd64.whl (126.1 kB view hashes)

Uploaded PyPy Windows x86-64

linefit-0.2.4-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (154.6 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

linefit-0.2.4-pp39-pypy39_pp73-macosx_10_14_x86_64.whl (112.3 kB view hashes)

Uploaded PyPy macOS 10.14+ x86-64

linefit-0.2.4-pp38-pypy38_pp73-win_amd64.whl (126.1 kB view hashes)

Uploaded PyPy Windows x86-64

linefit-0.2.4-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (154.6 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

linefit-0.2.4-pp38-pypy38_pp73-macosx_10_14_x86_64.whl (112.5 kB view hashes)

Uploaded PyPy macOS 10.14+ x86-64

linefit-0.2.4-cp312-abi3-win_amd64.whl (126.4 kB view hashes)

Uploaded CPython 3.12+ Windows x86-64

linefit-0.2.4-cp312-abi3-musllinux_1_1_x86_64.whl (483.7 kB view hashes)

Uploaded CPython 3.12+ musllinux: musl 1.1+ x86-64

linefit-0.2.4-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (155.9 kB view hashes)

Uploaded CPython 3.12+ manylinux: glibc 2.17+ x86-64

linefit-0.2.4-cp312-abi3-macosx_11_0_arm64.whl (104.1 kB view hashes)

Uploaded CPython 3.12+ macOS 11.0+ ARM64

linefit-0.2.4-cp312-abi3-macosx_10_14_x86_64.whl (114.0 kB view hashes)

Uploaded CPython 3.12+ macOS 10.14+ x86-64

linefit-0.2.4-cp311-cp311-win_amd64.whl (127.3 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

linefit-0.2.4-cp311-cp311-musllinux_1_1_x86_64.whl (485.0 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

linefit-0.2.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (156.7 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

linefit-0.2.4-cp311-cp311-macosx_11_0_arm64.whl (105.1 kB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

linefit-0.2.4-cp311-cp311-macosx_10_14_x86_64.whl (114.8 kB view hashes)

Uploaded CPython 3.11 macOS 10.14+ x86-64

linefit-0.2.4-cp310-cp310-win_amd64.whl (127.3 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

linefit-0.2.4-cp310-cp310-musllinux_1_1_x86_64.whl (485.0 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

linefit-0.2.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (156.8 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

linefit-0.2.4-cp310-cp310-macosx_11_0_arm64.whl (105.2 kB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

linefit-0.2.4-cp310-cp310-macosx_10_14_x86_64.whl (114.9 kB view hashes)

Uploaded CPython 3.10 macOS 10.14+ x86-64

linefit-0.2.4-cp39-cp39-win_amd64.whl (127.7 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

linefit-0.2.4-cp39-cp39-musllinux_1_1_x86_64.whl (485.2 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

linefit-0.2.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (157.0 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

linefit-0.2.4-cp39-cp39-macosx_11_0_arm64.whl (105.4 kB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

linefit-0.2.4-cp39-cp39-macosx_10_14_x86_64.whl (115.1 kB view hashes)

Uploaded CPython 3.9 macOS 10.14+ x86-64

linefit-0.2.4-cp38-cp38-win_amd64.whl (127.6 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

linefit-0.2.4-cp38-cp38-musllinux_1_1_x86_64.whl (485.0 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ x86-64

linefit-0.2.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (156.8 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

linefit-0.2.4-cp38-cp38-macosx_11_0_arm64.whl (105.1 kB view hashes)

Uploaded CPython 3.8 macOS 11.0+ ARM64

linefit-0.2.4-cp38-cp38-macosx_10_14_x86_64.whl (115.0 kB view hashes)

Uploaded CPython 3.8 macOS 10.14+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page