pico_tree

A C++ header only library for fast nearest neighbor and range searches using a KdTree. It supports interfacing with Eigen, OpenCV, and custom data types and provides optional Python bindings.

https://github.com/jaybro/pico_tree

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in README
  • Academic publication links
    Links to: springer.com, acm.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.3%) to scientific vocabulary

Keywords

approximate-nearest-neighbor-searching cpp eigen header-only kd-tree kdtree nearest-neighbor-searching opencv pico-tree python-bindings range-searching
Last synced: 4 months ago · JSON representation ·

Repository

A C++ header only library for fast nearest neighbor and range searches using a KdTree. It supports interfacing with Eigen, OpenCV, and custom data types and provides optional Python bindings.

Basic Info
  • Host: GitHub
  • Owner: Jaybro
  • License: mit
  • Language: C++
  • Default Branch: main
  • Homepage:
  • Size: 1.8 MB
Statistics
  • Stars: 43
  • Watchers: 5
  • Forks: 9
  • Open Issues: 0
  • Releases: 15
Topics
approximate-nearest-neighbor-searching cpp eigen header-only kd-tree kdtree nearest-neighbor-searching opencv pico-tree python-bindings range-searching
Created over 5 years ago · Last pushed 5 months ago
Metadata Files
Readme License Citation

README.md

PicoTree

build-and-test pip

PicoTree is a C++ header only library with Python bindings for fast nearest neighbor searches and range searches using a KdTree. See the table below to get an impression of the performance provided by the KdTree of this library versus several other implementations:

| | Build C++ | Build Python | Knn C++ | Knn Python | | ----------------------------------- | --------- | ------------- | ---------- | ----------- | | nanoflann v1.7.1 | 1.42s | ... | 1.40s | ... | | SciPy KDTree 1.15.2 | ... | 1.37s | ... | 212.04s | | Scikit-learn KDTree 1.6.1 | ... | 3.60s | ... | 11.90s | | pykdtree 1.3.7 | ... | 0.43s | ... | 2.95s | | OpenCV FLANN 4.11.0 | 0.99s | ... | 2.30s | ... | | PicoTree KdTree v1.0.0 | 0.54s | 0.54s | 1.13s | 1.64s |

These numbers were generated on an Intel Core i9-14900HX using two LiDAR based point clouds of sizes 7733372 and 7200863. The first point cloud was the input to the build algorithm and the second to the query algorithm. All benchmarks were run on a single thread with the following parameters: max_leaf_size=10 and knn=1. A more detailed C++ comparison of PicoTree is available with respect to nanoflann.

Available under the MIT license.

Capabilities

KdTree: * Search functions: * Exact nearest neighbor, radius and box searches. * Approximate nearest neighbor and radius searches. * Custom nearest neighbor searches. * Metric spaces: * Support for spaces with identifications. E.g., points on the circle S1 [0, 1]. * Available distance functions: metric_l1, metric_l2_squared, metric_lpinf, metric_lninf, metric_so2, and metric_se2_squared. * Custom metrics. * Multiple build options: * Tree splitting rules: median_max_side_t, midpoint_max_side_t and sliding_midpoint_max_side_t. * Tree split stop conditions: max_leaf_size_t and max_leaf_depth_t. * Custom starting bounding box. * Compile time and run time known dimensions. * Static tree builds. * Thread safe queries. * Optional Python bindings.

PicoTree can interface with different types of points and point sets through traits classes. These can be custom implementations or one of the pico_tree::space_traits<> and pico_tree::point_traits<> classes provided by this library. * Space type support: * std::vector<point_type>. * pico_tree::space_map<point_type>. * Eigen::Matrix<> and Eigen::Map<Eigen::Matrix<>>. * cv::Mat. * Point type support: * Fixed size arrays and std::array<>. * pico_tree::point_map<>. * Eigen::Vector<> and Eigen::Map<Eigen::Vector<>>. * cv::Vec<>. * pico_tree::space_map<point_type> and pico_tree::point_map<> allow interfacing with dynamic size arrays. It is assumed that points and their coordinates are laid out contiguously in memory.

Examples

Requirements

Minimum:

  • A compiler that is compliant with the C++17 standard or higher.
  • CMake. It is also possible to just copy and paste the pico_tree directory into an include directory.

Optional:

  • Doxygen. Needed for generating documentation.
  • Google Test. Used for running unit tests.
  • Eigen. To run the example that shows how Eigen data types can be used in combination with PicoTree.
  • OpenCV. To run the OpenCV example that shows how to work with OpenCV data types.
  • Google Benchmark is needed to run any of the benchmarks. The nanoflann and OpenCV benchmarks also require their respective libraries to be installed.

Python bindings: * Python. Version 3.10 or higher. * pybind11. Used to ease the creation of Python bindings. Available under the BSD license and copyright. * OpenMP. For parallelization of queries. * numpy. Points and search results are represented by ndarrays. * scikit-build. Glue between CMake and setuptools.

Build

Build with CMake:

console $ mkdir build && cd build $ cmake ../ $ cmake --build . $ cmake --build . --target pico_tree_doc $ cmake --install .

```cmake find_package(PicoTree REQUIRED)

addexecutable(myexe main.cpp) targetlink_libraries(myexe PUBLIC PicoTree::PicoTree) ```

Install with pip:

console $ pip install ./pico_tree

References

Owner

  • Name: Jonathan Broere
  • Login: Jaybro
  • Kind: user

Citation (CITATION.cff)

cff-version: 1.2.0
message: "Please cite this software using these metadata."
authors:
  - given-names: Jonathan
    family-names: Broere
title: >-
  "PicoTree: a C++ header only library for fast nearest neighbor and range
  searches using a KdTree."
abstract: >-
  "PicoTree: a C++ header only library for fast nearest neighbor and range
  searches using a KdTree. It supports interfacing with Eigen, OpenCV, and
  custom data types and provides optional Python bindings."
type: software
repository: 'https://github.com/Jaybro/pico_tree'
license: MIT

GitHub Events

Total
  • Release event: 1
  • Watch event: 6
  • Delete event: 2
  • Push event: 15
  • Pull request event: 1
  • Fork event: 1
  • Create event: 3
Last Year
  • Release event: 1
  • Watch event: 6
  • Delete event: 2
  • Push event: 15
  • Pull request event: 1
  • Fork event: 1
  • Create event: 3

Dependencies

setup.py pypi
  • numpy *
.github/workflows/build-and-test.yml actions
  • Jaybro/action-cmake v1 composite
  • actions/checkout v3 composite
.github/workflows/pip.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite