diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 404490767897b8189a3e9b91a96ec0d09eaf1d94..480d47aaef918319f0882fccf493770937b87289 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 0000000000000000000000000000000000000000..c913d841c7ec45fa4ea520a17c75b941f203f53a --- /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 19a4d6acdd057ab2067d33fb133b30f344e4bc44..7a4007fd7e9f44d6e299dbbfbd40e161a2a954b0 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 6bbb87fc2ccfbd781047c56309f67e7814a48939..df3a03f5354163bc3c68988d479f1d54d75b4283 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 47e224a002f4386546510673bb29827ef90600af..0c1721cdb763f2b891863106c6b600b9b86e8a4d 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 da5b46881a8bac7bb57e9a18fdf6a11fffd1806f..f6831ce5043f7ef47fcd0d7abf1bc830bfca0094 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 0ad056b43970c1f102e3f68828021e963d95b041..32209cc5d8eb26d515e654782869b0822c8e6691 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 0000000000000000000000000000000000000000..61904c2bcdd296a9747a8c9ded9ca8fea637bc97 --- /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 11979d7ec0f9ba4199da372f09edbec8b3e4df60..3fbdee2647e4cd1a165ef8e1ac7f8c02698ae68b 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 a128d4a553bf3cb334f4168256491e7f0025fd02..42f9cfd09412df89ae718437e7a18651812fecce 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 59421a660f3b9b218f31e416693842e626a753f2..ee3f88445685f041beb7296db19286481c5e0b1c 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 9d949c2591694143d421fb62c69144db53654165..e30f84da0d407ecc7f335a77ea74360101988f43 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 af912459197525ab6a6b5ffaa698cce27107083f..5764bd3fd88f934005a1ec3913d8f02f84f59a53 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 94aca1178c13ea5b43bd0029dfbcabb72a9b1fdf..6103c2d36bc70b371fb8f43e4693bf06476e15c9 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 18cf5ca2f167e783646bbb974831890d29d9a4a6..96697fb12709046946e62e351666ad515356987c 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 4b0a8758ca16363f69f342920c28fc828471cd75..5b1b7a5a1be6ffacc2cbb036ee4065e0988d3409 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 56b0ae28beda43861934311a274b299a159a4409..db05b77fc0b7cf5c6079a83269429d8882ffdfe9 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 148021ac4a493bb3ea2d8cb28230dea898ec1fc6..6892f0111265a150e0bd1913443a994076f75305 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 5375c41cbddf862f5ab80f1cd39ab259f988f6ac..32d29677918c299e584a696662dbc80a6be557c4 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 25d2e0fc0975ed6e936671ae9934e85c1c773dbc..6bae1c655607db596defb85df890ccac9637f81a 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 191787282a47182f11eca4dcbc4550e81d2a6fce..23f3a7f4854f91c7d05a71151fe4b9ce1c7ecb0f 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 0000000000000000000000000000000000000000..80e1c08e99bfa7267bedf837ad65109ce733cfe9 --- /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 513dc9505f7200a17017b1e8f0388e79dc3df5f0..aa6c1beaadc03f1a6ef54b7478dce136a53b1425 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 95a1b97cb76e4fe7fae6558a4e4da788d3b325ba..f10f09d8d56a216322a06db026eb5743d345f5c1 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 d9eb10d527d38e6aaa1b09a941bd3f64e9202460..82ac22bbb431382af637c428ffed56183a289a70 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 33d24157793d0ff4f509eb4a63a56ed212e26732..9b4f930ed267a5ce311502632609e77c0116dc83 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 b377039f1fb2363aea7e8b5479a3625b13f33ca3..b5ae64d5ea3a64a19ac9e50fd9959b1164b13380 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 f22df6b3982c67f0f3eb10fed4d6031c3c3fdb54..4f97c58b3b3ef98944f6d4240090647d1894ecd9 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 fe788e25eb8c1c25a202811f0d7ab9bb906941b8..13ec7a899325e45bb48952a915a1f08802478f27 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 941f52460ca072c2060adcbb511e7427f4fa079f..7963185f9581e0cd2f05e1e4b5f3e15e7dff4ea4 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 da0d749e00696081fedbdc13f37bd38d9856e3d8..00558f3707cefbb9bfedcb0d7d814bf7d1b49d98 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 939feeb6feb364d272716fcebb7c55f0521aaaa0..b9c394d8ac27dcbe07b8f240dc11c3ad4a79b4a2 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 062e1496caf2870503505a86471916450c151845..f7431a4b6931e2368878ff6631751baf7f574236 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 7d104a31d17d022313ae3d700e149d085a34e96b..69574c6035ab5470cb77628ce0f14dd637408e35 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 436321dae2b77148fcd19b49053719f623b66954..434cae21338ab79b8142c9f271e7c9cb466dd9d5 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 304d89e357f013f7e470c88500d3f6b666bc72b3..0f7f7f45eb0c9bb0146192e20df46bad00da89dd 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 bd3c61b06c8fc7b7ffaaa5dba5bc5abe3a78fd8f..dcba80964362bb83ded535dd7339944f626c9441 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 c8e465d92b31c7a308d6b49540cc6eca6881516c..7ccd57f7dbdbd58ddf7b23b780953be20ebee0c0 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 e2c798cf0f592e3ff9e84a99bafe846d9000502f..ef0441b7c3d43be1448c047c4cddb1bc84759104 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 58b08256b6293beef5141841ed14043fd218083c..f43fb97e593198e865e046a02e50881553a8f14f 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 df23f6c54558f93541e9dbdb93c917171656d0fd..14d634a4f5eaa8fbd8c33b646cd45549a158fb84 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 2ad0f781b3e6af79a62f64eb18a01dcd2163785c..ba364f7eda735a98a26903cbcf756e434fb20ad3 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 fb75d8d9c7e2447ae67d11f979fcfa761da265e5..079c9988ccef81af8b61ad8a16c35d6d8a7af74e 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 f039953a24a97e790e3953e71bc8d4d1bd936208..3fa82af5388144cd88af4da67029365aa4fb0fb9 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 0000000000000000000000000000000000000000..268d950cd759a37be04152851122332d40baaf99 --- /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 2aee80f80b022110b794ec66697c96eb1bb6b48b..92566a6508c1d86951febf6f3da1e28c74f80bf4 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 bc2c1606ab38ae190fa79b5f699cfce82a03f260..637e1d2213b1459172ab85f708efe34a766b998a 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 acec6949a938d0b743c551a6150326fcd88bb7c3..292807129c5ff18d5515286764c7ddd14c927664 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 22c6cccf12f9fee5685b134997dc9d6ef7113b68..d224e5caf41b3e5d9176bd52d26ce4b47020e0d6 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 8638a40d217a04912f9f6408b2978b2fbd8fdd8b..40b7c6b16bed4ecafb56b1ed6c16e5f92543fb2d 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 4d15999b2587ef765bf069fb8ed505d8137d1324..f2744b4a76c72aec5cf86df890e3182dc6545cff 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 43d79b34b10edb7252f0eeb78f47fc5d70aa7d89..ca33ef785838b7a17a534c009499f09677913183 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 0000000000000000000000000000000000000000..ac068096d7988ed575f08424383da5fde902166c --- /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 8e698583743849cb8e4c25023afcbca62b4389f9..a36ef53afe6495d6ca1b9a941a7aab7fd8ba537e 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 9021410dd7e42a7de5dfdac9b22561fed6db6100..10e020e9086340b6b968c2775aadd4ecd7fb8175 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 d3894596fc188c302f151bfb1cdd8bafb93d85d0..0046367ccb4e4790ac2566afdd9131f881e0f8f1 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 a54a00f8fa5d046248b65c04c6f9a315fff4c646..877cd3d4939f3075249c3a253a21e8d7d85f31b7 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 */