Skip to content
Snippets Groups Projects
Commit c874d6a4 authored by Sergi Pujol's avatar Sergi Pujol
Browse files

refactor

parent 12e27911
No related branches found
No related tags found
1 merge request!4Resolve "Implementation of Falko lib"
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <iostream> #include <iostream>
#include <iterator> #include <iterator>
#include <list> #include <list>
#include <math.h>
#include <memory> #include <memory>
/************************** /**************************
...@@ -67,10 +68,10 @@ struct ParameterLoopClosureFalko { ...@@ -67,10 +68,10 @@ struct ParameterLoopClosureFalko {
int match_type_ = 1; // match_type=1-> uses keypoints and descriptors for int match_type_ = 1; // match_type=1-> uses keypoints and descriptors for
// matching. match_type=2-> uses only keypoints for // matching. match_type=2-> uses only keypoints for
// matching // matching
double matcher_ddesc_th_=0.2; double matcher_ddesc_th_ = 0.2;
// aht matcher // aht matcher
double xRes_ = 0.1; double xRes_ = 0.1;
double yRes_ = 0.1; double yRes_ = 0.1;
double thetaRes_ = 0.04; double thetaRes_ = 0.04;
double xAbsMax_ = 5; double xAbsMax_ = 5;
...@@ -152,9 +153,16 @@ public: ...@@ -152,9 +153,16 @@ public:
**/ **/
matchLoopClosurePtr matchScene(sceneBasePtr _scene_1, matchLoopClosurePtr matchScene(sceneBasePtr _scene_1,
sceneBasePtr _scene_2) override { sceneBasePtr _scene_2) override {
// int n_rotations = 8;
// for (i = 0; i < n_rotations; i++) {
// double rotation = (2 * M_PI / n_rotations) * i;
std::vector<std::pair<int, int>> asso_nn; std::vector<std::pair<int, int>> asso_nn;
auto scene_1_falko = std::static_pointer_cast<SceneFalko<D>>(_scene_1); auto scene_1_falko = std::static_pointer_cast<SceneFalko<D>>(_scene_1);
auto scene_2_falko = std::static_pointer_cast<SceneFalko<D>>(_scene_2); auto scene_2_falko = std::static_pointer_cast<SceneFalko<D>>(_scene_2);
// //Rotate all descriptors of the list
// for (j=0; j<)
// scene_2_falko->descriptors_list_[j]
int matching_number = 0; int matching_number = 0;
if (match_type_ == 1) { if (match_type_ == 1) {
...@@ -165,13 +173,7 @@ public: ...@@ -165,13 +173,7 @@ public:
scene_1_falko->keypoints_list_, scene_1_falko->descriptors_list_, scene_1_falko->keypoints_list_, scene_1_falko->descriptors_list_,
scene_2_falko->keypoints_list_, scene_2_falko->descriptors_list_, scene_2_falko->keypoints_list_, scene_2_falko->descriptors_list_,
asso_nn); asso_nn);
} /*else if (match_type_ = 3) {
matching_number =
matcher_desc_.match(scene_1_falko->descriptors_list_,
scene_2_falko->descriptors_list_, asso_nn);
} }
*/
auto new_match = std::make_shared<MatchLoopClosure>(); auto new_match = std::make_shared<MatchLoopClosure>();
new_match->keypoints_number_match = matching_number; new_match->keypoints_number_match = matching_number;
if (matching_number > keypoints_number_th_) { if (matching_number > keypoints_number_th_) {
...@@ -187,28 +189,10 @@ public: ...@@ -187,28 +189,10 @@ public:
new_match->score = (double)matching_number / new_match->score = (double)matching_number /
(double)std::min(scene_1_falko->keypoints_list_.size(), (double)std::min(scene_1_falko->keypoints_list_.size(),
scene_2_falko->keypoints_list_.size()); scene_2_falko->keypoints_list_.size());
//}
return new_match; return new_match;
} }
/** \brief compare new scans against the trained set in order to find loop
*closures
**/
/*
std::map<double, matchLoopClosurePtr>
findLoopClosure(sceneBaseListPtr _l_scenes,
const sceneBasePtr _new_scene) override {
auto _l_scenes_falko =
std::static_pointer_cast<SceneFalkoList<D>>(_l_scenes);
auto new_scene_falko =
std::static_pointer_cast<SceneFalko<D>>(_new_scene); std::map<double,
matchLoopClosurePtr> matchings; for (auto scene : _l_scenes_falko->scenes_)
{ auto ref_scene = std::static_pointer_cast<SceneFalko<D>>(scene); auto
match = matchScene(ref_scene, new_scene_falko);
matchings.emplace(match->score, match);
}
return matchings;
}
*/
int keypoints_number_th_; int keypoints_number_th_;
int match_type_; int match_type_;
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment