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

function matchScene finished and gtest added

parent 06b90b5b
No related branches found
No related tags found
1 merge request!4Resolve "Implementation of Falko lib"
This commit is part of merge request !4. Comments created here will be created in the context of that merge request.
...@@ -54,7 +54,7 @@ namespace laserscanutils{ ...@@ -54,7 +54,7 @@ namespace laserscanutils{
extractor_.compute(*scanFALKO,newScene->keypointsList, newScene->descriptorsList); extractor_.compute(*scanFALKO,newScene->keypointsList, newScene->descriptorsList);
return newScene; return newScene;
} }
/*
template <typename D,typename Extr, typename M> template <typename D,typename Extr, typename M>
typename loopClosureFalko<D,Extr, M>::matchLoopClosurePtr matchScene(std::shared_ptr<sceneFalko<D>> scene1,std::shared_ptr<sceneFalko<D>> scene2){ typename loopClosureFalko<D,Extr, M>::matchLoopClosurePtr matchScene(std::shared_ptr<sceneFalko<D>> scene1,std::shared_ptr<sceneFalko<D>> scene2){
std::vector<std::pair<int, int> > assoNN; std::vector<std::pair<int, int> > assoNN;
...@@ -72,7 +72,7 @@ namespace laserscanutils{ ...@@ -72,7 +72,7 @@ namespace laserscanutils{
return new_match; return new_match;
} }
*/
//void findLoopClosure(std::list<sceneFalko>& scenes, const cornerScene newScene){} //void findLoopClosure(std::list<sceneFalko>& scenes, const cornerScene newScene){}
//Explicitly compile all the templates //Explicitly compile all the templates
......
...@@ -79,7 +79,20 @@ public: ...@@ -79,7 +79,20 @@ public:
/** \brief Convert scans from laserscanutils::LaserScan to falkolib::LaserScan object /** \brief Convert scans from laserscanutils::LaserScan to falkolib::LaserScan object
**/ **/
matchLoopClosurePtr matchScene(sceneFalkoBSCPtr scene1 ,std::shared_ptr<sceneFalko<D>> scene2); matchLoopClosurePtr matchScene(sceneFalkoBSCPtr scene1 ,sceneFalkoBSCPtr scene2){
std::vector<std::pair<int, int> > assoNN;
int matching_number = matcher_.match(scene1->keypointsList,scene2->keypointsList, assoNN);
auto new_match=std::make_shared<matchLoopClosure<D>>();
new_match-> keypointsNumberMatch = matching_number;
int keypoints_number_th=5;
if (matching_number>keypoints_number_th){
new_match-> match = true;
} else {
new_match-> match = false;
}
new_match -> sceneTuple = std::make_tuple(scene1,scene2);
return new_match;
}
}; };
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <memory> #include <memory>
#include <tuple>
/************************** /**************************
* laser_scan_utils includes * * laser_scan_utils includes *
......
...@@ -23,24 +23,24 @@ TEST(loop_closure_falko, TestExtractSceneAndMatcher) ...@@ -23,24 +23,24 @@ TEST(loop_closure_falko, TestExtractSceneAndMatcher)
loopClosureFalko<bsc, bscExtractor, NNMatcher> LCFalko; loopClosureFalko<bsc, bscExtractor, NNMatcher> LCFalko;
auto newScene=LCFalko.extractScene(scan, laserParams); auto new_scene=LCFalko.extractScene(scan, laserParams);
int detectedKeypoints =((*newScene).keypointsList).size(); int detectedKeypoints =((*new_scene).keypointsList).size();
int detectedDescriptors =newScene->descriptorsList.size(); int detectedDescriptors =new_scene->descriptorsList.size();
ASSERT_EQ(detectedKeypoints, 18); ASSERT_EQ(detectedKeypoints, 18);
ASSERT_EQ(detectedDescriptors, 18); ASSERT_EQ(detectedDescriptors, 18);
/*
//Test matcher //Test matcher
auto new_match =LCFalko.matchScene(newScene,newScene); auto new_match =LCFalko.matchScene(new_scene,new_scene);
int keypoints_matched = new_match->keypointsNumberMatch; int keypoints_matched = new_match->keypointsNumberMatch;
ASSERT_EQ(keypoints_matched, 18); ASSERT_EQ(keypoints_matched, 18);
*/
// PRINTF("All good at TestTest::DummyTestExample !\n"); // PRINTF("All good at TestTest::DummyTestExample !\n");
} }
......
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