From 101dccf5d2cbfd2d00117685e9afa3a674aff14b Mon Sep 17 00:00:00 2001 From: ymd-stella Date: Sat, 28 Oct 2023 18:58:04 +0900 Subject: [PATCH] Add option Relocalizer::max_num_local_keyfrms --- src/stella_vslam/module/relocalizer.cc | 12 +++++++----- src/stella_vslam/module/relocalizer.h | 5 ++++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/stella_vslam/module/relocalizer.cc b/src/stella_vslam/module/relocalizer.cc index e49c1cdf..1e7f5798 100644 --- a/src/stella_vslam/module/relocalizer.cc +++ b/src/stella_vslam/module/relocalizer.cc @@ -20,7 +20,8 @@ relocalizer::relocalizer(const std::shared_ptr& pose_o const bool search_neighbor, const unsigned int top_n_covisibilities_to_search, const float num_common_words_thr_ratio, - const unsigned int max_num_ransac_iter) + const unsigned int max_num_ransac_iter, + const unsigned int max_num_local_keyfrms) : min_num_bow_matches_(min_num_bow_matches), min_num_valid_obs_(min_num_valid_obs), bow_matcher_(bow_match_lowe_ratio, false), proj_matcher_(proj_match_lowe_ratio, false), robust_matcher_(robust_match_lowe_ratio, false), @@ -28,7 +29,8 @@ relocalizer::relocalizer(const std::shared_ptr& pose_o search_neighbor_(search_neighbor), top_n_covisibilities_to_search_(top_n_covisibilities_to_search), num_common_words_thr_ratio_(num_common_words_thr_ratio), - max_num_ransac_iter_(max_num_ransac_iter) { + max_num_ransac_iter_(max_num_ransac_iter), + max_num_local_keyfrms_(max_num_local_keyfrms) { spdlog::debug("CONSTRUCT: module::relocalizer"); } @@ -43,7 +45,8 @@ relocalizer::relocalizer(const std::shared_ptr& pose_o yaml_node["search_neighbor"].as(true), yaml_node["top_n_covisibilities_to_search"].as(10), yaml_node["num_common_words_thr_ratio"].as(0.8f), - yaml_node["max_num_ransac_iter"].as(30)) { + yaml_node["max_num_ransac_iter"].as(30), + yaml_node["max_num_local_keyfrms"].as(60)) { } relocalizer::~relocalizer() { @@ -296,8 +299,7 @@ bool relocalizer::refine_pose(data::frame& curr_frm, bool relocalizer::refine_pose_by_local_map(data::frame& curr_frm, const std::shared_ptr& candidate_keyfrm) const { // Create local map - constexpr unsigned int max_num_local_keyfrms = 10; - auto local_map_updater = module::local_map_updater(max_num_local_keyfrms); + auto local_map_updater = module::local_map_updater(max_num_local_keyfrms_); if (!local_map_updater.acquire_local_map(curr_frm.get_landmarks(), curr_frm.frm_obs_.num_keypts_)) { return false; } diff --git a/src/stella_vslam/module/relocalizer.h b/src/stella_vslam/module/relocalizer.h index da85df20..db34722e 100644 --- a/src/stella_vslam/module/relocalizer.h +++ b/src/stella_vslam/module/relocalizer.h @@ -29,7 +29,8 @@ class relocalizer { const bool search_neighbor = true, const unsigned int top_n_covisibilities_to_search = 10, const float num_common_words_thr_ratio = 0.8f, - const unsigned int max_num_ransac_iter = 30); + const unsigned int max_num_ransac_iter = 30, + const unsigned int max_num_local_keyfrms = 60); explicit relocalizer(const std::shared_ptr& pose_optimizer, const YAML::Node& yaml_node); @@ -96,6 +97,8 @@ class relocalizer { const float num_common_words_thr_ratio_ = 0.8f; const unsigned int max_num_ransac_iter_ = 30; + + const unsigned int max_num_local_keyfrms_ = 60; }; } // namespace module