From f891df79f8d1a4c6504d588beef545c4890f602e Mon Sep 17 00:00:00 2001 From: asantamaria <asantamaria@iri.upc.edu> Date: Fri, 22 Sep 2017 11:48:42 +0200 Subject: [PATCH] new structure while installing (subfolders) and headers containing sub-headers --- src/CMakeLists.txt | 155 ++++++++++++------ src/algorithms.h | 8 + .../activesearch/alg_activesearch.h | 7 +- src/algorithms/algorithm_base.cpp | 12 ++ src/algorithms/algorithm_base.h | 2 - .../opticalflowpyrlk/alg_opticalflowpyrlk.h | 5 - .../trackfeatures/alg_trackfeatures.h | 5 - src/descriptors.h | 16 ++ src/descriptors/akaze/descriptor_akaze.h | 5 - src/descriptors/brief/descriptor_brief.h | 5 - src/descriptors/brisk/descriptor_brisk.h | 5 - src/descriptors/daisy/descriptor_daisy.h | 5 - src/descriptors/descriptor_base.cpp | 7 + src/descriptors/descriptor_base.h | 2 - src/descriptors/freak/descriptor_freak.h | 5 - src/descriptors/kaze/descriptor_kaze.h | 5 - src/descriptors/latch/descriptor_latch.h | 5 - src/descriptors/lucid/descriptor_lucid.h | 5 - src/descriptors/orb/descriptor_orb.h | 5 - src/descriptors/sift/descriptor_sift.h | 5 - src/descriptors/surf/descriptor_surf.h | 5 - src/detectors.h | 18 ++ src/detectors/agast/detector_agast.h | 5 - src/detectors/akaze/detector_akaze.h | 5 - src/detectors/brisk/detector_brisk.h | 5 - src/detectors/detector_base.cpp | 7 + src/detectors/detector_base.h | 4 +- src/detectors/fast/detector_fast.h | 5 - src/detectors/gftt/detector_gftt.h | 5 - src/detectors/harris/detector_harris.h | 5 - src/detectors/kaze/detector_kaze.h | 5 - src/detectors/mser/detector_mser.h | 5 - src/detectors/orb/detector_orb.h | 5 - src/detectors/sbd/detector_sbd.h | 5 - src/detectors/sift/detector_sift.h | 5 - src/detectors/surf/detector_surf.h | 5 - src/examples/test_algorithm_activesearch.cpp | 46 +----- .../test_algorithm_opticalflowpyrlk.cpp | 22 +-- src/examples/test_algorithm_trackfeatures.cpp | 52 +----- src/examples/test_descriptor.cpp | 35 +--- src/examples/test_detector.cpp | 20 +-- src/examples/test_factories.cpp | 10 +- src/examples/test_matcher.cpp | 42 +---- src/examples/test_sensor.cpp | 5 +- src/matchers.h | 13 ++ src/matchers/bruteforce/matcher_bruteforce.h | 5 - .../matcher_bruteforce_hamming.h | 5 - .../matcher_bruteforce_hamming_2.h | 5 - .../bruteforce_l1/matcher_bruteforce_l1.h | 5 - src/matchers/flannbased/matcher_flannbased.h | 5 - src/matchers/matcher_base.cpp | 12 ++ src/matchers/matcher_base.h | 2 - src/sensors.h | 6 + src/sensors/sensor_base.cpp | 7 + src/sensors/sensor_base.h | 2 - src/sensors/usb_cam/usb_cam.h | 5 - src/vision_utils.cpp | 35 ++-- 57 files changed, 273 insertions(+), 429 deletions(-) create mode 100644 src/algorithms.h create mode 100644 src/descriptors.h create mode 100644 src/detectors.h create mode 100644 src/matchers.h create mode 100644 src/sensors.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4044907..480d47a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,12 +2,11 @@ ADD_DEFINITIONS(-DPRINT_INFO_VU) # library source files -SET(sources_main vision_utils.cpp) -SET(sources_sen +SET(sources + vision_utils.cpp sensors/sensor_base.cpp sensors/usb_cam/usb_cam.cpp - sensors/usb_cam/usb_cam_load_yaml.cpp) -SET(sources_det + sensors/usb_cam/usb_cam_load_yaml.cpp detectors/detector_base.cpp detectors/orb/detector_orb.cpp detectors/orb/detector_orb_load_yaml.cpp @@ -32,8 +31,7 @@ SET(sources_det detectors/akaze/detector_akaze.cpp detectors/akaze/detector_akaze_load_yaml.cpp detectors/agast/detector_agast.cpp - detectors/agast/detector_agast_load_yaml.cpp) -SET(sources_des + detectors/agast/detector_agast_load_yaml.cpp descriptors/descriptor_base.cpp descriptors/orb/descriptor_orb.cpp descriptors/orb/descriptor_orb_load_yaml.cpp @@ -56,8 +54,7 @@ SET(sources_des descriptors/daisy/descriptor_daisy.cpp descriptors/daisy/descriptor_daisy_load_yaml.cpp descriptors/lucid/descriptor_lucid.cpp - descriptors/lucid/descriptor_lucid_load_yaml.cpp) -SET(sources_mat + descriptors/lucid/descriptor_lucid_load_yaml.cpp matchers/matcher_base.cpp matchers/bruteforce/matcher_bruteforce.cpp matchers/bruteforce/matcher_bruteforce_load_yaml.cpp @@ -68,8 +65,7 @@ SET(sources_mat matchers/bruteforce_hamming_2/matcher_bruteforce_hamming_2.cpp matchers/bruteforce_hamming_2/matcher_bruteforce_hamming_2_load_yaml.cpp matchers/flannbased/matcher_flannbased.cpp - matchers/flannbased/matcher_flannbased_load_yaml.cpp) -SET(sources_alg + matchers/flannbased/matcher_flannbased_load_yaml.cpp algorithms/algorithm_base.cpp algorithms/opticalflowpyrlk/alg_opticalflowpyrlk.cpp algorithms/opticalflowpyrlk/alg_opticalflowpyrlk_load_yaml.cpp @@ -81,59 +77,95 @@ SET(sources_alg # application header files SET(headers_main vision_utils.h - factory.h) + factory.h + sensors.h + detectors.h + descriptors.h + matchers.h + algorithms.h) SET(headers_com common_class/buffer.h common_class/frame.h) SET(headers_sen sensors/sensor_factory.h - sensors/sensor_base.h + sensors/sensor_base.h) +SET(headers_sen_usb sensors/usb_cam/usb_cam.h) SET(headers_det detectors/detector_factory.h - detectors/detector_base.h - detectors/orb/detector_orb.h - detectors/fast/detector_fast.h - detectors/sift/detector_sift.h - detectors/surf/detector_surf.h - detectors/brisk/detector_brisk.h - detectors/mser/detector_mser.h - detectors/gftt/detector_gftt.h - detectors/harris/detector_harris.h - detectors/sbd/detector_sbd.h - detectors/kaze/detector_kaze.h - detectors/akaze/detector_akaze.h + detectors/detector_base.h) +SET(headers_det_orb + detectors/orb/detector_orb.h) +SET(headers_det_fast + detectors/fast/detector_fast.h) +SET(headers_det_sift + detectors/sift/detector_sift.h) +SET(headers_det_surf + detectors/surf/detector_surf.h) +SET(headers_det_brisk + detectors/brisk/detector_brisk.h) +SET(headers_det_mser + detectors/mser/detector_mser.h) +SET(headers_det_gftt + detectors/gftt/detector_gftt.h) +SET(headers_det_harris + detectors/harris/detector_harris.h) +SET(headers_det_sbd + detectors/sbd/detector_sbd.h) +SET(headers_det_kaze + detectors/kaze/detector_kaze.h) +SET(headers_det_akaze + detectors/akaze/detector_akaze.h) +SET(headers_det_agast detectors/agast/detector_agast.h) SET(headers_des descriptors/descriptor_factory.h - descriptors/descriptor_base.h - descriptors/orb/descriptor_orb.h - descriptors/sift/descriptor_sift.h - descriptors/surf/descriptor_surf.h - descriptors/brisk/descriptor_brisk.h - descriptors/kaze/descriptor_kaze.h - descriptors/akaze/descriptor_akaze.h - descriptors/latch/descriptor_latch.h - descriptors/freak/descriptor_freak.h - descriptors/brief/descriptor_brief.h - descriptors/daisy/descriptor_daisy.h + descriptors/descriptor_base.h) +SET(headers_des_orb + descriptors/orb/descriptor_orb.h) +SET(headers_des_sift + descriptors/sift/descriptor_sift.h) +SET(headers_des_surf + descriptors/surf/descriptor_surf.h) +SET(headers_des_brisk + descriptors/brisk/descriptor_brisk.h) +SET(headers_des_kaze + descriptors/kaze/descriptor_kaze.h) +SET(headers_des_akaze + descriptors/akaze/descriptor_akaze.h) +SET(headers_des_latch + descriptors/latch/descriptor_latch.h) +SET(headers_des_freak + descriptors/freak/descriptor_freak.h) +SET(headers_des_brief + descriptors/brief/descriptor_brief.h) +SET(headers_des_daisy + descriptors/daisy/descriptor_daisy.h) +SET(headers_des_lucid descriptors/lucid/descriptor_lucid.h) SET(headers_mat matchers/matcher_factory.h - matchers/matcher_base.h - matchers/bruteforce/matcher_bruteforce.h - matchers/bruteforce_l1/matcher_bruteforce_l1.h - matchers/bruteforce_hamming/matcher_bruteforce_hamming.h - matchers/bruteforce_hamming_2/matcher_bruteforce_hamming_2.h + matchers/matcher_base.h) +SET(headers_mat_bruteforce + matchers/bruteforce/matcher_bruteforce.h) +SET(headers_mat_bruteforce_l1 + matchers/bruteforce_l1/matcher_bruteforce_l1.h) +SET(headers_mat_bruteforce_hamming + matchers/bruteforce_hamming/matcher_bruteforce_hamming.h) +SET(headers_mat_bruteforce_hamming_2 + matchers/bruteforce_hamming_2/matcher_bruteforce_hamming_2.h) +SET(headers_mat_flannbased matchers/flannbased/matcher_flannbased.h) SET(headers_alg algorithms/algorithm_factory.h - algorithms/algorithm_base.h - algorithms/opticalflowpyrlk/alg_opticalflowpyrlk.h - algorithms/trackfeatures/alg_trackfeatures.h + algorithms/algorithm_base.h) +SET(headers_alg_opticalflowpyrlk + algorithms/opticalflowpyrlk/alg_opticalflowpyrlk.h) +SET(headers_alg_trackfeatures + algorithms/trackfeatures/alg_trackfeatures.h) +SET(headers_alg_activesearch algorithms/activesearch/alg_activesearch.h) - # locate the necessary dependencies FIND_PACKAGE(Eigen3 REQUIRED) FIND_PACKAGE(OpenCV REQUIRED) @@ -143,7 +175,6 @@ if (OpenCV_FOUND) if (${OpenCV_VERSION_MAJOR} GREATER 2) message("-- [INFO] Found OpenCV ${OpenCV_VERSION_MAJOR}.${OpenCV_VERSION_MINOR} support") ADD_DEFINITIONS(-DHAVE_OPENCV_H) - SET(USE_CV true) else(${OpenCV_VERSION_MAJOR} GREATER 2) message("[WARN] OpenCV support not installed. Minimum 3.0 version required.") message("[WARN] Current version ${OpenCV_VERSION_MAJOR}") @@ -188,7 +219,7 @@ MESSAGE(STATUS "Configuring ${PROJECT_NAME} (creating config.h from _internal di include_directories("${PROJECT_BINARY_DIR}/conf") # create the shared library -ADD_LIBRARY(${PROJECT_NAME} SHARED ${sources_main} ${sources_sen} ${sources_det} ${sources_des} ${sources_mat} ${sources_alg}) +ADD_LIBRARY(${PROJECT_NAME} SHARED ${sources}) # link necessary libraries TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${OpenCV_LIBS} ${Boost_LIBRARIES}) @@ -205,10 +236,42 @@ INSTALL(TARGETS ${PROJECT_NAME} INSTALL(FILES ${headers_main} DESTINATION include/${PROJECT_NAME}) INSTALL(FILES ${headers_com} DESTINATION include/${PROJECT_NAME}/common_class) INSTALL(FILES ${headers_sen} DESTINATION include/${PROJECT_NAME}/sensors) +INSTALL(FILES ${headers_sen_usb} DESTINATION include/${PROJECT_NAME}/sensors/usb) INSTALL(FILES ${headers_det} DESTINATION include/${PROJECT_NAME}/detectors) +INSTALL(FILES ${headers_det_orb} DESTINATION include/${PROJECT_NAME}/detectors/orb) +INSTALL(FILES ${headers_det_fast} DESTINATION include/${PROJECT_NAME}/detectors/fast) +INSTALL(FILES ${headers_det_sift} DESTINATION include/${PROJECT_NAME}/detectors/sift) +INSTALL(FILES ${headers_det_surf} DESTINATION include/${PROJECT_NAME}/detectors/surf) +INSTALL(FILES ${headers_det_brisk} DESTINATION include/${PROJECT_NAME}/detectors/brisk) +INSTALL(FILES ${headers_det_mser} DESTINATION include/${PROJECT_NAME}/detectors/mser) +INSTALL(FILES ${headers_det_gftt} DESTINATION include/${PROJECT_NAME}/detectors/gftt) +INSTALL(FILES ${headers_det_harris} DESTINATION include/${PROJECT_NAME}/detectors/harris) +INSTALL(FILES ${headers_det_sbd} DESTINATION include/${PROJECT_NAME}/detectors/sbd) +INSTALL(FILES ${headers_det_kaze} DESTINATION include/${PROJECT_NAME}/detectors/kaze) +INSTALL(FILES ${headers_det_akaze} DESTINATION include/${PROJECT_NAME}/detectors/akaze) +INSTALL(FILES ${headers_det_agast} DESTINATION include/${PROJECT_NAME}/detectors/agast) INSTALL(FILES ${headers_des} DESTINATION include/${PROJECT_NAME}/descriptors) +INSTALL(FILES ${headers_des_orb} DESTINATION include/${PROJECT_NAME}/descriptors/orb) +INSTALL(FILES ${headers_des_sift} DESTINATION include/${PROJECT_NAME}/descriptors/sift) +INSTALL(FILES ${headers_des_surf} DESTINATION include/${PROJECT_NAME}/descriptors/surf) +INSTALL(FILES ${headers_des_brisk} DESTINATION include/${PROJECT_NAME}/descriptors/brisk) +INSTALL(FILES ${headers_des_kaze} DESTINATION include/${PROJECT_NAME}/descriptors/kaze) +INSTALL(FILES ${headers_des_akaze} DESTINATION include/${PROJECT_NAME}/descriptors/akaze) +INSTALL(FILES ${headers_des_latch} DESTINATION include/${PROJECT_NAME}/descriptors/latch) +INSTALL(FILES ${headers_des_freak} DESTINATION include/${PROJECT_NAME}/descriptors/freak) +INSTALL(FILES ${headers_des_brief} DESTINATION include/${PROJECT_NAME}/descriptors/brief) +INSTALL(FILES ${headers_des_daisy} DESTINATION include/${PROJECT_NAME}/descriptors/daisy) +INSTALL(FILES ${headers_des_lucid} DESTINATION include/${PROJECT_NAME}/descriptors/lucid) INSTALL(FILES ${headers_mat} DESTINATION include/${PROJECT_NAME}/matchers) +INSTALL(FILES ${headers_mat_bruteforce} DESTINATION include/${PROJECT_NAME}/matchers/bruteforce) +INSTALL(FILES ${headers_mat_bruteforce_l1} DESTINATION include/${PROJECT_NAME}/matchers/bruteforce_l1) +INSTALL(FILES ${headers_mat_bruteforce_hamming} DESTINATION include/${PROJECT_NAME}/matchers/bruteforce_hamming) +INSTALL(FILES ${headers_mat_bruteforce_hamming_2} DESTINATION include/${PROJECT_NAME}/matchers/bruteforce_hamming_2) +INSTALL(FILES ${headers_mat_flannbased} DESTINATION include/${PROJECT_NAME}/matchers/flannbased) INSTALL(FILES ${headers_alg} DESTINATION include/${PROJECT_NAME}/algorithms) +INSTALL(FILES ${headers_alg_opticalflowpyrlk} DESTINATION include/${PROJECT_NAME}/algorithms/opticalflowpyrlk) +INSTALL(FILES ${headers_alg_trackfeatures} DESTINATION include/${PROJECT_NAME}/algorithms/trackfeatures) +INSTALL(FILES ${headers_alg_activesearch} DESTINATION include/${PROJECT_NAME}/algorithms/activesearch) INSTALL(FILES ../cmake_modules/Find${PROJECT_NAME}.cmake DESTINATION ${CMAKE_ROOT}/Modules/) INSTALL(FILES "${VU_CONFIG_DIR}/config.h" DESTINATION include/${PROJECT_NAME}/_internal) diff --git a/src/algorithms.h b/src/algorithms.h new file mode 100644 index 0000000..c913d84 --- /dev/null +++ b/src/algorithms.h @@ -0,0 +1,8 @@ +#ifndef _ALGORITHMS_H_ +#define _ALGORITHMS_H_ + +#include "algorithms/activesearch/alg_activesearch.h" +#include "algorithms/opticalflowpyrlk/alg_opticalflowpyrlk.h" +#include "algorithms/trackfeatures/alg_trackfeatures.h" + +#endif /* _ALGORITHMS_H_ */ diff --git a/src/algorithms/activesearch/alg_activesearch.h b/src/algorithms/activesearch/alg_activesearch.h index 19a4d6a..7a4007f 100644 --- a/src/algorithms/activesearch/alg_activesearch.h +++ b/src/algorithms/activesearch/alg_activesearch.h @@ -9,14 +9,9 @@ #include "../../descriptors/descriptor_base.h" #include "../../matchers/matcher_base.h" -// yaml-cpp library -#ifdef USING_YAML - #include <yaml-cpp/yaml.h> -#endif - //OpenCV #include <opencv2/core.hpp> -#include "opencv2/features2d.hpp" +#include <opencv2/features2d.hpp> // Eigen #include <eigen3/Eigen/Dense> diff --git a/src/algorithms/algorithm_base.cpp b/src/algorithms/algorithm_base.cpp index 6bbb87f..df3a03f 100644 --- a/src/algorithms/algorithm_base.cpp +++ b/src/algorithms/algorithm_base.cpp @@ -1,5 +1,10 @@ #include "algorithm_base.h" +// yaml-cpp library +#ifdef USING_YAML + #include <yaml-cpp/yaml.h> +#endif + namespace vision_utils { AlgorithmBase::AlgorithmBase(void) @@ -29,6 +34,13 @@ AlgorithmBasePtr setupAlgorithm(const std::string& _type, const std::string& _un ParamsBasePtr params_ptr = ParamsFactory::get().create(_type+" ALG", _filename_dot_yaml); return setupAlgorithm(_type, _unique_name, params_ptr); } +#else +AlgorithmBasePtr setupAlgorithm(const std::string& _type, const std::string& _unique_name, const std::string& _filename_dot_yaml) +{ + std::cerr << "[Vision utils]: Current version of the library has no YAML support. " + << "Try installing YAML-related libraries and recompile and reinstall the Vision Utils library." + << std::endl; +} #endif } /* namespace vision_utils */ diff --git a/src/algorithms/algorithm_base.h b/src/algorithms/algorithm_base.h index 47e224a..0c1721c 100644 --- a/src/algorithms/algorithm_base.h +++ b/src/algorithms/algorithm_base.h @@ -75,9 +75,7 @@ inline void AlgorithmBase::setName(const std::string& _name){ name_ = _name; } * brief Setup and get the corresponding pointer */ AlgorithmBasePtr setupAlgorithm(const std::string& _type, const std::string& _unique_name, const ParamsBasePtr& _params); -#ifdef USING_YAML AlgorithmBasePtr setupAlgorithm(const std::string& _type, const std::string& _unique_name, const std::string& _filename_dot_yaml); -#endif } /* namespace vision_utils */ diff --git a/src/algorithms/opticalflowpyrlk/alg_opticalflowpyrlk.h b/src/algorithms/opticalflowpyrlk/alg_opticalflowpyrlk.h index da5b468..f6831ce 100644 --- a/src/algorithms/opticalflowpyrlk/alg_opticalflowpyrlk.h +++ b/src/algorithms/opticalflowpyrlk/alg_opticalflowpyrlk.h @@ -9,11 +9,6 @@ #include "../../descriptors/descriptor_base.h" #include "../../matchers/matcher_base.h" -// yaml-cpp library -#ifdef USING_YAML - #include <yaml-cpp/yaml.h> -#endif - namespace vision_utils { // Create all pointers diff --git a/src/algorithms/trackfeatures/alg_trackfeatures.h b/src/algorithms/trackfeatures/alg_trackfeatures.h index 0ad056b..32209cc 100644 --- a/src/algorithms/trackfeatures/alg_trackfeatures.h +++ b/src/algorithms/trackfeatures/alg_trackfeatures.h @@ -9,11 +9,6 @@ #include "../../descriptors/descriptor_base.h" #include "../../matchers/matcher_base.h" -// yaml-cpp library -#ifdef USING_YAML - #include <yaml-cpp/yaml.h> -#endif - //OpenCV #include <opencv2/core.hpp> #include "opencv2/features2d.hpp" diff --git a/src/descriptors.h b/src/descriptors.h new file mode 100644 index 0000000..61904c2 --- /dev/null +++ b/src/descriptors.h @@ -0,0 +1,16 @@ +#ifndef _DESCRIPTORS_H_ +#define _DESCRIPTORS_H_ + +#include "descriptors/orb/descriptor_orb.h" +#include "descriptors/sift/descriptor_sift.h" +#include "descriptors/surf/descriptor_surf.h" +#include "descriptors/brisk/descriptor_brisk.h" +#include "descriptors/kaze/descriptor_kaze.h" +#include "descriptors/akaze/descriptor_akaze.h" +#include "descriptors/latch/descriptor_latch.h" +#include "descriptors/freak/descriptor_freak.h" +#include "descriptors/brief/descriptor_brief.h" +#include "descriptors/daisy/descriptor_daisy.h" +#include "descriptors/lucid/descriptor_lucid.h" + +#endif /* _DESCRIPTORS_H_ */ diff --git a/src/descriptors/akaze/descriptor_akaze.h b/src/descriptors/akaze/descriptor_akaze.h index 11979d7..3fbdee2 100644 --- a/src/descriptors/akaze/descriptor_akaze.h +++ b/src/descriptors/akaze/descriptor_akaze.h @@ -4,11 +4,6 @@ #include "../descriptor_base.h" #include "../descriptor_factory.h" -// yaml-cpp library -#ifdef USING_YAML - #include <yaml-cpp/yaml.h> -#endif - namespace vision_utils { // Create all pointers diff --git a/src/descriptors/brief/descriptor_brief.h b/src/descriptors/brief/descriptor_brief.h index a128d4a..42f9cfd 100644 --- a/src/descriptors/brief/descriptor_brief.h +++ b/src/descriptors/brief/descriptor_brief.h @@ -4,11 +4,6 @@ #include "../descriptor_base.h" #include "../descriptor_factory.h" -// yaml-cpp library -#ifdef USING_YAML - #include <yaml-cpp/yaml.h> -#endif - namespace vision_utils { // Create all pointers diff --git a/src/descriptors/brisk/descriptor_brisk.h b/src/descriptors/brisk/descriptor_brisk.h index 59421a6..ee3f884 100644 --- a/src/descriptors/brisk/descriptor_brisk.h +++ b/src/descriptors/brisk/descriptor_brisk.h @@ -4,11 +4,6 @@ #include "../descriptor_base.h" #include "../descriptor_factory.h" -// yaml-cpp library -#ifdef USING_YAML - #include <yaml-cpp/yaml.h> -#endif - namespace vision_utils { // Create all pointers diff --git a/src/descriptors/daisy/descriptor_daisy.h b/src/descriptors/daisy/descriptor_daisy.h index 9d949c2..e30f84d 100644 --- a/src/descriptors/daisy/descriptor_daisy.h +++ b/src/descriptors/daisy/descriptor_daisy.h @@ -4,11 +4,6 @@ #include "../descriptor_base.h" #include "../descriptor_factory.h" -// yaml-cpp library -#ifdef USING_YAML - #include <yaml-cpp/yaml.h> -#endif - namespace vision_utils { // Create all pointers diff --git a/src/descriptors/descriptor_base.cpp b/src/descriptors/descriptor_base.cpp index af91245..5764bd3 100644 --- a/src/descriptors/descriptor_base.cpp +++ b/src/descriptors/descriptor_base.cpp @@ -41,6 +41,13 @@ DescriptorBasePtr setupDescriptor(const std::string& _type, const std::string& _ ParamsBasePtr params_ptr = ParamsFactory::get().create(_type+" DES", _filename_dot_yaml); return setupDescriptor(_type, _unique_name, params_ptr); } +#else +DescriptorBasePtr setupDescriptor(const std::string& _type, const std::string& _unique_name, const std::string& _filename_dot_yaml) +{ + std::cerr << "[Vision utils]: Current version of the library has no YAML support. " + << "Try installing YAML-related libraries and recompile and reinstall the Vision Utils library." + << std::endl; +} #endif } /* namespace vision_utils */ diff --git a/src/descriptors/descriptor_base.h b/src/descriptors/descriptor_base.h index 94aca11..6103c2d 100644 --- a/src/descriptors/descriptor_base.h +++ b/src/descriptors/descriptor_base.h @@ -73,9 +73,7 @@ inline void DescriptorBase::setName(const std::string& _name){ name_ = _name; } * brief Setup and get the corresponding pointer */ DescriptorBasePtr setupDescriptor(const std::string& _type, const std::string& _unique_name, const ParamsBasePtr& _params); -#ifdef USING_YAML DescriptorBasePtr setupDescriptor(const std::string& _type, const std::string& _unique_name, const std::string& _filename_dot_yaml); -#endif } /* namespace vision_utils */ diff --git a/src/descriptors/freak/descriptor_freak.h b/src/descriptors/freak/descriptor_freak.h index 18cf5ca..96697fb 100644 --- a/src/descriptors/freak/descriptor_freak.h +++ b/src/descriptors/freak/descriptor_freak.h @@ -4,11 +4,6 @@ #include "../descriptor_base.h" #include "../descriptor_factory.h" -// yaml-cpp library -#ifdef USING_YAML - #include <yaml-cpp/yaml.h> -#endif - namespace vision_utils { // Create all pointers diff --git a/src/descriptors/kaze/descriptor_kaze.h b/src/descriptors/kaze/descriptor_kaze.h index 4b0a875..5b1b7a5 100644 --- a/src/descriptors/kaze/descriptor_kaze.h +++ b/src/descriptors/kaze/descriptor_kaze.h @@ -4,11 +4,6 @@ #include "../descriptor_base.h" #include "../descriptor_factory.h" -// yaml-cpp library -#ifdef USING_YAML - #include <yaml-cpp/yaml.h> -#endif - namespace vision_utils { // Create all pointers diff --git a/src/descriptors/latch/descriptor_latch.h b/src/descriptors/latch/descriptor_latch.h index 56b0ae2..db05b77 100644 --- a/src/descriptors/latch/descriptor_latch.h +++ b/src/descriptors/latch/descriptor_latch.h @@ -4,11 +4,6 @@ #include "../descriptor_base.h" #include "../descriptor_factory.h" -// yaml-cpp library -#ifdef USING_YAML - #include <yaml-cpp/yaml.h> -#endif - namespace vision_utils { // Create all pointers diff --git a/src/descriptors/lucid/descriptor_lucid.h b/src/descriptors/lucid/descriptor_lucid.h index 148021a..6892f01 100644 --- a/src/descriptors/lucid/descriptor_lucid.h +++ b/src/descriptors/lucid/descriptor_lucid.h @@ -4,11 +4,6 @@ #include "../descriptor_base.h" #include "../descriptor_factory.h" -// yaml-cpp library -#ifdef USING_YAML - #include <yaml-cpp/yaml.h> -#endif - namespace vision_utils { // Create all pointers diff --git a/src/descriptors/orb/descriptor_orb.h b/src/descriptors/orb/descriptor_orb.h index 5375c41..32d2967 100644 --- a/src/descriptors/orb/descriptor_orb.h +++ b/src/descriptors/orb/descriptor_orb.h @@ -4,11 +4,6 @@ #include "../descriptor_base.h" #include "../descriptor_factory.h" -// yaml-cpp library -#ifdef USING_YAML - #include <yaml-cpp/yaml.h> -#endif - namespace vision_utils { // Create all pointers diff --git a/src/descriptors/sift/descriptor_sift.h b/src/descriptors/sift/descriptor_sift.h index 25d2e0f..6bae1c6 100644 --- a/src/descriptors/sift/descriptor_sift.h +++ b/src/descriptors/sift/descriptor_sift.h @@ -4,11 +4,6 @@ #include "../descriptor_base.h" #include "../descriptor_factory.h" -// yaml-cpp library -#ifdef USING_YAML - #include <yaml-cpp/yaml.h> -#endif - namespace vision_utils { // Create all pointers diff --git a/src/descriptors/surf/descriptor_surf.h b/src/descriptors/surf/descriptor_surf.h index 1917872..23f3a7f 100644 --- a/src/descriptors/surf/descriptor_surf.h +++ b/src/descriptors/surf/descriptor_surf.h @@ -4,11 +4,6 @@ #include "../descriptor_base.h" #include "../descriptor_factory.h" -// yaml-cpp library -#ifdef USING_YAML - #include <yaml-cpp/yaml.h> -#endif - namespace vision_utils { // Create all pointers diff --git a/src/detectors.h b/src/detectors.h new file mode 100644 index 0000000..80e1c08 --- /dev/null +++ b/src/detectors.h @@ -0,0 +1,18 @@ +#ifndef _DETECTORS_H_ +#define _DETECTORS_H_ + +// Detector headers +#include "detectors/orb/detector_orb.h" +#include "detectors/fast/detector_fast.h" +#include "detectors/sift/detector_sift.h" +#include "detectors/surf/detector_surf.h" +#include "detectors/brisk/detector_brisk.h" +#include "detectors/mser/detector_mser.h" +#include "detectors/gftt/detector_gftt.h" +#include "detectors/harris/detector_harris.h" +#include "detectors/sbd/detector_sbd.h" +#include "detectors/kaze/detector_kaze.h" +#include "detectors/akaze/detector_akaze.h" +#include "detectors/agast/detector_agast.h" + +#endif /* DETECTORS_H_ */ diff --git a/src/detectors/agast/detector_agast.h b/src/detectors/agast/detector_agast.h index 513dc95..aa6c1be 100644 --- a/src/detectors/agast/detector_agast.h +++ b/src/detectors/agast/detector_agast.h @@ -4,11 +4,6 @@ #include "../detector_base.h" #include "../detector_factory.h" -// yaml-cpp library -#ifdef USING_YAML - #include <yaml-cpp/yaml.h> -#endif - namespace vision_utils { // Create all pointers diff --git a/src/detectors/akaze/detector_akaze.h b/src/detectors/akaze/detector_akaze.h index 95a1b97..f10f09d 100644 --- a/src/detectors/akaze/detector_akaze.h +++ b/src/detectors/akaze/detector_akaze.h @@ -4,11 +4,6 @@ #include "../detector_base.h" #include "../detector_factory.h" -// yaml-cpp library -#ifdef USING_YAML - #include <yaml-cpp/yaml.h> -#endif - namespace vision_utils { // Create all pointers diff --git a/src/detectors/brisk/detector_brisk.h b/src/detectors/brisk/detector_brisk.h index d9eb10d..82ac22b 100644 --- a/src/detectors/brisk/detector_brisk.h +++ b/src/detectors/brisk/detector_brisk.h @@ -4,11 +4,6 @@ #include "../detector_base.h" #include "../detector_factory.h" -// yaml-cpp library -#ifdef USING_YAML - #include <yaml-cpp/yaml.h> -#endif - namespace vision_utils { // Create all pointers diff --git a/src/detectors/detector_base.cpp b/src/detectors/detector_base.cpp index 33d2415..9b4f930 100644 --- a/src/detectors/detector_base.cpp +++ b/src/detectors/detector_base.cpp @@ -72,6 +72,13 @@ DetectorBasePtr setupDetector(const std::string& _type, const std::string& _uniq ParamsBasePtr params_ptr = ParamsFactory::get().create(_type+" DET", _filename_dot_yaml); return setupDetector(_type, _unique_name, params_ptr); } +#else +DetectorBasePtr setupDetector(const std::string& _type, const std::string& _unique_name, const std::string& _filename_dot_yaml) +{ + std::cerr << "[Vision utils]: Current version of the library has no YAML support. " + << "Try installing YAML-related libraries and recompile and reinstall the Vision Utils library." + << std::endl; +} #endif } /* namespace vision_utils */ diff --git a/src/detectors/detector_base.h b/src/detectors/detector_base.h index b377039..b5ae64d 100644 --- a/src/detectors/detector_base.h +++ b/src/detectors/detector_base.h @@ -2,7 +2,7 @@ #define _DETECTOR_BASE_H_ // vision_utils -#include "../vision_utils.h" +#include <vision_utils.h> typedef cv::Ptr<cv::FeatureDetector> FeatureDetectorPtr; @@ -80,9 +80,7 @@ inline int DetectorBase::getPatternRadius(void) * brief Setup and get the corresponding pointer */ DetectorBasePtr setupDetector(const std::string& _type, const std::string& _unique_name, const ParamsBasePtr& _params); -#ifdef USING_YAML DetectorBasePtr setupDetector(const std::string& _type, const std::string& _unique_name, const std::string& _filename_dot_yaml); -#endif } /* namespace vision_utils */ diff --git a/src/detectors/fast/detector_fast.h b/src/detectors/fast/detector_fast.h index f22df6b..4f97c58 100644 --- a/src/detectors/fast/detector_fast.h +++ b/src/detectors/fast/detector_fast.h @@ -4,11 +4,6 @@ #include "../detector_base.h" #include "../detector_factory.h" -// yaml-cpp library -#ifdef USING_YAML - #include <yaml-cpp/yaml.h> -#endif - namespace vision_utils { // Create all pointers diff --git a/src/detectors/gftt/detector_gftt.h b/src/detectors/gftt/detector_gftt.h index fe788e2..13ec7a8 100644 --- a/src/detectors/gftt/detector_gftt.h +++ b/src/detectors/gftt/detector_gftt.h @@ -4,11 +4,6 @@ #include "../detector_base.h" #include "../detector_factory.h" -// yaml-cpp library -#ifdef USING_YAML - #include <yaml-cpp/yaml.h> -#endif - namespace vision_utils { // Create all pointers diff --git a/src/detectors/harris/detector_harris.h b/src/detectors/harris/detector_harris.h index 941f524..7963185 100644 --- a/src/detectors/harris/detector_harris.h +++ b/src/detectors/harris/detector_harris.h @@ -4,11 +4,6 @@ #include "../detector_base.h" #include "../detector_factory.h" -// yaml-cpp library -#ifdef USING_YAML - #include <yaml-cpp/yaml.h> -#endif - namespace vision_utils { // Create all pointers diff --git a/src/detectors/kaze/detector_kaze.h b/src/detectors/kaze/detector_kaze.h index da0d749..00558f3 100644 --- a/src/detectors/kaze/detector_kaze.h +++ b/src/detectors/kaze/detector_kaze.h @@ -4,11 +4,6 @@ #include "../detector_base.h" #include "../detector_factory.h" -// yaml-cpp library -#ifdef USING_YAML - #include <yaml-cpp/yaml.h> -#endif - namespace vision_utils { // Create all pointers diff --git a/src/detectors/mser/detector_mser.h b/src/detectors/mser/detector_mser.h index 939feeb..b9c394d 100644 --- a/src/detectors/mser/detector_mser.h +++ b/src/detectors/mser/detector_mser.h @@ -4,11 +4,6 @@ #include "../detector_base.h" #include "../detector_factory.h" -// yaml-cpp library -#ifdef USING_YAML - #include <yaml-cpp/yaml.h> -#endif - namespace vision_utils { // Create all pointers diff --git a/src/detectors/orb/detector_orb.h b/src/detectors/orb/detector_orb.h index 062e149..f7431a4 100644 --- a/src/detectors/orb/detector_orb.h +++ b/src/detectors/orb/detector_orb.h @@ -4,11 +4,6 @@ #include "../detector_base.h" #include "../detector_factory.h" -// yaml-cpp library -#ifdef USING_YAML - #include <yaml-cpp/yaml.h> -#endif - namespace vision_utils { // Create all pointers diff --git a/src/detectors/sbd/detector_sbd.h b/src/detectors/sbd/detector_sbd.h index 7d104a3..69574c6 100644 --- a/src/detectors/sbd/detector_sbd.h +++ b/src/detectors/sbd/detector_sbd.h @@ -4,11 +4,6 @@ #include "../detector_base.h" #include "../detector_factory.h" -// yaml-cpp library -#ifdef USING_YAML - #include <yaml-cpp/yaml.h> -#endif - namespace vision_utils { // Create all pointers diff --git a/src/detectors/sift/detector_sift.h b/src/detectors/sift/detector_sift.h index 436321d..434cae2 100644 --- a/src/detectors/sift/detector_sift.h +++ b/src/detectors/sift/detector_sift.h @@ -4,11 +4,6 @@ #include "../detector_base.h" #include "../detector_factory.h" -// yaml-cpp library -#ifdef USING_YAML - #include <yaml-cpp/yaml.h> -#endif - namespace vision_utils { // Create all pointers diff --git a/src/detectors/surf/detector_surf.h b/src/detectors/surf/detector_surf.h index 304d89e..0f7f7f4 100644 --- a/src/detectors/surf/detector_surf.h +++ b/src/detectors/surf/detector_surf.h @@ -4,11 +4,6 @@ #include "../detector_base.h" #include "../detector_factory.h" -// yaml-cpp library -#ifdef USING_YAML - #include <yaml-cpp/yaml.h> -#endif - namespace vision_utils { // Create all pointers diff --git a/src/examples/test_algorithm_activesearch.cpp b/src/examples/test_algorithm_activesearch.cpp index bd3c61b..dcba809 100644 --- a/src/examples/test_algorithm_activesearch.cpp +++ b/src/examples/test_algorithm_activesearch.cpp @@ -2,47 +2,13 @@ #include <iomanip> #include <cstdlib> +#include "../algorithms.h" +// Vision Utils #include "../vision_utils.h" - -// Sensors -#include "../sensors/usb_cam/usb_cam.h" - -// Detectors -#include "../detectors/orb/detector_orb.h" -#include "../detectors/fast/detector_fast.h" -#include "../detectors/sift/detector_sift.h" -#include "../detectors/surf/detector_surf.h" -#include "../detectors/brisk/detector_brisk.h" -#include "../detectors/mser/detector_mser.h" -#include "../detectors/gftt/detector_gftt.h" -#include "../detectors/harris/detector_harris.h" -#include "../detectors/sbd/detector_sbd.h" -#include "../detectors/kaze/detector_kaze.h" -#include "../detectors/akaze/detector_akaze.h" -#include "../detectors/agast/detector_agast.h" - -// Descriptors -#include "../descriptors/orb/descriptor_orb.h" -#include "../descriptors/sift/descriptor_sift.h" -#include "../descriptors/surf/descriptor_surf.h" -#include "../descriptors/brisk/descriptor_brisk.h" -#include "../descriptors/kaze/descriptor_kaze.h" -#include "../descriptors/akaze/descriptor_akaze.h" -#include "../descriptors/latch/descriptor_latch.h" -#include "../descriptors/freak/descriptor_freak.h" -#include "../descriptors/brief/descriptor_brief.h" -#include "../descriptors/daisy/descriptor_daisy.h" -#include "../descriptors/lucid/descriptor_lucid.h" - -// Matchers -#include "../matchers/flannbased/matcher_flannbased.h" -#include "../matchers/bruteforce/matcher_bruteforce.h" -#include "../matchers/bruteforce_l1/matcher_bruteforce_l1.h" -#include "../matchers/bruteforce_hamming/matcher_bruteforce_hamming.h" -#include "../matchers/bruteforce_hamming_2/matcher_bruteforce_hamming_2.h" - -// Algorithms -#include "../algorithms/activesearch/alg_activesearch.h" +#include "../descriptors.h" +#include "../detectors.h" +#include "../matchers.h" +#include "../sensors.h" using namespace vision_utils; diff --git a/src/examples/test_algorithm_opticalflowpyrlk.cpp b/src/examples/test_algorithm_opticalflowpyrlk.cpp index c8e465d..7ccd57f 100644 --- a/src/examples/test_algorithm_opticalflowpyrlk.cpp +++ b/src/examples/test_algorithm_opticalflowpyrlk.cpp @@ -2,27 +2,11 @@ #include <iomanip> #include <cstdlib> +// Vision Utils #include "../vision_utils.h" - -// Sensors -#include "../sensors/usb_cam/usb_cam.h" - -// Detectors -#include "../detectors/orb/detector_orb.h" -#include "../detectors/fast/detector_fast.h" -#include "../detectors/sift/detector_sift.h" -#include "../detectors/surf/detector_surf.h" -#include "../detectors/brisk/detector_brisk.h" -#include "../detectors/mser/detector_mser.h" -#include "../detectors/gftt/detector_gftt.h" -#include "../detectors/harris/detector_harris.h" -#include "../detectors/sbd/detector_sbd.h" -#include "../detectors/kaze/detector_kaze.h" -#include "../detectors/akaze/detector_akaze.h" -#include "../detectors/agast/detector_agast.h" - -// Algorithms #include "../algorithms/opticalflowpyrlk/alg_opticalflowpyrlk.h" +#include "../detectors.h" +#include "../sensors.h" #define MIN_GOOD_POINTS 20 diff --git a/src/examples/test_algorithm_trackfeatures.cpp b/src/examples/test_algorithm_trackfeatures.cpp index e2c798c..ef0441b 100644 --- a/src/examples/test_algorithm_trackfeatures.cpp +++ b/src/examples/test_algorithm_trackfeatures.cpp @@ -2,53 +2,13 @@ #include <iomanip> #include <cstdlib> +#include "../algorithms.h" +// Vision Utils #include "../vision_utils.h" - -// Sensors -#include "../sensors/usb_cam/usb_cam.h" - -// Detectors -#include "../detectors/orb/detector_orb.h" -#include "../detectors/fast/detector_fast.h" -#include "../detectors/sift/detector_sift.h" -#include "../detectors/surf/detector_surf.h" -#include "../detectors/brisk/detector_brisk.h" -#include "../detectors/mser/detector_mser.h" -#include "../detectors/gftt/detector_gftt.h" -#include "../detectors/harris/detector_harris.h" -#include "../detectors/sbd/detector_sbd.h" -#include "../detectors/kaze/detector_kaze.h" -#include "../detectors/akaze/detector_akaze.h" -#include "../detectors/agast/detector_agast.h" - -// Descriptors -#include "../descriptors/orb/descriptor_orb.h" -#include "../descriptors/sift/descriptor_sift.h" -#include "../descriptors/surf/descriptor_surf.h" -#include "../descriptors/brisk/descriptor_brisk.h" -#include "../descriptors/kaze/descriptor_kaze.h" -#include "../descriptors/akaze/descriptor_akaze.h" -#include "../descriptors/latch/descriptor_latch.h" -#include "../descriptors/freak/descriptor_freak.h" -#include "../descriptors/brief/descriptor_brief.h" -#include "../descriptors/daisy/descriptor_daisy.h" -#include "../descriptors/lucid/descriptor_lucid.h" - -// Matchers -#include "../matchers/flannbased/matcher_flannbased.h" -#include "../matchers/bruteforce/matcher_bruteforce.h" -#include "../matchers/bruteforce_l1/matcher_bruteforce_l1.h" -#include "../matchers/bruteforce_hamming/matcher_bruteforce_hamming.h" -#include "../matchers/bruteforce_hamming_2/matcher_bruteforce_hamming_2.h" - -// Algorithms -#include "../algorithms/trackfeatures/alg_trackfeatures.h" - -// TODO: set as user parameters -//#define ROI_WIDTH 20 -//#define ROI_HEIGHT 20 -//#define MIN_FEATURES_TRACK 2 -//#define MATCHER_MIN_NORMALIZED_SCORE 0.85 +#include "../descriptors.h" +#include "../detectors.h" +#include "../matchers.h" +#include "../sensors.h" using namespace vision_utils; diff --git a/src/examples/test_descriptor.cpp b/src/examples/test_descriptor.cpp index 58b0825..f43fb97 100644 --- a/src/examples/test_descriptor.cpp +++ b/src/examples/test_descriptor.cpp @@ -2,38 +2,11 @@ #include <iomanip> #include <cstdlib> +#include "../descriptors.h" +// Vision Utils #include "../vision_utils.h" - -// Sensors -#include "../sensors/usb_cam/usb_cam.h" - -// Detectors -#include "../detectors/orb/detector_orb.h" -#include "../detectors/fast/detector_fast.h" -#include "../detectors/sift/detector_sift.h" -#include "../detectors/surf/detector_surf.h" -#include "../detectors/brisk/detector_brisk.h" -#include "../detectors/mser/detector_mser.h" -#include "../detectors/gftt/detector_gftt.h" -#include "../detectors/harris/detector_harris.h" -#include "../detectors/sbd/detector_sbd.h" -#include "../detectors/kaze/detector_kaze.h" -#include "../detectors/akaze/detector_akaze.h" -#include "../detectors/agast/detector_agast.h" - -// Descriptors -#include "../descriptors/orb/descriptor_orb.h" -#include "../descriptors/sift/descriptor_sift.h" -#include "../descriptors/surf/descriptor_surf.h" -#include "../descriptors/brisk/descriptor_brisk.h" -#include "../descriptors/kaze/descriptor_kaze.h" -#include "../descriptors/akaze/descriptor_akaze.h" -#include "../descriptors/latch/descriptor_latch.h" -#include "../descriptors/freak/descriptor_freak.h" -#include "../descriptors/brief/descriptor_brief.h" -#include "../descriptors/daisy/descriptor_daisy.h" -#include "../descriptors/lucid/descriptor_lucid.h" - +#include "../detectors.h" +#include "../sensors.h" int main(void) { diff --git a/src/examples/test_detector.cpp b/src/examples/test_detector.cpp index df23f6c..14d634a 100644 --- a/src/examples/test_detector.cpp +++ b/src/examples/test_detector.cpp @@ -2,24 +2,10 @@ #include <iomanip> #include <cstdlib> +#include "../detectors.h" +// Vision Utils #include "../vision_utils.h" - -// Sensors -#include "../sensors/usb_cam/usb_cam.h" - -// Detectors -#include "../detectors/orb/detector_orb.h" -#include "../detectors/fast/detector_fast.h" -#include "../detectors/sift/detector_sift.h" -#include "../detectors/surf/detector_surf.h" -#include "../detectors/brisk/detector_brisk.h" -#include "../detectors/mser/detector_mser.h" -#include "../detectors/gftt/detector_gftt.h" -#include "../detectors/harris/detector_harris.h" -#include "../detectors/sbd/detector_sbd.h" -#include "../detectors/kaze/detector_kaze.h" -#include "../detectors/akaze/detector_akaze.h" -#include "../detectors/agast/detector_agast.h" +#include "../sensors.h" int main(void) { diff --git a/src/examples/test_factories.cpp b/src/examples/test_factories.cpp index 2ad0f78..ba364f7 100644 --- a/src/examples/test_factories.cpp +++ b/src/examples/test_factories.cpp @@ -2,12 +2,9 @@ #include <iomanip> #include <cstdlib> -// Sensors -#include "../sensors/usb_cam/usb_cam.h" - -// Detectors -#include "../detectors/orb/detector_orb.h" -#include "../detectors/fast/detector_fast.h" +#include "../sensors.h" +// Vision Utils +#include "../vision_utils.h" int main(void) { @@ -33,7 +30,6 @@ int main(void) SensorBasePtr sen_b_ptr = setupSensor(sen_name, sen_name + "_test", vu_root + file_dot_yaml); SensorCameraPtr usb_cam_ptr = std::static_pointer_cast<SensorCamera>(sen_b_ptr); - return 0; } diff --git a/src/examples/test_matcher.cpp b/src/examples/test_matcher.cpp index fb75d8d..079c998 100644 --- a/src/examples/test_matcher.cpp +++ b/src/examples/test_matcher.cpp @@ -2,44 +2,12 @@ #include <iomanip> #include <cstdlib> +#include "../descriptors.h" +// Vision Utils #include "../vision_utils.h" - -// Sensors -#include "../sensors/usb_cam/usb_cam.h" - -// Detectors -#include "../detectors/orb/detector_orb.h" -#include "../detectors/fast/detector_fast.h" -#include "../detectors/sift/detector_sift.h" -#include "../detectors/surf/detector_surf.h" -#include "../detectors/brisk/detector_brisk.h" -#include "../detectors/mser/detector_mser.h" -#include "../detectors/gftt/detector_gftt.h" -#include "../detectors/harris/detector_harris.h" -#include "../detectors/sbd/detector_sbd.h" -#include "../detectors/kaze/detector_kaze.h" -#include "../detectors/akaze/detector_akaze.h" -#include "../detectors/agast/detector_agast.h" - -// Descriptors -#include "../descriptors/orb/descriptor_orb.h" -#include "../descriptors/sift/descriptor_sift.h" -#include "../descriptors/surf/descriptor_surf.h" -#include "../descriptors/brisk/descriptor_brisk.h" -#include "../descriptors/kaze/descriptor_kaze.h" -#include "../descriptors/akaze/descriptor_akaze.h" -#include "../descriptors/latch/descriptor_latch.h" -#include "../descriptors/freak/descriptor_freak.h" -#include "../descriptors/brief/descriptor_brief.h" -#include "../descriptors/daisy/descriptor_daisy.h" -#include "../descriptors/lucid/descriptor_lucid.h" - -// Matchers -#include "../matchers/flannbased/matcher_flannbased.h" -#include "../matchers/bruteforce/matcher_bruteforce.h" -#include "../matchers/bruteforce_l1/matcher_bruteforce_l1.h" -#include "../matchers/bruteforce_hamming/matcher_bruteforce_hamming.h" -#include "../matchers/bruteforce_hamming_2/matcher_bruteforce_hamming_2.h" +#include "../detectors.h" +#include "../matchers.h" +#include "../sensors.h" int main(void) { diff --git a/src/examples/test_sensor.cpp b/src/examples/test_sensor.cpp index f039953..3fa82af 100644 --- a/src/examples/test_sensor.cpp +++ b/src/examples/test_sensor.cpp @@ -2,8 +2,9 @@ #include <iomanip> #include <cstdlib> -// Sensors -#include "../sensors/usb_cam/usb_cam.h" +#include "../sensors.h" +// Vision Utils +#include "../vision_utils.h" int main(void) { diff --git a/src/matchers.h b/src/matchers.h new file mode 100644 index 0000000..268d950 --- /dev/null +++ b/src/matchers.h @@ -0,0 +1,13 @@ +#ifndef _MATCHERS_H_ +#define _MATCHERS_H_ + +#include "matchers/flannbased/matcher_flannbased.h" +#include "matchers/bruteforce/matcher_bruteforce.h" +#include "matchers/bruteforce_l1/matcher_bruteforce_l1.h" +#include "matchers/bruteforce_hamming/matcher_bruteforce_hamming.h" +#include "matchers/bruteforce_hamming_2/matcher_bruteforce_hamming_2.h" + +#endif /* _MATCHERS_H_ */ + + + diff --git a/src/matchers/bruteforce/matcher_bruteforce.h b/src/matchers/bruteforce/matcher_bruteforce.h index 2aee80f..92566a6 100644 --- a/src/matchers/bruteforce/matcher_bruteforce.h +++ b/src/matchers/bruteforce/matcher_bruteforce.h @@ -4,11 +4,6 @@ #include "../matcher_base.h" #include "../matcher_factory.h" -// yaml-cpp library -#ifdef USING_YAML - #include <yaml-cpp/yaml.h> -#endif - namespace vision_utils { // Create all pointers diff --git a/src/matchers/bruteforce_hamming/matcher_bruteforce_hamming.h b/src/matchers/bruteforce_hamming/matcher_bruteforce_hamming.h index bc2c160..637e1d2 100644 --- a/src/matchers/bruteforce_hamming/matcher_bruteforce_hamming.h +++ b/src/matchers/bruteforce_hamming/matcher_bruteforce_hamming.h @@ -4,11 +4,6 @@ #include "../matcher_base.h" #include "../matcher_factory.h" -// yaml-cpp library -#ifdef USING_YAML - #include <yaml-cpp/yaml.h> -#endif - namespace vision_utils { // Create all pointers diff --git a/src/matchers/bruteforce_hamming_2/matcher_bruteforce_hamming_2.h b/src/matchers/bruteforce_hamming_2/matcher_bruteforce_hamming_2.h index acec694..2928071 100644 --- a/src/matchers/bruteforce_hamming_2/matcher_bruteforce_hamming_2.h +++ b/src/matchers/bruteforce_hamming_2/matcher_bruteforce_hamming_2.h @@ -4,11 +4,6 @@ #include "../matcher_base.h" #include "../matcher_factory.h" -// yaml-cpp library -#ifdef USING_YAML - #include <yaml-cpp/yaml.h> -#endif - namespace vision_utils { // Create all pointers diff --git a/src/matchers/bruteforce_l1/matcher_bruteforce_l1.h b/src/matchers/bruteforce_l1/matcher_bruteforce_l1.h index 22c6ccc..d224e5c 100644 --- a/src/matchers/bruteforce_l1/matcher_bruteforce_l1.h +++ b/src/matchers/bruteforce_l1/matcher_bruteforce_l1.h @@ -4,11 +4,6 @@ #include "../matcher_base.h" #include "../matcher_factory.h" -// yaml-cpp library -#ifdef USING_YAML - #include <yaml-cpp/yaml.h> -#endif - namespace vision_utils { // Create all pointers diff --git a/src/matchers/flannbased/matcher_flannbased.h b/src/matchers/flannbased/matcher_flannbased.h index 8638a40..40b7c6b 100644 --- a/src/matchers/flannbased/matcher_flannbased.h +++ b/src/matchers/flannbased/matcher_flannbased.h @@ -4,11 +4,6 @@ #include "../matcher_base.h" #include "../matcher_factory.h" -// yaml-cpp library -#ifdef USING_YAML - #include <yaml-cpp/yaml.h> -#endif - namespace vision_utils { // Create all pointers diff --git a/src/matchers/matcher_base.cpp b/src/matchers/matcher_base.cpp index 4d15999..f2744b4 100644 --- a/src/matchers/matcher_base.cpp +++ b/src/matchers/matcher_base.cpp @@ -1,5 +1,10 @@ #include "matcher_base.h" +// yaml-cpp library +#ifdef USING_YAML + #include <yaml-cpp/yaml.h> +#endif + namespace vision_utils { MatcherBase::MatcherBase(void) @@ -171,6 +176,13 @@ MatcherBasePtr setupMatcher(const std::string& _type, const std::string& _unique ParamsBasePtr params_ptr = ParamsFactory::get().create(_type+" MAT", _filename_dot_yaml); return setupMatcher(_type, _unique_name, params_ptr); } +#else +MatcherBasePtr setupMatcher(const std::string& _type, const std::string& _unique_name, const std::string& _filename_dot_yaml) +{ + std::cerr << "[Vision utils]: Current version of the library has no YAML support. " + << "Try installing YAML-related libraries and recompile and reinstall the Vision Utils library." + << std::endl; +} #endif } /* namespace vision_utils */ diff --git a/src/matchers/matcher_base.h b/src/matchers/matcher_base.h index 43d79b3..ca33ef7 100644 --- a/src/matchers/matcher_base.h +++ b/src/matchers/matcher_base.h @@ -102,9 +102,7 @@ inline MatcherParamsBasePtr MatcherBase::getParams(void) { return params_base_pt * brief Setup and get the corresponding pointer */ MatcherBasePtr setupMatcher(const std::string& _type, const std::string& _unique_name, const ParamsBasePtr& _params); -#ifdef USING_YAML MatcherBasePtr setupMatcher(const std::string& _type, const std::string& _unique_name, const std::string& _filename_dot_yaml); -#endif } /* namespace vision_utils */ diff --git a/src/sensors.h b/src/sensors.h new file mode 100644 index 0000000..ac06809 --- /dev/null +++ b/src/sensors.h @@ -0,0 +1,6 @@ +#ifndef _SENSORS_H_ +#define _SENSORS_H_ + +#include "sensors/usb_cam/usb_cam.h" + +#endif /* _SENSORS_H_ */ diff --git a/src/sensors/sensor_base.cpp b/src/sensors/sensor_base.cpp index 8e69858..a36ef53 100644 --- a/src/sensors/sensor_base.cpp +++ b/src/sensors/sensor_base.cpp @@ -29,6 +29,13 @@ SensorBasePtr setupSensor(const std::string& _type, const std::string& _unique_n ParamsBasePtr params_ptr = ParamsFactory::get().create(_type, _filename_dot_yaml); return setupSensor(_type, _unique_name, params_ptr); } +#else +SensorBasePtr setupSensor(const std::string& _type, const std::string& _unique_name, const std::string& _filename_dot_yaml) +{ + std::cerr << "[Vision utils]: Current version of the library has no YAML support. " + << "Try installing YAML-related libraries and recompile and reinstall the Vision Utils library." + << std::endl; +} #endif } /* namespace vision_utils */ diff --git a/src/sensors/sensor_base.h b/src/sensors/sensor_base.h index 9021410..10e020e 100644 --- a/src/sensors/sensor_base.h +++ b/src/sensors/sensor_base.h @@ -55,9 +55,7 @@ inline void SensorBase::setName(const std::string& _name){ name_ = _name; } * brief Setup and get the corresponding pointer */ SensorBasePtr setupSensor(const std::string& _type, const std::string& _unique_name, const ParamsBasePtr& _intrinsics); -#ifdef USING_YAML SensorBasePtr setupSensor(const std::string& _type, const std::string& _unique_name, const std::string& _filename_dot_yaml); -#endif } /* namespace vision_utils */ diff --git a/src/sensors/usb_cam/usb_cam.h b/src/sensors/usb_cam/usb_cam.h index d389459..0046367 100644 --- a/src/sensors/usb_cam/usb_cam.h +++ b/src/sensors/usb_cam/usb_cam.h @@ -3,11 +3,6 @@ #include "../sensor_base.h" -// yaml-cpp library -#ifdef USING_YAML - #include <yaml-cpp/yaml.h> -#endif - namespace vision_utils { // Create all pointers diff --git a/src/vision_utils.cpp b/src/vision_utils.cpp index a54a00f..877cd3d 100644 --- a/src/vision_utils.cpp +++ b/src/vision_utils.cpp @@ -1,7 +1,9 @@ #include "vision_utils.h" // yaml-cpp library -#include <yaml-cpp/yaml.h> +#ifdef USING_YAML + #include <yaml-cpp/yaml.h> +#endif namespace vision_utils { @@ -212,6 +214,20 @@ void adaptRoi(const int& _inflation_rate, const cv::Mat& _image, cv::Rect& _roi, _image_roi = _image(_roi); }; +void retainBest(KeyPointVector& _kpts, int n) +{ + if (_kpts.size() > n) { + if (n == 0) { + _kpts.clear(); + return; + } + std::nth_element(_kpts.begin(), _kpts.begin() + n, _kpts.end(), + [](cv::KeyPoint& a, cv::KeyPoint& b) { return a.response > b.response; }); + _kpts.resize(n); + } +} + +#ifdef USING_YAML std::string readYamlType(const std::string& _filename_dot_yaml, const std::string& _type) { std::string type_read; @@ -225,19 +241,14 @@ std::string readYamlType(const std::string& _filename_dot_yaml, const std::strin return type_read; }; - -void retainBest(KeyPointVector& _kpts, int n) +#else +std::string readYamlType(const std::string& _filename_dot_yaml, const std::string& _type) { - if (_kpts.size() > n) { - if (n == 0) { - _kpts.clear(); - return; - } - std::nth_element(_kpts.begin(), _kpts.begin() + n, _kpts.end(), - [](cv::KeyPoint& a, cv::KeyPoint& b) { return a.response > b.response; }); - _kpts.resize(n); - } + std::cerr << "[Vision utils]: Current version of the library has no YAML support. " + << "Try installing YAML-related libraries and recompile and reinstall the Vision Utils library." + << std::endl; } +#endif } /* namespace vision_utils */ -- GitLab