![nanoflann](https://raw.githubusercontent.com/jlblancoc/nanoflann/master/doc/logo.png)
# nanoflann
[![CI Linux](https://github.com/jlblancoc/nanoflann/actions/workflows/ci-linux.yml/badge.svg)](https://github.com/jlblancoc/nanoflann/actions/workflows/ci-linux.yml)
[![CI Check clang-format](https://github.com/jlblancoc/nanoflann/actions/workflows/check-clang-format.yml/badge.svg)](https://github.com/jlblancoc/nanoflann/actions/workflows/check-clang-format.yml)
[![CircleCI](https://circleci.com/gh/jlblancoc/nanoflann/tree/master.svg?style=svg)](https://circleci.com/gh/jlblancoc/nanoflann/tree/master)
[![Windows build status](https://ci.appveyor.com/api/projects/status/h8k1apfogxyqhskd/branch/master?svg=true)](https://ci.appveyor.com/project/jlblancoc/nanoflann/branch/master)
## 1. About
*nanoflann* is a **C++11 [header-only](http://en.wikipedia.org/wiki/Header-only) library** for building KD-Trees of datasets with different topologies: R<sup>2</sup>, R<sup>3</sup> (point clouds), SO(2) and SO(3) (2D and 3D rotation groups). No support for approximate NN is provided. *nanoflann* does not require compiling or installing. You just need to `#include <nanoflann.hpp>` in your code.
This library is a *fork* of the [flann library](https://github.com/flann-lib/flann) by Marius Muja and David G. Lowe, and born as a child project of [MRPT](https://www.mrpt.org/). Following the original license terms, *nanoflann* is distributed under the BSD license. Please, for bugs use the issues button or fork and open a pull request.
Cite as:
```
@misc{blanco2014nanoflann,
title = {nanoflann: a {C}++ header-only fork of {FLANN}, a library for Nearest Neighbor ({NN}) with KD-trees},
author = {Blanco, Jose Luis and Rai, Pranjal Kumar},
howpublished = {\url{https://github.com/jlblancoc/nanoflann}},
year = {2014}
}
```
### 1.1. Obtaining the code
* Easiest way: clone this GIT repository and take the `include/nanoflann.hpp` file for use where you need it.
* Debian or Ubuntu ([21.04 or newer](https://packages.ubuntu.com/source/hirsute/nanoflann)) users can install it simply with:
```bash
sudo apt install libnanoflann-dev
```
* macOS users can install `nanoflann` with [Homebrew](https://brew.sh) with:
```shell
$ brew install brewsci/science/nanoflann
```
or
```shell
$ brew tap brewsci/science
$ brew install nanoflann
```
MacPorts users can use:
```
$ sudo port install nanoflann
```
* Linux users can also install it with [Linuxbrew](https://docs.brew.sh/Homebrew-on-Linux) with: `brew install homebrew/science/nanoflann`
* List of [**stable releases**](https://github.com/jlblancoc/nanoflann/releases). Check out the [CHANGELOG](https://github.com/jlblancoc/nanoflann/blob/master/CHANGELOG.md)
Although nanoflann itself doesn't have to be compiled, you can build some examples and tests with:
sudo apt-get install build-essential cmake libgtest-dev libeigen3-dev
mkdir build && cd build && cmake ..
make && make test
### 1.2. C++ API reference
* Browse the [Doxygen documentation](https://jlblancoc.github.io/nanoflann/).
* **Important note:** If L2 norms are used, notice that search radius and all passed and returned distances are actually *squared distances*.
### 1.3. Code examples
* KD-tree look-up with `knnSearch()` and `radiusSearch()`: [pointcloud_kdd_radius.cpp](https://github.com/jlblancoc/nanoflann/blob/master/examples/pointcloud_kdd_radius.cpp)
* KD-tree look-up on a point cloud dataset: [pointcloud_example.cpp](https://github.com/jlblancoc/nanoflann/blob/master/examples/pointcloud_example.cpp)
* KD-tree look-up on a dynamic point cloud dataset: [dynamic_pointcloud_example.cpp](https://github.com/jlblancoc/nanoflann/blob/master/examples/dynamic_pointcloud_example.cpp)
* KD-tree look-up on a rotation group (SO2): [SO2_example.cpp](https://github.com/jlblancoc/nanoflann/blob/master/examples/SO2_adaptor_example.cpp)
* KD-tree look-up on a rotation group (SO3): [SO3_example.cpp](https://github.com/jlblancoc/nanoflann/blob/master/examples/SO3_adaptor_example.cpp)
* KD-tree look-up on a point cloud dataset with an external adaptor class: [pointcloud_adaptor_example.cpp](https://github.com/jlblancoc/nanoflann/blob/master/examples/pointcloud_adaptor_example.cpp)
* KD-tree look-up directly on an `Eigen::Matrix<>`: [matrix_example.cpp](https://github.com/jlblancoc/nanoflann/blob/master/examples/matrix_example.cpp)
* KD-tree look-up directly on `std::vector<std::vector<T> >` or `std::vector<Eigen::VectorXd>`: [vector_of_vectors_example.cpp](https://github.com/jlblancoc/nanoflann/blob/master/examples/vector_of_vectors_example.cpp)
* Example with a `Makefile` for usage through `pkg-config` (for example, after doing a "make install" or after installing from Ubuntu repositories): [example_with_pkgconfig/](https://github.com/jlblancoc/nanoflann/blob/master/examples/example_with_pkgconfig/)
* Example of how to build an index and save it to disk for later usage: [saveload_example.cpp](https://github.com/jlblancoc/nanoflann/blob/master/examples/saveload_example.cpp)
* GUI examples (requires `mrpt-gui`, e.g. `sudo apt install libmrpt-gui-dev`):
- [nanoflann_gui_example_R3](https://github.com/jlblancoc/nanoflann/blob/master/examples/examples_gui/nanoflann_gui_example_R3/nanoflann_gui_example_R3.cpp)
![nanoflann-demo-1](https://user-images.githubusercontent.com/5497818/201550433-d561c5a9-4e87-453d-9cf8-8202d7876235.gif)
### 1.4. Why a fork?
* **Execution time efficiency**:
* The power of the original `flann` library comes from the possibility of choosing between different ANN algorithms. The cost of this flexibility is the declaration of pure virtual methods which (in some circumstances) impose [run-time penalties](http://www.cs.cmu.edu/~gilpin/c%2B%2B/performance.html#virtualfunctions). In `nanoflann` all those virtual methods have been replaced by a combination of the [Curiously Recurring Template Pattern](http://en.wikipedia.org/wiki/Curiously_recurring_template_pattern) (CRTP) and inlined methods, which are much faster.
* For `radiusSearch()`, there is no need to make a call to determine the number of points within the radius and then call it again to get the data. By using STL containers for the output data, containers are automatically resized.
* Users can (optionally) set the problem dimensionality at compile-time via a template argument, thus allowing the compiler to fully unroll loops.
* `nanoflann` allows users to provide a precomputed bounding box of the data, if available, to avoid recomputation.
* Indices of data points have been converted from `int` to `size_t`, which removes a limit when handling very large data sets.
* **Memory efficiency**: Instead of making a copy of the entire dataset into a custom `flann`-like matrix before building a KD-tree index, `nanoflann` allows direct access to your data via an **adaptor interface** which must be implemented in your class.
Refer to the examples below or to the C++ API of [nanoflann::KDTreeSingleIndexAdaptor<>](https://jlblancoc.github.io/nanoflann/classnanoflann_1_1KDTreeSingleIndexAdaptor.html) for more info.
### 1.5. What can *nanoflann* do?
* Building KD-trees with a single index (no randomized KD-trees, no approximate searches).
* Fast, thread-safe querying for closest neighbors on KD-trees. The entry points are:
* [nanoflann::KDTreeSingleIndexAdaptor<>](https://jlblancoc.github.io/nanoflann/classnanoflann_1_1KDTreeSingleIndexAdaptor.html)`::knnSearch()`
* Finds the `num_closest` nearest neighbors to `query_point[0:dim-1]`. Their indices are stored inside the result object. See an [example usage code](https://github.com/jlblancoc/nanoflann/blob/master/examples/pointcloud_kdd_radius.cpp#L119).
* [nanoflann::KDTreeSingleIndexAdaptor<>](https://jlblancoc.github.io/nanoflann/classnanoflann_1_1KDTreeSingleIndexAdaptor.html)`::radiusSearch()`
* Finds all the neighbors to `que
没有合适的资源?快使用搜索试试~ 我知道了~
《自动驾驶中的SLAM技术》对应开源代码1. 添加详细代码注释 2. 添加深蓝第一期课后习题与大作业的修改C++源码+文档说明
共536个文件
txt:152个
h:93个
cc:91个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 2 下载量 59 浏览量
2024-01-13
20:57:45
上传
评论 1
收藏 187.34MB ZIP 举报
温馨提示
<项目介绍> 《自动驾驶中的SLAM技术》对应开源代码 1. 添加详细代码注释 2. 添加深蓝第一期课后习题与大作业的修改C++源码+文档说明 - 不懂运行,下载完可以私聊问,可远程教学 该资源内项目源码是个人的毕设,代码都测试ok,都是运行成功后才上传资源,答辩评审平均分达到96分,放心下载使用! 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.md文件(如有),仅供学习参考, 切勿用于商业用途。 --------
资源推荐
资源详情
资源评论
收起资源包目录
《自动驾驶中的SLAM技术》对应开源代码1. 添加详细代码注释 2. 添加深蓝第一期课后习题与大作业的修改C++源码+文档说明 (536个子文件)
gtest.cc 208KB
gtest-death-test.cc 50KB
gtest-port.cc 42KB
icp_2d.cc 33KB
fusion.cc 27KB
test_nn.cc 24KB
icp_3d.cc 23KB
lio_iekf.cc 20KB
optimization.cc 18KB
gins_pre_integ.cc 18KB
ndt_inc.cc 16KB
loopclosure.cc 15KB
gtest-printers.cc 15KB
feature_extraction.cc 15KB
split_map.cc 15KB
test_preintegration.cc 14KB
gtest-filepath.cc 14KB
lio_preinteg.cc 14KB
loam_like_odom.cc 14KB
occupancy_map.cc 13KB
mapping_2d.cc 13KB
g2o_types.cc 13KB
ndt_3d.cc 13KB
kdtree.cc 11KB
pangolin_window_impl.cc 10KB
likelihood_field.cc 10KB
packets_parser.cc 10KB
loop_closing.cc 8KB
loosely_lio.cc 8KB
octo_tree.cc 8KB
frontend.cc 8KB
test_icp.cc 7KB
cloud_convert.cc 7KB
static_imu_init.cc 7KB
imu_preintegration.cc 7KB
multi_resolution_likelihood_field.cc 6KB
scan_to_range_image.cc 6KB
direct_ndt_lo.cc 5KB
run_eskf_gins.cc 5KB
run_gins_pre_integ.cc 5KB
icp_inc_3d.cc 5KB
keyframe.cc 4KB
bfnn.cc 4KB
io_utils.cc 4KB
gtest-typed-test.cc 4KB
gtest-test-part.cc 4KB
motion.cc 4KB
pcd_to_bird_eye.cc 4KB
test_2d_icp_s2s.cc 3KB
linear_fitting.cc 3KB
dump_map.cc 3KB
ui_cloud.cc 3KB
measure_sync.cc 3KB
process_gnss.cc 3KB
test_mr_matching.cc 3KB
utm_convert.cc 3KB
run_imu_integration.cc 2KB
test_feature_extraction.cc 2KB
test_2d_icp_likelihood.cc 2KB
lidar_2d_utils.cc 2KB
pangolin_window.cc 2KB
submap.cc 2KB
incremental_ndt_lo.cc 2KB
gtest-all.cc 2KB
test_occupancy_grid.cc 2KB
timer.cc 2KB
test_ndt_lo.cc 2KB
gen_simu_data.cc 2KB
gtest_main.cc 2KB
g2o_types.cc 2KB
test_loosely_lio.cc 2KB
test_inc_ndt_lo.cc 2KB
point_cloud_load_and_vis.cc 2KB
test_lio_preinteg.cc 2KB
test_lio_iekf.cc 2KB
frame.cc 2KB
run_fusion_offline.cc 1KB
test_2d_mapping.cc 1KB
point_cloud_utils.cc 1KB
test_loam_odom.cc 1KB
run_mapping.cc 1KB
test_2dlidar_io.cc 1KB
run_optimization.cc 878B
ui_car.cc 791B
ui_trajectory.cc 738B
ui_test.cc 728B
velodyne_convertor.cc 704B
run_loopclosure.cc 686B
run_frontend.cc 648B
run_gen_simu_data.cc 617B
global_flags.cc 125B
.clang-format 3KB
FindGlog.cmake 9KB
FindPANGO.cmake 5KB
packages.cmake 4KB
FindCholmod.cmake 3KB
FindCSparse.cmake 618B
CONTRIBUTORS 1KB
COPYING 1KB
ikd_Tree.cpp 67KB
共 536 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
- qwertgbj2024-09-15资源简直太好了,完美解决了当下遇到的难题,这样的资源很难不支持~
- liuxiaoxiao00022024-03-01资源很不错,内容和描述一致,值得借鉴,赶紧学起来!
机智的程序员zero
- 粉丝: 2416
- 资源: 4812
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功