From ff113b62bb894889925b6636e1a8d02d0d0916ca Mon Sep 17 00:00:00 2001
From: asantamaria <asantamaria@iri.upc.edu>
Date: Thu, 10 Aug 2017 11:27:40 +0200
Subject: [PATCH] working with factories :)

---
 src/CMakeLists.txt                            |   7 +-
 src/{internal => _internal}/config.h.in       |   0
 src/examples/feature_detect_descript.cpp      | 115 ----------
 .../feature_detect_descript_match.cpp         | 201 ------------------
 src/examples/test_matcher.cpp                 |  12 +-
 src/feature_matcher/feature_matcher.cpp       | 195 -----------------
 src/feature_matcher/feature_matcher.h         |  81 -------
 src/matchers/matcher_base.cpp                 |   4 +-
 src/matchers/matcher_base.h                   |   2 +-
 src/vision_utils.h                            |   2 +-
 10 files changed, 19 insertions(+), 600 deletions(-)
 rename src/{internal => _internal}/config.h.in (100%)
 delete mode 100644 src/examples/feature_detect_descript.cpp
 delete mode 100644 src/examples/feature_detect_descript_match.cpp
 delete mode 100644 src/feature_matcher/feature_matcher.cpp
 delete mode 100644 src/feature_matcher/feature_matcher.h

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 46028f0..395080f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -143,7 +143,7 @@ ENDIF(YAMLCPP_FOUND)
 SET(_VU_ROOT_DIR ${CMAKE_SOURCE_DIR})
 
 # Define the directory where will be the configured config.h
-SET(VU_CONFIG_DIR ${PROJECT_BINARY_DIR}/conf/internal)
+SET(VU_CONFIG_DIR ${PROJECT_BINARY_DIR}/conf/_internal)
 
 # Create the specified output directory if it does not exist.
 IF(NOT EXISTS "${VU_CONFIG_DIR}")
@@ -153,7 +153,8 @@ ENDIF()
 IF(EXISTS "${VU_CONFIG_DIR}" AND NOT IS_DIRECTORY "${VU_CONFIG_DIR}")
   MESSAGE(FATAL_ERROR "Bug: Specified CONFIG_DIR: ${VU_CONFIG_DIR} exists, but is not a directory.")
 ENDIF()
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/internal/config.h.in "${VU_CONFIG_DIR}/config.h")
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/_internal/config.h.in "${VU_CONFIG_DIR}/config.h")
+MESSAGE(STATUS "Configuring ${PROJECT_NAME} (creating config.h from _internal dir)")
 
 # Include config.h directory at first.
 include_directories("${PROJECT_BINARY_DIR}/conf")
@@ -175,7 +176,7 @@ INSTALL(TARGETS ${PROJECT_NAME}
         ARCHIVE DESTINATION lib/${PROJECT_NAME})
 INSTALL(FILES ${headers} DESTINATION include/${PROJECT_NAME})
 INSTALL(FILES ../cmake_modules/Find${PROJECT_NAME}.cmake DESTINATION ${CMAKE_ROOT}/Modules/)
-INSTALL(FILES "${VU_CONFIG_DIR}/config.h" DESTINATION include/${PROJECT_NAME}/internal)
+INSTALL(FILES "${VU_CONFIG_DIR}/config.h" DESTINATION include/${PROJECT_NAME}/_internal)
 
 # examples of usage
 ADD_SUBDIRECTORY(examples)
diff --git a/src/internal/config.h.in b/src/_internal/config.h.in
similarity index 100%
rename from src/internal/config.h.in
rename to src/_internal/config.h.in
diff --git a/src/examples/feature_detect_descript.cpp b/src/examples/feature_detect_descript.cpp
deleted file mode 100644
index 5bbf065..0000000
--- a/src/examples/feature_detect_descript.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-// OWN stuff
-#include <string>
-
-#include "../vision_utils.h"
-
-
-int main(int argc, char *argv[])
-{
-    std::cout << "---------------------------------------------------------" << std::endl;
-    std::cout << "|       Feature detectors and descriptors example       |" << std::endl;
-    std::cout << "---------------------------------------------------------" << std::endl;
-    std::cout << std::endl;
-
-    //***********
-    // Detector |
-    //***********
-
-    FeatureDetector detector;
-    DetectorParams detector_params; // TODO: Fill parameters
-
-    std::vector<std::string> detectors_list;
-    detectors_list = detector.list();
-
-    for (unsigned int ii=0; ii<detectors_list.size(); ii++)
-    {
-    	if ( (detectors_list[ii].compare("LSD")!=0) && (detectors_list[ii].compare("ED")!=0) )
-    		std::cout << "[" << ii << "]: " << detectors_list[ii] << std::endl;
-    }
-
-    // Get default value
-    int feat_type;
-    detector.get(feat_type);
-
-    std::cout << std::endl << "Which DETECTOR do you want to test?[default: " <<  detectors_list[feat_type] << "]";
-
-    feat_type = readFromUser(feat_type);
-
-    detector.set(detectors_list[feat_type],detector_params);
-
-    //*************
-    // Descriptor |
-    //*************
-
-    FeatureDescriptor descriptor;
-    DescriptorParams descriptor_params; // TODO: Fill parameters
-
-    std::vector<std::string> descriptor_list;
-    descriptor_list = descriptor.list();
-
-    for (unsigned int ii=0; ii<descriptor_list.size(); ii++)
-        std::cout << "[" << ii << "]: " << descriptor_list[ii] << std::endl;
-
-    // Get default value
-    int desc_type;
-    descriptor.get(desc_type);
-
-    std::cout << std::endl << "Which DESCRIPTOR do you want to test?[default: " <<  descriptor_list[desc_type] << "]";
-
-    desc_type = readFromUser(desc_type);
-
-    descriptor.set(descriptor_list[desc_type],descriptor_params);
-
-    std::cout << std::endl << "Testing: " << detectors_list[feat_type] << " + " << descriptor_list[desc_type] << " (DETECTOR + DESCRIPTOR)" << std::endl;
-
-    // *****************************
-
-    // Open camera
-    cv::VideoCapture cam;
-    CamUtils cam_fc;
-    cam_fc.openCamera(0, cam);
-
-    // Create displays
-    cv::startWindowThread();
-    cv::namedWindow("Original image", cv::WINDOW_NORMAL);
-    cv::namedWindow("Detections", cv::WINDOW_NORMAL);
-
-    // The following line is used to remove the OpenCV "init done" from the terminal
-    std::cout << "\e[A" << "         " << std::endl;
-
-    for (int nframe = 0; nframe < 1000; ++nframe)
-    {
-        // Get frame
-        cv::Mat frame;
-        cam_fc.getFrame(cam, frame);
-
-        // Show ORIGINAL frame
-        cv::imshow("Original image", frame);
-
-      	// Detector
-        KeyPointVector keypoints;
-        keypoints = detector.detectKeyPoints(frame);
-
-        // Descriptor
-        cv::Mat descriptors;
-        descriptors = descriptor.getDescriptor(frame,keypoints);
-
-        // Show frame with features
-        detector.drawKeyFeatures(frame, keypoints);
-
-        std::cout << "\e[A" <<
-        		"Detection time: " << detector.getTime() << "    " <<
-				"Description time: " << descriptor.getTime() << "    " <<
-        		"TOTAL time: " << detector.getTime() + descriptor.getTime() << std::endl;
-
-        // Show NEW frame
-        cv::imshow("Detections", frame);
-        cv::waitKey(1);
-        // if (cv::waitKey(30) >= 0) break;
-    }
-
-    cv::destroyAllWindows();
-}
-
-
-
diff --git a/src/examples/feature_detect_descript_match.cpp b/src/examples/feature_detect_descript_match.cpp
deleted file mode 100644
index b027293..0000000
--- a/src/examples/feature_detect_descript_match.cpp
+++ /dev/null
@@ -1,201 +0,0 @@
-// OWN stuff
-#include <string>
-
-#include <sstream>
-#include "../vision_utils.h"
-
-int main(int argc, char *argv[])
-{
-    std::cout << "-------------------------------------------------------------------" << std::endl;
-    std::cout << "|       Feature detectors, descriptors and matchers example       |" << std::endl;
-    std::cout << "-------------------------------------------------------------------" << std::endl;
-    std::cout << std::endl;
-
-    //***********
-     // Detector |
-     //***********
-
-     FeatureDetector detector;
-     DetectorParams detector_params; // TODO: Fill parameters
-
-     std::vector<std::string> detectors_list;
-     detectors_list = detector.list();
-
-     for (unsigned int ii=0; ii<detectors_list.size(); ii++)
-     {
-     	if ( (detectors_list[ii].compare("LSD")!=0) && (detectors_list[ii].compare("ED")!=0) )
-     		std::cout << "[" << ii << "]: " << detectors_list[ii] << std::endl;
-     }
-
-     // Get default value
-     int feat_type;
-     detector.get(feat_type);
-
-     std::cout << std::endl << "Which DETECTOR do you want to test?[default: " <<  detectors_list[feat_type] << "]";
-
-//     feat_type = readFromUser(feat_type);
-
-     detector.set(detectors_list[feat_type],detector_params);
-
-     //*************
-     // Descriptor |
-     //*************
-
-     FeatureDescriptor descriptor;
-     DescriptorParams descriptor_params; // TODO: Fill parameters
-
-     std::vector<std::string> descriptor_list;
-     descriptor_list = descriptor.list();
-
-     for (unsigned int ii=0; ii<descriptor_list.size(); ii++)
-         std::cout << "[" << ii << "]: " << descriptor_list[ii] << std::endl;
-
-     // Get default value
-     int desc_type;
-     descriptor.get(desc_type);
-
-     std::cout << std::endl << "Which DESCRIPTOR do you want to test?[default: " <<  descriptor_list[desc_type] << "]" << std::endl;
-
-//     desc_type = readFromUser(desc_type);
-
-     descriptor.set(descriptor_list[desc_type],descriptor_params);
-
-     //**********
-     // Matcher |
-     //**********
-
-     FeatureMatcher matcher;
-     MatcherParams matcher_params; // TODO: Fill parameters
-     MatcherParams matcher_search_params; // TODO: Fill parameters
-
-     std::vector<std::string> matchers_list;
-     matchers_list = matcher.list();
-
-     for (unsigned int ii=0; ii<matchers_list.size(); ii++)
-    	 std::cout << "[" << ii << "]: " << matchers_list[ii] << std::endl;
-
-     // Get default value
-     int match_type;
-     matcher.get(match_type);
-
-     std::cout << std::endl << "Which MATCHER do you want to test?[default: " <<  matchers_list[match_type] << "]" << std::endl;
-
-//     match_type = readFromUser(match_type);
-
-     matcher.set(matchers_list[match_type],matcher_params);
-
-     std::vector<std::string> matchers_search_list;
-     matchers_search_list = matcher.listSearchTypes();
-
-     for (unsigned int ii=0; ii<matchers_search_list.size(); ii++)
-    	 std::cout << "[" << ii << "]: " << matchers_search_list[ii] << std::endl;
-
-     // Get default value
-     int match_search_type;
-     matcher.getSearchType(match_search_type);
-
-     std::cout << std::endl << "Which MATCHER SEARCH do you want to test?[default: " <<  matchers_search_list[match_search_type] << "]" << std::endl;
-
-//     match_search_type = readFromUser(match_search_type);
-
-     matcher.setSearchType(matchers_search_list[match_search_type],matcher_search_params);
-
-     std::cout << std::endl << "Testing: " << detectors_list[feat_type] << " + " << descriptor_list[desc_type] << " + " << matchers_list[match_type] << " + " << matchers_search_list[match_search_type] << " (DETECTOR + DESCRIPTOR + MATCHER + MATCHER SEARCH)" << std::endl;
-
-     // *****************************
-
-     // Open camera
-     cv::VideoCapture cam;
-     CamUtils cam_fc;
-     cam_fc.openCamera(0, cam);
-
-     // Create displays
-     cv::startWindowThread();
-     cv::namedWindow("Original image", cv::WINDOW_NORMAL);
-     cv::namedWindow("Detections", cv::WINDOW_NORMAL);
-     cv::namedWindow("Matches", cv::WINDOW_NORMAL);
-
-     cv::Mat frame_old;
-     KeyPointVector keypoints_old;
-     KeyPointVector good_keypoints;
-     cv::Mat descriptors_old;
-     std::vector<cv::DMatch> good_matches;
-
-     // The following line is used to remove the OpenCV "init done" from the terminal
-     std::cout << "\e[A" << "         " << std::endl;
-
-     for (int nframe = 0; nframe < 1000; ++nframe)
-     {
-        // Get frame
-    	cv::Mat frame;
-        cam_fc.getFrame(cam, frame);
-        cv::Mat frame_matches = frame.clone();
-
-        // Show ORIGINAL frame
-        cv::imshow("Original image", frame);
-
-		// Detector
-        KeyPointVector keypoints;
-        keypoints = detector.detectKeyPoints(frame);
-
-        // Descriptor
-        cv::Mat descriptors;
-        descriptors = descriptor.getDescriptor(frame,keypoints);
-
-        // Matcher
-        if  (nframe > 1)
-        {
-        	// TODO: Implement this object creation depending on user preferences
-        	//     if (matchers_search_list[match_search_type].compare("Match") == 0)
-        	//    	 std::vector<cv::DMatch> matches;
-        	//     else
-        	std::vector< std::vector<cv::DMatch> > matches;
-        	matcher.match(descriptors,descriptors_old,matches);
-
-        	// Filter matches
-        	good_matches.clear();
-        	good_keypoints.clear();
-        	matcher.filterMatches(keypoints_old, keypoints, matches, frame.rows, frame.cols, good_matches, good_keypoints);
-        }
-
-        // Update objects
-        keypoints_old.clear();
-        keypoints_old.resize(keypoints.size());
-        for (unsigned int ii = 0; ii < keypoints.size(); ++ii)
-        	keypoints_old.push_back(keypoints[ii]);
-        descriptors_old = cv::Mat(descriptors.size(),descriptors.type());
-        descriptors_old = descriptors.clone();
-        frame_old = frame;
-
-        // Show frame with features
-        detector.drawKeyFeatures(frame, keypoints);
-
-        // Draw matches
-        if  (nframe > 1 && !keypoints_old.empty() && !keypoints.empty())
-        {
-        	matcher.drawKeyFeatures(frame_matches, good_keypoints);
-//        	cv::drawMatches( frame_old, keypoints_old, frame, keypoints,
-//        			good_matches, frame_matches, cv::Scalar::all(-1), cv::Scalar::all(-1),
-//					std::vector<char>(), cv::DrawMatchesFlags::NOT_DRAW_SINGLE_POINTS );
-        	for (unsigned int ii = 0; ii < good_keypoints.size(); ++ii)
-        		cv::line(frame_matches,good_keypoints[ii].pt,good_keypoints[ii].pt,cv::Scalar(0,255,0),3);
-        	cv::imshow("Matches", frame_matches);
-        }
-
-        // Show NEW frame
-        cv::imshow("Detections", frame);
-        cv::waitKey(1);
-        // if (cv::waitKey(30) >= 0) break;
-
-        std::cout << "\e[A" <<
-        		"Detection time: " << detector.getTime() << "    " <<
-				"Description time: " << descriptor.getTime() << "    " <<
-				"Match time: " << matcher.getTime() << "    " <<
-        		"TOTAL time: " << detector.getTime() + descriptor.getTime() << std::endl;
-     }
-
-    cv::destroyAllWindows();
-}
-
-
-
diff --git a/src/examples/test_matcher.cpp b/src/examples/test_matcher.cpp
index 18e09bf..172f4e5 100644
--- a/src/examples/test_matcher.cpp
+++ b/src/examples/test_matcher.cpp
@@ -176,7 +176,17 @@ int main(void)
 
         	if (mat_params_ptr->match_type == MATCH)
         	{
+            	good_matches.clear();
+            	good_keypoints.clear();
+
             	mat_ptr->match(descriptors,descriptors_old,good_matches);
+
+        		for (size_t ii = 0; ii < good_matches.size(); ++ii)
+        		{
+       				cv::Point2f point = keypoints[good_matches[ii].trainIdx].pt;
+       				cv::KeyPoint kpt = cv::KeyPoint(point,1);
+       				good_keypoints.push_back(kpt);
+            	}
         	}
         	else
         	{
@@ -185,7 +195,7 @@ int main(void)
 
             	good_matches.clear();
             	good_keypoints.clear();
-            	mat_ptr->filterByDistance(0.25,keypoints_old, keypoints, matches, frame.rows, frame.cols, good_matches, good_keypoints);
+            	mat_ptr->filterByDistance(1.0,keypoints_old, keypoints, matches, frame.rows, frame.cols, good_matches, good_keypoints);
         	}
 
             // Draw matches
diff --git a/src/feature_matcher/feature_matcher.cpp b/src/feature_matcher/feature_matcher.cpp
deleted file mode 100644
index a8251e3..0000000
--- a/src/feature_matcher/feature_matcher.cpp
+++ /dev/null
@@ -1,195 +0,0 @@
-#include "feature_matcher.h"
-
-FeatureMatcher::FeatureMatcher(const std::string& _type, const std::string& _match_out_type, const MatcherParams& _params)
-{
-    setAllTypes();
-
-    //is_init_ = init(_type, _params);
-
-    if (!is_init_)
-    {
-        std::cerr << "[Feature Matcher]: Something went wrong during initialization! Feature Matcher not initialized."
-                << std::endl;
-    }
-}
-
-FeatureMatcher::FeatureMatcher(void)
-{
-    setAllTypes();
-}
-
-FeatureMatcher::~FeatureMatcher(void)
-{
-}
-
-void FeatureMatcher::setAllTypes(void)
-{
-    // Define all types
-    std::vector<std::string> types;
-    types += "FlannBased", "BruteForce", "BruteForce-L1", "BruteForce-Hamming", "BruteForce-Hamming(2)";
-    types_.set(types);
-    type_ = "BruteForce"; // Default value
-
-    // Define all match output variants
-    std::vector<std::string> out_types;
-    out_types += "Match", "knnMatch", "radiusMatch";
-    match_search_types_.set(out_types);
-    match_search_type_ = "knnMatch"; // Default value
-}
-
-std::vector<std::string> FeatureMatcher::listSearchTypes(void)
-{
-	return match_search_types_.list();
-}
-
-void FeatureMatcher::getSearchType(int& _type)
-{
-	_type = match_search_types_(match_search_type_);
-}
-
-void FeatureMatcher::getSearchType(std::string& _type)
-{
-	_type = match_search_type_;
-}
-
-bool FeatureMatcher::setSearchType(const std::string& _type, const MatcherParams& _params)
-{
-    // TODO: Set parameters for each matcher type
-    for (unsigned int ii = 0; ii < match_search_types_.size(); ++ii)
-    {
-    	if (_type.compare(match_search_types_(ii))==0)
-    	{
-    	    	match_search_type_ = _type;
-    	    	match_search_params_ = _params;
-    	    	return true;
-    	}
-    }
-
-    std::cerr << "[Feature Matcher]: matcher output type " << _type << " doesn't exist !" << std::endl;
-    return false;
-}
-
-
-bool FeatureMatcher::init(const std::string& _type, const MatcherParams& _params)
-{
-    if (is_init_)
-    {
-        std::cerr
-                << "[FeatureMatcher::init]: Matcher already initialized."
-                << std::endl;
-        return false;
-    }
-
-    std::cout << _type << std::endl;
-
-
-    // TODO: Set parameters for each matcher type
-    if (_type.compare(types_(0))==0)
-    {
-        feature_matcher_ = cv::DescriptorMatcher::create(_type);
-        type_ = types_(0);
-    }
-    else if (_type.compare(types_(1))==0)
-    {
-        feature_matcher_ = cv::DescriptorMatcher::create(_type);
-        type_ = types_(1);
-    }
-    else if (_type.compare(types_(2))==0)
-    {
-        feature_matcher_ = cv::DescriptorMatcher::create(_type);
-        type_ = types_(2);
-    }
-    else if (_type.compare(types_(3))==0)
-    {
-        feature_matcher_ = cv::DescriptorMatcher::create(_type);
-        type_ = types_(3);
-    }
-    else if (_type.compare(types_(4))==0)
-    {
-        feature_matcher_ = cv::DescriptorMatcher::create(_type);
-        type_ = types_(4);
-    }
-    else
-    {
-        std::cerr << "[Feature Matcher]: mathcer_type " << _type << " doesn't exist !" << std::endl;
-        return false;
-    }
-
-    is_init_ = true;
-    return true;
-}
-
-// TODO: Match features and process matches (e.g. https://github.com/kipr/opencv/blob/master/samples/cpp/detector_descriptor_matcher_evaluation.cpp)
-void FeatureMatcher::match(const cv::Mat& _desc1, const cv::Mat& _desc2, std::vector<cv::DMatch>& matches)
-{
-	std::cout << __LINE__ << std::endl;
-    if (!is_init_)
-        std::cerr << "[FeatureMatcher::match]: Matcher non initialized." << std::endl;
-
-    if (match_search_type_.compare(match_search_types_(0))==0)
-    {
-    	clock_t tStart = clock();
-    	// TODO: use parameters related with the search type (match_search_params_)
-    	std::cout << __LINE__ << " " << _desc1.size() << " " << _desc2.size() << std::endl;
-    	if (!_desc1.empty() && !_desc2.empty())
-    		feature_matcher_->match( _desc1, _desc2, matches);
-    	comp_time_ = (double)(clock() - tStart) / CLOCKS_PER_SEC;
-    }
-    else
-    	std::cerr << "[FeatureMatcher::match]: The selected matcher output is different than your object." << std::endl;
-}
-
-// TODO: Match features and process matches (e.g. https://github.com/kipr/opencv/blob/master/samples/cpp/detector_descriptor_matcher_evaluation.cpp)
-void FeatureMatcher::match(const cv::Mat& _desc1, const cv::Mat& _desc2, std::vector< std::vector<cv::DMatch> >& matches)
-{
-    if (!is_init_)
-        std::cerr << "[FeatureMatcher::match]: Matcher non initialized." << std::endl;
-
-    if (match_search_type_.compare(match_search_types_(1))==0)// knn match
-    {
-    	clock_t tStart = clock();
-    	// TODO: use parameters related with the search type (match_search_params_)
-    	if (!_desc1.empty() && !_desc2.empty())
-    		feature_matcher_->knnMatch(_desc1, _desc2, matches, 2);
-    	comp_time_ = (double)(clock() - tStart) / CLOCKS_PER_SEC;
-    }
-    else if (match_search_type_.compare(match_search_types_(2))==0) // radius match
-	{
-    	clock_t tStart = clock();
-    	// TODO: use parameters related with the search type (match_search_params_)
-    	if (!_desc1.empty() && !_desc2.empty())
-    		feature_matcher_->radiusMatch(_desc1, _desc2, matches, 2);
-    	comp_time_ = (double)(clock() - tStart) / CLOCKS_PER_SEC;
-	}
-    else
-    	std::cerr << "[FeatureMatcher::match]: The selected matcher output is different than your object." << std::endl;
-}
-
-void FeatureMatcher::filterMatches(const KeyPointVector& _kpts1,const KeyPointVector& _kpts2, const std::vector< std::vector<cv::DMatch> >& _dirty, const int& _img_width, const int& _img_height, std::vector<cv::DMatch>& _filtered_matches, KeyPointVector& _filtered_kpts)
-{
-	//only 25% of maximum of possible distance
-	double tresholdDist = 0.25 * sqrt(double(_img_height*_img_height + _img_width*_img_width));
-
-	std::vector< cv::DMatch > good_matches2;
-	_filtered_matches.reserve(_dirty.size());
-	for (size_t ii = 0; ii < _dirty.size(); ++ii)
-	{
-	    for (unsigned int jj = 0; jj < _dirty[ii].size(); jj++)
-	    {
-	        cv::Point2f from = _kpts1[_dirty[ii][jj].queryIdx].pt;
-	        cv::Point2f to = _kpts2[_dirty[ii][jj].trainIdx].pt;
-
-	        //calculate local distance for each possible match
-	        double dist = std::sqrt((from.x - to.x) * (from.x - to.x) + (from.y - to.y) * (from.y - to.y));
-
-	        //save as best match if local distance is in specified area and on same height
-	        if (dist < tresholdDist && std::abs(from.y-to.y)<5)
-	        {
-	        	_filtered_matches.push_back(_dirty[ii][jj]);
-	        	cv::KeyPoint kpt = cv::KeyPoint(to,1);
-	        	_filtered_kpts.push_back(kpt);
-	            jj = _dirty[ii].size();
-	        }
-	    }
-	}
-}
diff --git a/src/feature_matcher/feature_matcher.h b/src/feature_matcher/feature_matcher.h
deleted file mode 100644
index 96493c7..0000000
--- a/src/feature_matcher/feature_matcher.h
+++ /dev/null
@@ -1,81 +0,0 @@
-#ifndef _FEATURE_MATCHER_H
-#define _FEATURE_MATCHER_H
-
-#include "../vision_utils.h"
-
-typedef cv::Ptr<cv::DescriptorMatcher> FeatureMatcherPtr;
-
-/**
- * \brief Feature descriptor parameters class
- */
-class MatcherParams: public ParamsBase {
-public:
-    MatcherParams(void) {
-    }
-    ;
-    ~MatcherParams(void) {
-    }
-    ;
-};
-
-class FeatureMatcher: public VUBase
-{
-    public:
-
-        FeatureMatcher(const std::string& _type, const std::string& _match_out_type, const MatcherParams& _params);
-        FeatureMatcher(void);
-
-        ~FeatureMatcher(void);
-
-        /**
-         * \brief list all possible match output types (All, K nearest, in a radius search, ...)
-         */
-        std::vector<std::string> listSearchTypes(void);
-
-        /**
-         * \brief Set matcher search method
-         */
-        bool setSearchType(const std::string& _type, const MatcherParams& _params);
-
-        /**
-         * \brief Get matcher search method
-         */
-        void getSearchType(int& _type);
-        void getSearchType(std::string& _type);
-        /**
-         * \brief Find Matches
-         */
-        void match(const cv::Mat& _desc1, const cv::Mat& _desc2, std::vector<cv::DMatch>& matches);
-
-        /**
-         * \brief Find K best matches or matches in a radius (depending on selected match_search_type_)
-         */
-        void match(const cv::Mat& _desc1, const cv::Mat& _desc2, std::vector< std::vector<cv::DMatch> >& matches);
-
-        /**
-         * \brief 	Look whether the match is inside a defined area of the image
-         *
-         * 			From https://stackoverflow.com/questions/17967950/improve-matching-of-feature-points-with-opencv
-         */
-        void filterMatches(const KeyPointVector& _kpts1,const KeyPointVector& _kpts2, const std::vector< std::vector<cv::DMatch> >& _dirty, const int& _img_width, const int& _img_height, std::vector<cv::DMatch>& _filtered_matches, KeyPointVector& _filtered_kpts);
-
-    private:
-
-        FeatureMatcherPtr feature_matcher_; // Feature matcher
-
-        TypesList match_search_types_; // Match type (match with all, knn and radius search).
-        MatcherParams match_search_params_; // Search type parameters.
-        std::string match_search_type_; // Match type (match with all, knn and radius search).
-
-        /**
-         * \brief Set all types
-         */
-        void setAllTypes(void);
-
-        /**
-         * \brief Initialize matcher
-         */
-        bool init(const std::string &_type, const MatcherParams &_params);
-};
-
-#endif
diff --git a/src/matchers/matcher_base.cpp b/src/matchers/matcher_base.cpp
index 4e40a6b..e7a29e1 100644
--- a/src/matchers/matcher_base.cpp
+++ b/src/matchers/matcher_base.cpp
@@ -67,11 +67,11 @@ void MatcherBase::match(const cv::Mat& _desc1, const cv::Mat& _desc2, std::vecto
     	std::cerr << "[" << name_ << "]:Wrong match type or output object." << std::endl;
 }
 
-void MatcherBase::filterByDistance(const int& _percentage, const KeyPointVector& _kpts1,const KeyPointVector& _kpts2, const std::vector< std::vector<cv::DMatch> >& _dirty, const int& _img_width, const int& _img_height, std::vector<cv::DMatch>& _filtered_matches, KeyPointVector& _filtered_kpts)
+void MatcherBase::filterByDistance(const float& _percentage, const KeyPointVector& _kpts1,const KeyPointVector& _kpts2, const std::vector< std::vector<cv::DMatch> >& _dirty, const int& _img_width, const int& _img_height, std::vector<cv::DMatch>& _filtered_matches, KeyPointVector& _filtered_kpts)
 {
 	if (params_base_ptr_->match_type == KNNMATCH || params_base_ptr_->match_type == RADIUSMATCH)
 	{
-		double tresholdDist = (_percentage/100) * sqrt(double(_img_height*_img_height + _img_width*_img_width));
+		double tresholdDist = _percentage * sqrt(double(_img_height*_img_height + _img_width*_img_width));
 
 		std::vector< cv::DMatch > good_matches2;
 		_filtered_matches.reserve(_dirty.size());
diff --git a/src/matchers/matcher_base.h b/src/matchers/matcher_base.h
index c41acbd..3b9678b 100644
--- a/src/matchers/matcher_base.h
+++ b/src/matchers/matcher_base.h
@@ -63,7 +63,7 @@ class MatcherBase : public VUBase, public std::enable_shared_from_this<MatcherBa
 
         MatcherParamsBasePtr getParams(void);
 
-        void filterByDistance(const int& _percentage, const KeyPointVector& _kpts1,const KeyPointVector& _kpts2, const std::vector< std::vector<cv::DMatch> >& _dirty, const int& _img_width, const int& _img_height, std::vector<cv::DMatch>& _filtered_matches, KeyPointVector& _filtered_kpts);
+        void filterByDistance(const float& _percentage, const KeyPointVector& _kpts1,const KeyPointVector& _kpts2, const std::vector< std::vector<cv::DMatch> >& _dirty, const int& _img_width, const int& _img_height, std::vector<cv::DMatch>& _filtered_matches, KeyPointVector& _filtered_kpts);
 
         // Factory method
         static MatcherBasePtr create(const std::string& _unique_name, const ParamsBasePtr _params);
diff --git a/src/vision_utils.h b/src/vision_utils.h
index 435415e..8b962d6 100644
--- a/src/vision_utils.h
+++ b/src/vision_utils.h
@@ -1,7 +1,7 @@
 #ifndef _VU_UTILS_H
 #define _VU_UTILS_H
 
-#include "internal/config.h"
+#include "_internal/config.h"
 
 // std
 #include <functional>
-- 
GitLab