From f3ef6cadb70dbfba5e614c4684a59cdddaa0821a Mon Sep 17 00:00:00 2001
From: asantamaria <asantamaria@iri.upc.edu>
Date: Thu, 21 Sep 2017 11:04:20 +0200
Subject: [PATCH] FIX to work with RELEASE compilation

---
 CMakeLists.txt                                   |  5 +++--
 .../activesearch/alg_activesearch_load_yaml.cpp  |  2 +-
 src/algorithms/algorithm_factory.h               |  2 +-
 .../alg_opticalflowpyrlk_load_yaml.cpp           |  2 +-
 .../alg_trackfeatures_load_yaml.cpp              |  2 +-
 src/common_class/frame.h                         | 16 ++++++++--------
 .../akaze/descriptor_akaze_load_yaml.cpp         |  2 +-
 .../brief/descriptor_brief_load_yaml.cpp         |  2 +-
 .../brisk/descriptor_brisk_load_yaml.cpp         |  2 +-
 .../daisy/descriptor_daisy_load_yaml.cpp         |  2 +-
 src/descriptors/descriptor_factory.h             |  2 +-
 .../freak/descriptor_freak_load_yaml.cpp         |  2 +-
 .../kaze/descriptor_kaze_load_yaml.cpp           |  2 +-
 .../latch/descriptor_latch_load_yaml.cpp         |  2 +-
 .../lucid/descriptor_lucid_load_yaml.cpp         |  2 +-
 src/descriptors/orb/descriptor_orb_load_yaml.cpp |  2 +-
 .../sift/descriptor_sift_load_yaml.cpp           |  2 +-
 .../surf/descriptor_surf_load_yaml.cpp           |  2 +-
 src/detectors/agast/detector_agast_load_yaml.cpp |  2 +-
 src/detectors/akaze/detector_akaze_load_yaml.cpp |  2 +-
 src/detectors/brisk/detector_brisk_load_yaml.cpp |  2 +-
 src/detectors/detector_factory.h                 |  2 +-
 src/detectors/fast/detector_fast_load_yaml.cpp   |  2 +-
 src/detectors/gftt/detector_gftt_load_yaml.cpp   |  2 +-
 .../harris/detector_harris_load_yaml.cpp         |  2 +-
 src/detectors/kaze/detector_kaze_load_yaml.cpp   |  2 +-
 src/detectors/mser/detector_mser_load_yaml.cpp   |  2 +-
 src/detectors/orb/detector_orb_load_yaml.cpp     |  2 +-
 src/detectors/sbd/detector_sbd_load_yaml.cpp     |  2 +-
 src/detectors/sift/detector_sift_load_yaml.cpp   |  2 +-
 src/detectors/surf/detector_surf_load_yaml.cpp   |  2 +-
 src/examples/yaml/OPTFLOWPYRLK.yaml              |  8 ++++----
 src/factory.h                                    | 16 ++++++++++++++++
 .../bruteforce/matcher_bruteforce_load_yaml.cpp  |  2 +-
 .../matcher_bruteforce_hamming_load_yaml.cpp     |  2 +-
 .../matcher_bruteforce_hamming_2_load_yaml.cpp   |  2 +-
 .../matcher_bruteforce_l1_load_yaml.cpp          |  2 +-
 .../flannbased/matcher_flannbased_load_yaml.cpp  |  2 +-
 src/matchers/matcher_factory.h                   |  2 +-
 src/sensors/sensor_factory.h                     |  2 +-
 src/sensors/usb_cam/usb_cam_load_yaml.cpp        |  2 +-
 41 files changed, 68 insertions(+), 51 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a31fce8..93fe002 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,9 +15,10 @@ SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib)
 SET(CMAKE_INSTALL_PREFIX /usr/local)
 
 IF (NOT CMAKE_BUILD_TYPE)
- SET(CMAKE_BUILD_TYPE "DEBUG") 
+ SET(CMAKE_BUILD_TYPE "RELEASE") 
 ENDIF (NOT CMAKE_BUILD_TYPE)
-
+MESSAGE(STATUS "Compilation type: ${CMAKE_BUILD_TYPE}")
+ 
 if(UNIX)
   # GCC is not strict enough by default, so enable most of the warnings.
   set(CMAKE_CXX_FLAGS
diff --git a/src/algorithms/activesearch/alg_activesearch_load_yaml.cpp b/src/algorithms/activesearch/alg_activesearch_load_yaml.cpp
index 7453e91..c09c417 100644
--- a/src/algorithms/activesearch/alg_activesearch_load_yaml.cpp
+++ b/src/algorithms/activesearch/alg_activesearch_load_yaml.cpp
@@ -43,7 +43,7 @@ static ParamsBasePtr createParamsACTIVESEARCHAlgorithm(const std::string & _file
 }
 
 // Register in the SensorFactory
-const bool registered_matACTIVESEARCH_params = ParamsFactory::get().registerCreator("ACTIVESEARCH ALG", createParamsACTIVESEARCHAlgorithm);
+const bool VU_UNUSED registered_matACTIVESEARCH_params = ParamsFactory::get().registerCreator("ACTIVESEARCH ALG", createParamsACTIVESEARCHAlgorithm);
 
 } /* namespace [unnamed] */
 
diff --git a/src/algorithms/algorithm_factory.h b/src/algorithms/algorithm_factory.h
index c626bfd..9bcaf4b 100644
--- a/src/algorithms/algorithm_factory.h
+++ b/src/algorithms/algorithm_factory.h
@@ -24,7 +24,7 @@ inline std::string AlgorithmFactory::getClass()
 }
 
 #define VU_REGISTER_ALGORITHM(AlgorithmType, AlgorithmName) \
-  namespace{ const bool AlgorithmName##Registered = \
+  namespace{ const bool VU_UNUSED AlgorithmName##Registered = \
 	AlgorithmFactory::get().registerCreator(AlgorithmType, AlgorithmName::create, true); }\
 
 } /* namespace vision_utils */
diff --git a/src/algorithms/opticalflowpyrlk/alg_opticalflowpyrlk_load_yaml.cpp b/src/algorithms/opticalflowpyrlk/alg_opticalflowpyrlk_load_yaml.cpp
index 1712847..1da5d9c 100644
--- a/src/algorithms/opticalflowpyrlk/alg_opticalflowpyrlk_load_yaml.cpp
+++ b/src/algorithms/opticalflowpyrlk/alg_opticalflowpyrlk_load_yaml.cpp
@@ -45,7 +45,7 @@ static ParamsBasePtr createParamsOPTFLOWPYRLKAlgorithm(const std::string & _file
 }
 
 // Register in the SensorFactory
-const bool registered_matOPTFLOWPYRLK_params = ParamsFactory::get().registerCreator("OPTFLOWPYRLK ALG", createParamsOPTFLOWPYRLKAlgorithm);
+const bool VU_UNUSED registered_matOPTFLOWPYRLK_params = ParamsFactory::get().registerCreator("OPTFLOWPYRLK ALG", createParamsOPTFLOWPYRLKAlgorithm);
 
 } /* namespace [unnamed] */
 
diff --git a/src/algorithms/trackfeatures/alg_trackfeatures_load_yaml.cpp b/src/algorithms/trackfeatures/alg_trackfeatures_load_yaml.cpp
index cf4e4dd..d4fdc21 100644
--- a/src/algorithms/trackfeatures/alg_trackfeatures_load_yaml.cpp
+++ b/src/algorithms/trackfeatures/alg_trackfeatures_load_yaml.cpp
@@ -39,7 +39,7 @@ static ParamsBasePtr createParamsTRACKFEATURESAlgorithm(const std::string & _fil
 }
 
 // Register in the SensorFactory
-const bool registered_matTRACKFEATURES_params = ParamsFactory::get().registerCreator("TRACKFEATURES ALG", createParamsTRACKFEATURESAlgorithm);
+const bool VU_UNUSED registered_matTRACKFEATURES_params = ParamsFactory::get().registerCreator("TRACKFEATURES ALG", createParamsTRACKFEATURESAlgorithm);
 
 } /* namespace [unnamed] */
 
diff --git a/src/common_class/frame.h b/src/common_class/frame.h
index 7ca6957..0299fdc 100644
--- a/src/common_class/frame.h
+++ b/src/common_class/frame.h
@@ -51,7 +51,7 @@ public:
 	/**
 	 * \brief Return the image
 	 */
-	cv::Mat getImage(void);
+	const cv::Mat& getImage(void) const;
 
 	/**
 	 * \brief Set the image
@@ -61,7 +61,7 @@ public:
 	/**
 	 * \brief Return the frame Keypoints
 	 */
-	KeyPointVector getKeyPoints(void);
+	KeyPointVector& getKeyPoints(void);
 
 	/**
 	 * \brief Set the frame Keypoints
@@ -82,7 +82,7 @@ public:
 	/**
 	 * \brief Return the frame descriptors
 	 */
-	cv::Mat getDescriptors(void);
+	cv::Mat& getDescriptors(void);
 
 	/**
 	 * \brief Set the frame descriptors
@@ -111,7 +111,7 @@ inline void Frame::setId(const int& _id)
 	id_ = _id;
 }
 
-inline cv::Mat Frame::getImage(void)
+inline const cv::Mat& Frame::getImage(void) const
 {
 	return img_;
 }
@@ -121,7 +121,7 @@ inline void Frame::setImage(const cv::Mat& _img)
 	img_ = _img;
 }
 
-inline 	KeyPointVector Frame::getKeyPoints(void)
+inline KeyPointVector& Frame::getKeyPoints(void)
 {
 	return kps_;
 };
@@ -141,7 +141,7 @@ inline void Frame::addKeyPoints(const KeyPointVector& _kps)
 	kps_.insert(kps_.end(), _kps.begin(), _kps.end() );
 }
 
-inline 	PointVector Frame::getPoints(void)
+inline PointVector Frame::getPoints(void)
 {
 	PointVector pvec;
 	for	(auto kp : kps_)
@@ -149,12 +149,12 @@ inline 	PointVector Frame::getPoints(void)
 	return pvec;
 };
 
-inline 	cv::Mat Frame::getDescriptors(void)
+inline cv::Mat& Frame::getDescriptors(void)
 {
 	return desc_;
 };
 
-inline 	void Frame::setDescriptors(const cv::Mat& _desc)
+inline void Frame::setDescriptors(const cv::Mat& _desc)
 {
 	assert( kps_.size() == _desc.rows && "The Number of descriptors must be equal to number of keypoints");
 	desc_ = _desc;
diff --git a/src/descriptors/akaze/descriptor_akaze_load_yaml.cpp b/src/descriptors/akaze/descriptor_akaze_load_yaml.cpp
index 043ceb0..918a983 100644
--- a/src/descriptors/akaze/descriptor_akaze_load_yaml.cpp
+++ b/src/descriptors/akaze/descriptor_akaze_load_yaml.cpp
@@ -41,7 +41,7 @@ static ParamsBasePtr createParamsAKAZEDescriptor(const std::string & _filename_d
 }
 
 // Register in the SensorFactory
-const bool registered_desAKAZE_params = ParamsFactory::get().registerCreator("AKAZE DES", createParamsAKAZEDescriptor);
+const bool VU_UNUSED registered_desAKAZE_params = ParamsFactory::get().registerCreator("AKAZE DES", createParamsAKAZEDescriptor);
 
 } /* namespace [unnamed] */
 
diff --git a/src/descriptors/brief/descriptor_brief_load_yaml.cpp b/src/descriptors/brief/descriptor_brief_load_yaml.cpp
index 6e79ed4..a27e309 100644
--- a/src/descriptors/brief/descriptor_brief_load_yaml.cpp
+++ b/src/descriptors/brief/descriptor_brief_load_yaml.cpp
@@ -36,7 +36,7 @@ static ParamsBasePtr createParamsBRIEFDescriptor(const std::string & _filename_d
 }
 
 // Register in the SensorFactory
-const bool registered_desBRIEF_params = ParamsFactory::get().registerCreator("BRIEF DES", createParamsBRIEFDescriptor);
+const bool VU_UNUSED registered_desBRIEF_params = ParamsFactory::get().registerCreator("BRIEF DES", createParamsBRIEFDescriptor);
 
 } /* namespace [unnamed] */
 
diff --git a/src/descriptors/brisk/descriptor_brisk_load_yaml.cpp b/src/descriptors/brisk/descriptor_brisk_load_yaml.cpp
index 394084b..a234283 100644
--- a/src/descriptors/brisk/descriptor_brisk_load_yaml.cpp
+++ b/src/descriptors/brisk/descriptor_brisk_load_yaml.cpp
@@ -37,7 +37,7 @@ static ParamsBasePtr createParamsBRISKDescriptor(const std::string & _filename_d
 }
 
 // Register in the SensorFactory
-const bool registered_desBRISK_params = ParamsFactory::get().registerCreator("BRISK DES", createParamsBRISKDescriptor);
+const bool VU_UNUSED registered_desBRISK_params = ParamsFactory::get().registerCreator("BRISK DES", createParamsBRISKDescriptor);
 
 } /* namespace [unnamed] */
 
diff --git a/src/descriptors/daisy/descriptor_daisy_load_yaml.cpp b/src/descriptors/daisy/descriptor_daisy_load_yaml.cpp
index b714a9e..b449fcf 100644
--- a/src/descriptors/daisy/descriptor_daisy_load_yaml.cpp
+++ b/src/descriptors/daisy/descriptor_daisy_load_yaml.cpp
@@ -43,7 +43,7 @@ static ParamsBasePtr createParamsDAISYDescriptor(const std::string & _filename_d
 }
 
 // Register in the SensorFactory
-const bool registered_desDAISY_params = ParamsFactory::get().registerCreator("DAISY DES", createParamsDAISYDescriptor);
+const bool VU_UNUSED registered_desDAISY_params = ParamsFactory::get().registerCreator("DAISY DES", createParamsDAISYDescriptor);
 
 } /* namespace [unnamed] */
 
diff --git a/src/descriptors/descriptor_factory.h b/src/descriptors/descriptor_factory.h
index 7ecec9c..c2f1553 100644
--- a/src/descriptors/descriptor_factory.h
+++ b/src/descriptors/descriptor_factory.h
@@ -24,7 +24,7 @@ inline std::string DescriptorFactory::getClass()
 }
 
 #define VU_REGISTER_DESCRIPTOR(DescriptorType, DescriptorName) \
-  namespace{ const bool DescriptorName##Registered = \
+  namespace{ const bool VU_UNUSED DescriptorName##Registered = \
 	DescriptorFactory::get().registerCreator(DescriptorType, DescriptorName::create, true); }\
 
 } /* namespace vision_utils */
diff --git a/src/descriptors/freak/descriptor_freak_load_yaml.cpp b/src/descriptors/freak/descriptor_freak_load_yaml.cpp
index 08a869e..35c5cb8 100644
--- a/src/descriptors/freak/descriptor_freak_load_yaml.cpp
+++ b/src/descriptors/freak/descriptor_freak_load_yaml.cpp
@@ -39,7 +39,7 @@ static ParamsBasePtr createParamsFREAKDescriptor(const std::string & _filename_d
 }
 
 // Register in the SensorFactory
-const bool registered_desFREAK_params = ParamsFactory::get().registerCreator("FREAK DES", createParamsFREAKDescriptor);
+const bool VU_UNUSED registered_desFREAK_params = ParamsFactory::get().registerCreator("FREAK DES", createParamsFREAKDescriptor);
 
 } /* namespace [unnamed] */
 
diff --git a/src/descriptors/kaze/descriptor_kaze_load_yaml.cpp b/src/descriptors/kaze/descriptor_kaze_load_yaml.cpp
index 63fd5ed..29c12af 100644
--- a/src/descriptors/kaze/descriptor_kaze_load_yaml.cpp
+++ b/src/descriptors/kaze/descriptor_kaze_load_yaml.cpp
@@ -40,7 +40,7 @@ static ParamsBasePtr createParamsKAZEDescriptor(const std::string & _filename_do
 }
 
 // Register in the SensorFactory
-const bool registered_desKAZE_params = ParamsFactory::get().registerCreator("KAZE DES", createParamsKAZEDescriptor);
+const bool VU_UNUSED registered_desKAZE_params = ParamsFactory::get().registerCreator("KAZE DES", createParamsKAZEDescriptor);
 
 } /* namespace [unnamed] */
 
diff --git a/src/descriptors/latch/descriptor_latch_load_yaml.cpp b/src/descriptors/latch/descriptor_latch_load_yaml.cpp
index b79dd9f..940981b 100644
--- a/src/descriptors/latch/descriptor_latch_load_yaml.cpp
+++ b/src/descriptors/latch/descriptor_latch_load_yaml.cpp
@@ -38,7 +38,7 @@ static ParamsBasePtr createParamsLATCHDescriptor(const std::string & _filename_d
 }
 
 // Register in the SensorFactory
-const bool registered_desLATCH_params = ParamsFactory::get().registerCreator("LATCH DES", createParamsLATCHDescriptor);
+const bool VU_UNUSED registered_desLATCH_params = ParamsFactory::get().registerCreator("LATCH DES", createParamsLATCHDescriptor);
 
 } /* namespace [unnamed] */
 
diff --git a/src/descriptors/lucid/descriptor_lucid_load_yaml.cpp b/src/descriptors/lucid/descriptor_lucid_load_yaml.cpp
index 50de9f1..3e2d9a9 100644
--- a/src/descriptors/lucid/descriptor_lucid_load_yaml.cpp
+++ b/src/descriptors/lucid/descriptor_lucid_load_yaml.cpp
@@ -36,7 +36,7 @@ static ParamsBasePtr createParamsLUCIDDescriptor(const std::string & _filename_d
 }
 
 // Register in the SensorFactory
-const bool registered_desLUCID_params = ParamsFactory::get().registerCreator("LUCID DES", createParamsLUCIDDescriptor);
+const bool VU_UNUSED registered_desLUCID_params = ParamsFactory::get().registerCreator("LUCID DES", createParamsLUCIDDescriptor);
 
 } /* namespace [unnamed] */
 
diff --git a/src/descriptors/orb/descriptor_orb_load_yaml.cpp b/src/descriptors/orb/descriptor_orb_load_yaml.cpp
index 03b31f7..9567f75 100644
--- a/src/descriptors/orb/descriptor_orb_load_yaml.cpp
+++ b/src/descriptors/orb/descriptor_orb_load_yaml.cpp
@@ -42,7 +42,7 @@ static ParamsBasePtr createParamsORBDescriptor(const std::string & _filename_dot
 }
 
 // Register in the SensorFactory
-const bool registered_desORB_params = ParamsFactory::get().registerCreator("ORB DES", createParamsORBDescriptor);
+const bool VU_UNUSED registered_desORB_params = ParamsFactory::get().registerCreator("ORB DES", createParamsORBDescriptor);
 
 } /* namespace [unnamed] */
 
diff --git a/src/descriptors/sift/descriptor_sift_load_yaml.cpp b/src/descriptors/sift/descriptor_sift_load_yaml.cpp
index d18646e..5ef1577 100644
--- a/src/descriptors/sift/descriptor_sift_load_yaml.cpp
+++ b/src/descriptors/sift/descriptor_sift_load_yaml.cpp
@@ -39,7 +39,7 @@ static ParamsBasePtr createParamsSIFTDescriptor(const std::string & _filename_do
 }
 
 // Register in the SensorFactory
-const bool registered_desSIFT_params = ParamsFactory::get().registerCreator("SIFT DES", createParamsSIFTDescriptor);
+const bool VU_UNUSED registered_desSIFT_params = ParamsFactory::get().registerCreator("SIFT DES", createParamsSIFTDescriptor);
 
 } /* namespace [unnamed] */
 
diff --git a/src/descriptors/surf/descriptor_surf_load_yaml.cpp b/src/descriptors/surf/descriptor_surf_load_yaml.cpp
index 8cfb642..868c8b3 100644
--- a/src/descriptors/surf/descriptor_surf_load_yaml.cpp
+++ b/src/descriptors/surf/descriptor_surf_load_yaml.cpp
@@ -39,7 +39,7 @@ static ParamsBasePtr createParamsSURFDescriptor(const std::string & _filename_do
 }
 
 // Register in the SensorFactory
-const bool registered_desSURF_params = ParamsFactory::get().registerCreator("SURF DES", createParamsSURFDescriptor);
+const bool VU_UNUSED registered_desSURF_params = ParamsFactory::get().registerCreator("SURF DES", createParamsSURFDescriptor);
 
 } /* namespace [unnamed] */
 
diff --git a/src/detectors/agast/detector_agast_load_yaml.cpp b/src/detectors/agast/detector_agast_load_yaml.cpp
index e07e117..724ed9d 100644
--- a/src/detectors/agast/detector_agast_load_yaml.cpp
+++ b/src/detectors/agast/detector_agast_load_yaml.cpp
@@ -37,7 +37,7 @@ static ParamsBasePtr createParamsAGASTDetector(const std::string & _filename_dot
 }
 
 // Register in the SensorFactory
-const bool registered_detAGAST_params = ParamsFactory::get().registerCreator("AGAST DET", createParamsAGASTDetector);
+const bool VU_UNUSED registered_detAGAST_params = ParamsFactory::get().registerCreator("AGAST DET", createParamsAGASTDetector);
 
 } /* namespace [unnamed] */
 
diff --git a/src/detectors/akaze/detector_akaze_load_yaml.cpp b/src/detectors/akaze/detector_akaze_load_yaml.cpp
index 1f41c7c..87415c5 100644
--- a/src/detectors/akaze/detector_akaze_load_yaml.cpp
+++ b/src/detectors/akaze/detector_akaze_load_yaml.cpp
@@ -41,7 +41,7 @@ static ParamsBasePtr createParamsAKAZEDetector(const std::string & _filename_dot
 }
 
 // Register in the SensorFactory
-const bool registered_detAKAZE_params = ParamsFactory::get().registerCreator("AKAZE DET", createParamsAKAZEDetector);
+const bool VU_UNUSED registered_detAKAZE_params = ParamsFactory::get().registerCreator("AKAZE DET", createParamsAKAZEDetector);
 
 } /* namespace [unnamed] */
 
diff --git a/src/detectors/brisk/detector_brisk_load_yaml.cpp b/src/detectors/brisk/detector_brisk_load_yaml.cpp
index dd4317c..510adc0 100644
--- a/src/detectors/brisk/detector_brisk_load_yaml.cpp
+++ b/src/detectors/brisk/detector_brisk_load_yaml.cpp
@@ -37,7 +37,7 @@ static ParamsBasePtr createParamsBRISKDetector(const std::string & _filename_dot
 }
 
 // Register in the SensorFactory
-const bool registered_detBRISK_params = ParamsFactory::get().registerCreator("BRISK DET", createParamsBRISKDetector);
+const bool VU_UNUSED registered_detBRISK_params = ParamsFactory::get().registerCreator("BRISK DET", createParamsBRISKDetector);
 
 } /* namespace [unnamed] */
 
diff --git a/src/detectors/detector_factory.h b/src/detectors/detector_factory.h
index 6073115..d4fa93a 100644
--- a/src/detectors/detector_factory.h
+++ b/src/detectors/detector_factory.h
@@ -24,7 +24,7 @@ inline std::string DetectorFactory::getClass()
 }
 
 #define VU_REGISTER_DETECTOR(DetectorType, DetectorName) \
-  namespace{ const bool DetectorName##Registered = \
+  namespace{ const bool VU_UNUSED DetectorName##Registered = \
 	DetectorFactory::get().registerCreator(DetectorType, DetectorName::create, true); }\
 
 } /* namespace vision_utils */
diff --git a/src/detectors/fast/detector_fast_load_yaml.cpp b/src/detectors/fast/detector_fast_load_yaml.cpp
index 130e717..0d37956 100644
--- a/src/detectors/fast/detector_fast_load_yaml.cpp
+++ b/src/detectors/fast/detector_fast_load_yaml.cpp
@@ -37,7 +37,7 @@ static ParamsBasePtr createParamsFASTDetector(const std::string & _filename_dot_
 }
 
 // Register in the SensorFactory
-const bool registered_detfast_params = ParamsFactory::get().registerCreator("FAST DET", createParamsFASTDetector);
+const bool VU_UNUSED registered_detfast_params = ParamsFactory::get().registerCreator("FAST DET", createParamsFASTDetector);
 
 } /* namespace [unnamed] */
 
diff --git a/src/detectors/gftt/detector_gftt_load_yaml.cpp b/src/detectors/gftt/detector_gftt_load_yaml.cpp
index 1b09311..30b0586 100644
--- a/src/detectors/gftt/detector_gftt_load_yaml.cpp
+++ b/src/detectors/gftt/detector_gftt_load_yaml.cpp
@@ -39,7 +39,7 @@ static ParamsBasePtr createParamsGFTTDetector(const std::string & _filename_dot_
 }
 
 // Register in the SensorFactory
-const bool registered_detGFTT_params = ParamsFactory::get().registerCreator("GFTT DET", createParamsGFTTDetector);
+const bool VU_UNUSED registered_detGFTT_params = ParamsFactory::get().registerCreator("GFTT DET", createParamsGFTTDetector);
 
 } /* namespace [unnamed] */
 
diff --git a/src/detectors/harris/detector_harris_load_yaml.cpp b/src/detectors/harris/detector_harris_load_yaml.cpp
index 4112727..0952147 100644
--- a/src/detectors/harris/detector_harris_load_yaml.cpp
+++ b/src/detectors/harris/detector_harris_load_yaml.cpp
@@ -39,7 +39,7 @@ static ParamsBasePtr createParamsHARRISDetector(const std::string & _filename_do
 }
 
 // Register in the SensorFactory
-const bool registered_detHARRIS_params = ParamsFactory::get().registerCreator("HARRIS DET", createParamsHARRISDetector);
+const bool VU_UNUSED registered_detHARRIS_params = ParamsFactory::get().registerCreator("HARRIS DET", createParamsHARRISDetector);
 
 } /* namespace [unnamed] */
 
diff --git a/src/detectors/kaze/detector_kaze_load_yaml.cpp b/src/detectors/kaze/detector_kaze_load_yaml.cpp
index b53d642..687910a 100644
--- a/src/detectors/kaze/detector_kaze_load_yaml.cpp
+++ b/src/detectors/kaze/detector_kaze_load_yaml.cpp
@@ -40,7 +40,7 @@ static ParamsBasePtr createParamsKAZEDetector(const std::string & _filename_dot_
 }
 
 // Register in the SensorFactory
-const bool registered_detKAZE_params = ParamsFactory::get().registerCreator("KAZE DET", createParamsKAZEDetector);
+const bool VU_UNUSED registered_detKAZE_params = ParamsFactory::get().registerCreator("KAZE DET", createParamsKAZEDetector);
 
 } /* namespace [unnamed] */
 
diff --git a/src/detectors/mser/detector_mser_load_yaml.cpp b/src/detectors/mser/detector_mser_load_yaml.cpp
index bbe4960..6f6a892 100644
--- a/src/detectors/mser/detector_mser_load_yaml.cpp
+++ b/src/detectors/mser/detector_mser_load_yaml.cpp
@@ -43,7 +43,7 @@ static ParamsBasePtr createParamsMSERDetector(const std::string & _filename_dot_
 }
 
 // Register in the SensorFactory
-const bool registered_detMSER_params = ParamsFactory::get().registerCreator("MSER DET", createParamsMSERDetector);
+const bool VU_UNUSED registered_detMSER_params = ParamsFactory::get().registerCreator("MSER DET", createParamsMSERDetector);
 
 } /* namespace [unnamed] */
 
diff --git a/src/detectors/orb/detector_orb_load_yaml.cpp b/src/detectors/orb/detector_orb_load_yaml.cpp
index 84a5ba3..f8cd2dc 100644
--- a/src/detectors/orb/detector_orb_load_yaml.cpp
+++ b/src/detectors/orb/detector_orb_load_yaml.cpp
@@ -42,7 +42,7 @@ static ParamsBasePtr createParamsORBDetector(const std::string & _filename_dot_y
 }
 
 // Register in the SensorFactory
-const bool registered_detORB_params = ParamsFactory::get().registerCreator("ORB DET", createParamsORBDetector);
+const bool VU_UNUSED registered_detORB_params = ParamsFactory::get().registerCreator("ORB DET", createParamsORBDetector);
 
 } /* namespace [unnamed] */
 
diff --git a/src/detectors/sbd/detector_sbd_load_yaml.cpp b/src/detectors/sbd/detector_sbd_load_yaml.cpp
index c0abc69..8a8546a 100644
--- a/src/detectors/sbd/detector_sbd_load_yaml.cpp
+++ b/src/detectors/sbd/detector_sbd_load_yaml.cpp
@@ -57,7 +57,7 @@ static ParamsBasePtr createParamsSBDDetector(const std::string & _filename_dot_y
 }
 
 // Register in the SensorFactory
-const bool registered_detSBD_params = ParamsFactory::get().registerCreator("SBD DET", createParamsSBDDetector);
+const bool VU_UNUSED registered_detSBD_params = ParamsFactory::get().registerCreator("SBD DET", createParamsSBDDetector);
 
 } /* namespace [unnamed] */
 
diff --git a/src/detectors/sift/detector_sift_load_yaml.cpp b/src/detectors/sift/detector_sift_load_yaml.cpp
index 9e4f7b1..feb4cf5 100644
--- a/src/detectors/sift/detector_sift_load_yaml.cpp
+++ b/src/detectors/sift/detector_sift_load_yaml.cpp
@@ -39,7 +39,7 @@ static ParamsBasePtr createParamsSIFTDetector(const std::string & _filename_dot_
 }
 
 // Register in the SensorFactory
-const bool registered_detSIFT_params = ParamsFactory::get().registerCreator("SIFT DET", createParamsSIFTDetector);
+const bool VU_UNUSED registered_detSIFT_params = ParamsFactory::get().registerCreator("SIFT DET", createParamsSIFTDetector);
 
 } /* namespace [unnamed] */
 
diff --git a/src/detectors/surf/detector_surf_load_yaml.cpp b/src/detectors/surf/detector_surf_load_yaml.cpp
index 1cd84e8..1944efb 100644
--- a/src/detectors/surf/detector_surf_load_yaml.cpp
+++ b/src/detectors/surf/detector_surf_load_yaml.cpp
@@ -39,7 +39,7 @@ static ParamsBasePtr createParamsSURFDetector(const std::string & _filename_dot_
 }
 
 // Register in the SensorFactory
-const bool registered_detSURF_params = ParamsFactory::get().registerCreator("SURF DET", createParamsSURFDetector);
+const bool VU_UNUSED registered_detSURF_params = ParamsFactory::get().registerCreator("SURF DET", createParamsSURFDetector);
 
 } /* namespace [unnamed] */
 
diff --git a/src/examples/yaml/OPTFLOWPYRLK.yaml b/src/examples/yaml/OPTFLOWPYRLK.yaml
index 7c0d276..701b2e2 100644
--- a/src/examples/yaml/OPTFLOWPYRLK.yaml
+++ b/src/examples/yaml/OPTFLOWPYRLK.yaml
@@ -3,7 +3,7 @@ sensor:
 
 detector:
   type: "ORB"         
-  nfeatures: 100
+  nfeatures: 200
   scale factor: 1.2
   nlevels: 8
   edge threshold: 8   # 16
@@ -16,11 +16,11 @@ detector:
 algorithm:
   type: "OPTFLOWPYRLK" 
   draw results: true
-  min features to track: 5
-  window edge: 21
+  min features to track: 10
+  window edge: 30
   max level: 10
   criteria max count: 30
   criteria epsilon: 0.01
   flags: 0
   min eigen threshold: 1e-4    
-  min error kpt match: 4.0    
+  min error kpt match: 10.0    
diff --git a/src/factory.h b/src/factory.h
index 89930ae..92f552e 100644
--- a/src/factory.h
+++ b/src/factory.h
@@ -110,6 +110,22 @@ inline std::string ParamsFactory::getClass()
     return "Params Factory";
 }
 
+//#define UNUSED(x) (void)x;
+//#define UNUSED(x) (void)(sizeof((x), 0));
+
+#ifdef __GNUC__
+    #define VU_UNUSED __attribute__((used))
+#elif defined _MSC_VER
+    #pragma warning(disable: Cxxxxx)
+    #define VU_UNUSED
+#elif defined(__LCLINT__)
+# define VU_UNUSED /*@unused@*/
+#elif defined(__cplusplus)
+# define VU_UNUSED
+#else
+# define UNUSED(x) x
+#endif
+
 } /* namespace vision_utils */
 
 #endif
diff --git a/src/matchers/bruteforce/matcher_bruteforce_load_yaml.cpp b/src/matchers/bruteforce/matcher_bruteforce_load_yaml.cpp
index 1749c0f..2130029 100644
--- a/src/matchers/bruteforce/matcher_bruteforce_load_yaml.cpp
+++ b/src/matchers/bruteforce/matcher_bruteforce_load_yaml.cpp
@@ -36,7 +36,7 @@ static ParamsBasePtr createParamsBRUTEFORCEMatcher(const std::string & _filename
 }
 
 // Register in the SensorFactory
-const bool registered_matBRUTEFORCE_params = ParamsFactory::get().registerCreator("BRUTEFORCE MAT", createParamsBRUTEFORCEMatcher);
+const bool VU_UNUSED registered_matBRUTEFORCE_params = ParamsFactory::get().registerCreator("BRUTEFORCE MAT", createParamsBRUTEFORCEMatcher);
 
 } /* namespace [unnamed] */
 
diff --git a/src/matchers/bruteforce_hamming/matcher_bruteforce_hamming_load_yaml.cpp b/src/matchers/bruteforce_hamming/matcher_bruteforce_hamming_load_yaml.cpp
index cae5c2e..d3a3f1d 100644
--- a/src/matchers/bruteforce_hamming/matcher_bruteforce_hamming_load_yaml.cpp
+++ b/src/matchers/bruteforce_hamming/matcher_bruteforce_hamming_load_yaml.cpp
@@ -36,7 +36,7 @@ static ParamsBasePtr createParamsBRUTEFORCE_HAMMINGMatcher(const std::string & _
 }
 
 // Register in the SensorFactory
-const bool registered_matBRUTEFORCE_HAMMING_params = ParamsFactory::get().registerCreator("BRUTEFORCE_HAMMING MAT", createParamsBRUTEFORCE_HAMMINGMatcher);
+const bool VU_UNUSED registered_matBRUTEFORCE_HAMMING_params = ParamsFactory::get().registerCreator("BRUTEFORCE_HAMMING MAT", createParamsBRUTEFORCE_HAMMINGMatcher);
 
 } /* namespace [unnamed] */
 
diff --git a/src/matchers/bruteforce_hamming_2/matcher_bruteforce_hamming_2_load_yaml.cpp b/src/matchers/bruteforce_hamming_2/matcher_bruteforce_hamming_2_load_yaml.cpp
index 41fd170..fc52555 100644
--- a/src/matchers/bruteforce_hamming_2/matcher_bruteforce_hamming_2_load_yaml.cpp
+++ b/src/matchers/bruteforce_hamming_2/matcher_bruteforce_hamming_2_load_yaml.cpp
@@ -36,7 +36,7 @@ static ParamsBasePtr createParamsBRUTEFORCE_HAMMING_2Matcher(const std::string &
 }
 
 // Register in the SensorFactory
-const bool registered_matBRUTEFORCE_HAMMING_2_params = ParamsFactory::get().registerCreator("BRUTEFORCE_HAMMING_2 MAT", createParamsBRUTEFORCE_HAMMING_2Matcher);
+const bool VU_UNUSED registered_matBRUTEFORCE_HAMMING_2_params = ParamsFactory::get().registerCreator("BRUTEFORCE_HAMMING_2 MAT", createParamsBRUTEFORCE_HAMMING_2Matcher);
 
 } /* namespace [unnamed] */
 
diff --git a/src/matchers/bruteforce_l1/matcher_bruteforce_l1_load_yaml.cpp b/src/matchers/bruteforce_l1/matcher_bruteforce_l1_load_yaml.cpp
index 128ddc5..9683d99 100644
--- a/src/matchers/bruteforce_l1/matcher_bruteforce_l1_load_yaml.cpp
+++ b/src/matchers/bruteforce_l1/matcher_bruteforce_l1_load_yaml.cpp
@@ -36,7 +36,7 @@ static ParamsBasePtr createParamsBRUTEFORCE_L1Matcher(const std::string & _filen
 }
 
 // Register in the SensorFactory
-const bool registered_matBRUTEFORCE_L1_params = ParamsFactory::get().registerCreator("BRUTEFORCE_L1 MAT", createParamsBRUTEFORCE_L1Matcher);
+const bool VU_UNUSED registered_matBRUTEFORCE_L1_params = ParamsFactory::get().registerCreator("BRUTEFORCE_L1 MAT", createParamsBRUTEFORCE_L1Matcher);
 
 } /* namespace [unnamed] */
 
diff --git a/src/matchers/flannbased/matcher_flannbased_load_yaml.cpp b/src/matchers/flannbased/matcher_flannbased_load_yaml.cpp
index a9f334d..f993481 100644
--- a/src/matchers/flannbased/matcher_flannbased_load_yaml.cpp
+++ b/src/matchers/flannbased/matcher_flannbased_load_yaml.cpp
@@ -36,7 +36,7 @@ static ParamsBasePtr createParamsFLANNBASEDMatcher(const std::string & _filename
 }
 
 // Register in the SensorFactory
-const bool registered_matFLANNBASED_params = ParamsFactory::get().registerCreator("FLANNBASED MAT", createParamsFLANNBASEDMatcher);
+const bool VU_UNUSED registered_matFLANNBASED_params = ParamsFactory::get().registerCreator("FLANNBASED MAT", createParamsFLANNBASEDMatcher);
 
 } /* namespace [unnamed] */
 
diff --git a/src/matchers/matcher_factory.h b/src/matchers/matcher_factory.h
index 0f9a126..5434e96 100644
--- a/src/matchers/matcher_factory.h
+++ b/src/matchers/matcher_factory.h
@@ -24,7 +24,7 @@ inline std::string MatcherFactory::getClass()
 }
 
 #define VU_REGISTER_MATCHER(MatcherType, MatcherName) \
-  namespace{ const bool MatcherName##Registered = \
+  namespace{ const bool VU_UNUSED MatcherName##Registered = \
 	MatcherFactory::get().registerCreator(MatcherType, MatcherName::create, true); }\
 
 } /* namespace vision_utils */
diff --git a/src/sensors/sensor_factory.h b/src/sensors/sensor_factory.h
index deef102..5f1eb4c 100644
--- a/src/sensors/sensor_factory.h
+++ b/src/sensors/sensor_factory.h
@@ -24,7 +24,7 @@ inline std::string SensorFactory::getClass()
 }
 
 #define VU_REGISTER_SENSOR(SensorType, SensorName) \
-  namespace{ const bool SensorName##Registered = \
+  namespace{ const bool VU_UNUSED SensorName##Registered = \
 	SensorFactory::get().registerCreator(SensorType, SensorName::create, true); }\
 
 } /* namespace vision_utils */
diff --git a/src/sensors/usb_cam/usb_cam_load_yaml.cpp b/src/sensors/usb_cam/usb_cam_load_yaml.cpp
index 9fa57b2..f81a344 100644
--- a/src/sensors/usb_cam/usb_cam_load_yaml.cpp
+++ b/src/sensors/usb_cam/usb_cam_load_yaml.cpp
@@ -35,7 +35,7 @@ static ParamsBasePtr createParamsUSBCAMSensor(const std::string & _filename_dot_
 }
 
 // Register in the SensorFactory
-const bool registered_usbcam_params = ParamsFactory::get().registerCreator("USB_CAM", createParamsUSBCAMSensor);
+const bool VU_UNUSED registered_usbcam_params = ParamsFactory::get().registerCreator("USB_CAM", createParamsUSBCAMSensor);
 
 } /* namespace [unnamed] */
 
-- 
GitLab