Add FlannIndex abstract interface and implement NanoFlannIndex subclass (#1744)

* Add FlannIndex abstract interface and implement NanoFlannIndex subclass

* Refactored: made NanoFlann a new NN type instead of inheriting FlannIndex. Added tests. Vendoring nanoflann.h directly in the repo. RegistrationVis now use NANOFLANN_INDEX_KDTREE_SINGLE (instead of FLANN_INDEX_KDTREE_SINGLE) flann index for 2d points matching.

* cleanup comments, added FlannIndex doxygen

* Fixing windows tests

* updating flaky test

* Simplified interface, added flann kdtree single approach selectable by parameters.

* RegVis: symmetry of nanoflann for two branches of guess feature matching

* cv::BFMatcher baseline

* Small cmake optimization FLANN_KDTREE_MEM_OPT only defined for FlannIndex

* Refactored where FLANN_KDTREE_MEM_OPT is defined

* fixed file name already exist

* cleanup

* fixup build

---------

Co-authored-by: matlabbe <matlabbe@gmail.com>
This commit is contained in:
Muhammad
2026-08-16 19:51:39 +03:00
committed by GitHub
parent df52523a0c
commit f647014f54
28 changed files with 7537 additions and 179 deletions

View File

@@ -28,6 +28,7 @@ set(corelib_test_sources
test_util3d_surface.cpp #util3d_surface.h
test_visualword.cpp #VisualWord.h
test_vwdictionary.cpp #VWDictionary.h
test_flann_index.cpp #FlannIndex.h
test_transform.cpp #Transform.h
test_stereo_dense.cpp #StereoDense.h (BM and SGBM strategies)
test_stereo.cpp #Stereo.h (BlockMatching and OpticalFlow)
@@ -102,6 +103,24 @@ foreach(shard RANGE 0 ${_corelib_last_shard})
ENVIRONMENT "GTEST_TOTAL_SHARDS=${CORELIB_TEST_SHARDS};GTEST_SHARD_INDEX=${shard}")
endforeach()
# Comparison of the FlannIndex backends (times, memory, recall). Its own
# executable so that it can be run on demand:
# bin/test_flann_index_perf
# bin/test_flann_index_perf --gtest_filter=*Descriptors*
# and so that its seconds of benchmarking stay out of the unit test shards.
IF(BUILD_PERF_TESTS)
add_executable(test_flann_index_perf perf_flann_index.cpp)
target_link_libraries(test_flann_index_perf gtest_main rtabmap_core)
# Labelled "performance" so CI jobs can opt out via `ctest -LE performance`,
# and run them alone with `ctest -L performance`.
add_test(NAME test_flann_index_perf COMMAND test_flann_index_perf)
math(EXPR _perf_timeout "600 * ${_test_timeout_scale}")
set_tests_properties(test_flann_index_perf PROPERTIES
TIMEOUT ${_perf_timeout}
LABELS "performance")
ENDIF(BUILD_PERF_TESTS)
# Rtabmap end-to-end replay of sample DBs (test data fetched by
# scripts/fetch_test_data.sh into data/tests/*.db). Skips at runtime if the
# assets are absent, so the build stays green for contributors without them.