From 1cb8da25971efa227220ff50d09d24912bcf9c1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20=C5=81ukawski?= Date: Tue, 18 Jun 2024 21:35:22 +0200 Subject: [PATCH] Rename ArucoCodeDetector to ArucoDetector --- .../ArucoCodeDetector/CMakeLists.txt | 37 ------------------- .../ArucoDetector.cpp} | 14 ++----- .../ArucoDetector.hpp} | 8 ++-- .../YarpPlugins/ArucoDetector/CMakeLists.txt | 37 +++++++++++++++++++ libraries/YarpPlugins/CMakeLists.txt | 2 +- 5 files changed, 46 insertions(+), 52 deletions(-) delete mode 100644 libraries/YarpPlugins/ArucoCodeDetector/CMakeLists.txt rename libraries/YarpPlugins/{ArucoCodeDetector/ArucoCodeDetector.cpp => ArucoDetector/ArucoDetector.cpp} (80%) rename libraries/YarpPlugins/{ArucoCodeDetector/ArucoCodeDetector.hpp => ArucoDetector/ArucoDetector.hpp} (76%) create mode 100644 libraries/YarpPlugins/ArucoDetector/CMakeLists.txt diff --git a/libraries/YarpPlugins/ArucoCodeDetector/CMakeLists.txt b/libraries/YarpPlugins/ArucoCodeDetector/CMakeLists.txt deleted file mode 100644 index f7faaa9a..00000000 --- a/libraries/YarpPlugins/ArucoCodeDetector/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -if(NOT DEFINED ENABLE_ArucoCodeDetector OR ENABLE_ArucoCodeDetector) - if(NOT TARGET opencv_objdetect OR NOT OpenCV_VERSION VERSION_GREATER_EQUAL 4.7) - message(WARNING "OpenCV objdetect module not found, disabling ArucoCodeDetector device") - elseif(NOT YARP_cv_FOUND) - message(WARNING "YARP_cv package not found, disabling ArucoCodeDetector device") - endif() -endif() - -yarp_prepare_plugin(ArucoCodeDetector - CATEGORY device - TYPE roboticslab::ArucoCodeDetector - INCLUDE ArucoCodeDetector.hpp - DEFAULT ON - DEPENDS "TARGET opencv_objdetect;OpenCV_VERSION VERSION_GREATER_EQUAL 4.7;YARP_cv_FOUND") - -if(NOT SKIP_ArucoCodeDetector) - - yarp_add_plugin(ArucoCodeDetector ArucoCodeDetector.hpp - ArucoCodeDetector.cpp) - - target_link_libraries(ArucoCodeDetector YARP::YARP_os - YARP::YARP_dev - YARP::YARP_cv - opencv_objdetect - opencv_core - ROBOTICSLAB::VisionInterfaces) - - yarp_install(TARGETS ArucoCodeDetector - LIBRARY DESTINATION ${ROBOTICSLAB-VISION_DYNAMIC_PLUGINS_INSTALL_DIR} - ARCHIVE DESTINATION ${ROBOTICSLAB-VISION_STATIC_PLUGINS_INSTALL_DIR} - YARP_INI DESTINATION ${ROBOTICSLAB-VISION_PLUGIN_MANIFESTS_INSTALL_DIR}) - -else() - - set(ENABLE_ArucoCodeDetector OFF CACHE BOOL "Enable/disable ArucoCodeDetector device" FORCE) - -endif() diff --git a/libraries/YarpPlugins/ArucoCodeDetector/ArucoCodeDetector.cpp b/libraries/YarpPlugins/ArucoDetector/ArucoDetector.cpp similarity index 80% rename from libraries/YarpPlugins/ArucoCodeDetector/ArucoCodeDetector.cpp rename to libraries/YarpPlugins/ArucoDetector/ArucoDetector.cpp index 5d31813a..9c3e530d 100644 --- a/libraries/YarpPlugins/ArucoCodeDetector/ArucoCodeDetector.cpp +++ b/libraries/YarpPlugins/ArucoDetector/ArucoDetector.cpp @@ -1,8 +1,7 @@ // -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- -#include "ArucoCodeDetector.hpp" +#include "ArucoDetector.hpp" -#include #include #include @@ -14,12 +13,12 @@ using namespace roboticslab; namespace { - YARP_LOG_COMPONENT(AC, "rl.ArucoCodeDetector") + YARP_LOG_COMPONENT(AC, "rl.ArucoDetector") } constexpr auto DEFAULT_ARUCO_SIZE = "ARUCO_ORIGINAL"; -bool ArucoCodeDetector::open(yarp::os::Searchable& config) +bool ArucoDetector::open(yarp::os::Searchable& config) { // default params detectorParams = cv::aruco::DetectorParameters(); @@ -44,7 +43,7 @@ bool ArucoCodeDetector::open(yarp::os::Searchable& config) return true; } -bool ArucoCodeDetector::detect(const yarp::sig::Image& inYarpImg, yarp::os::Bottle& detectedObjects) +bool ArucoDetector::detect(const yarp::sig::Image& inYarpImg, yarp::os::Bottle& detectedObjects) { yarp::sig::ImageOf inYarpImgBgr; inYarpImgBgr.copy(inYarpImg); @@ -73,11 +72,6 @@ bool ArucoCodeDetector::detect(const yarp::sig::Image& inYarpImg, yarp::os::Bott {"blx", yarp::os::Value(bl.x)}, {"bly", yarp::os::Value(bl.y)} }; - - /*yCDebug(AC) << "Top Left: " << tl.x << ", " << tl.y; - yCDebug(AC) << "Top Right: " << tr.x << ", " << tr.y; - yCDebug(AC) << "Bottom Right: " << br.x << ", " << br.y; - yCDebug(AC) << "Bottom Left: " << bl.x << ", " << bl.y;*/ } return true; diff --git a/libraries/YarpPlugins/ArucoCodeDetector/ArucoCodeDetector.hpp b/libraries/YarpPlugins/ArucoDetector/ArucoDetector.hpp similarity index 76% rename from libraries/YarpPlugins/ArucoCodeDetector/ArucoCodeDetector.hpp rename to libraries/YarpPlugins/ArucoDetector/ArucoDetector.hpp index 62b9394f..d7bba165 100644 --- a/libraries/YarpPlugins/ArucoCodeDetector/ArucoCodeDetector.hpp +++ b/libraries/YarpPlugins/ArucoDetector/ArucoDetector.hpp @@ -14,12 +14,12 @@ namespace roboticslab /** * @ingroup YarpPlugins - * @defgroup ArucoCodeDetector - * @brief Contains roboticslab::ArucoCodeDetector. + * @defgroup ArucoDetector + * @brief Contains roboticslab::ArucoDetector. */ -class ArucoCodeDetector : public yarp::dev::DeviceDriver, - public IDetector +class ArucoDetector : public yarp::dev::DeviceDriver, + public IDetector { public: bool open(yarp::os::Searchable& config) override; diff --git a/libraries/YarpPlugins/ArucoDetector/CMakeLists.txt b/libraries/YarpPlugins/ArucoDetector/CMakeLists.txt new file mode 100644 index 00000000..a667d730 --- /dev/null +++ b/libraries/YarpPlugins/ArucoDetector/CMakeLists.txt @@ -0,0 +1,37 @@ +if(NOT DEFINED ENABLE_ArucoDetector OR ENABLE_ArucoDetector) + if(NOT TARGET opencv_objdetect OR NOT OpenCV_VERSION VERSION_GREATER_EQUAL 4.7) + message(WARNING "OpenCV objdetect module not found, disabling ArucoDetector device") + elseif(NOT YARP_cv_FOUND) + message(WARNING "YARP_cv package not found, disabling ArucoDetector device") + endif() +endif() + +yarp_prepare_plugin(ArucoDetector + CATEGORY device + TYPE roboticslab::ArucoDetector + INCLUDE ArucoDetector.hpp + DEFAULT ON + DEPENDS "TARGET opencv_objdetect;OpenCV_VERSION VERSION_GREATER_EQUAL 4.7;YARP_cv_FOUND") + +if(NOT SKIP_ArucoDetector) + + yarp_add_plugin(ArucoDetector ArucoDetector.hpp + ArucoDetector.cpp) + + target_link_libraries(ArucoDetector YARP::YARP_os + YARP::YARP_dev + YARP::YARP_cv + opencv_objdetect + opencv_core + ROBOTICSLAB::VisionInterfaces) + + yarp_install(TARGETS ArucoDetector + LIBRARY DESTINATION ${ROBOTICSLAB-VISION_DYNAMIC_PLUGINS_INSTALL_DIR} + ARCHIVE DESTINATION ${ROBOTICSLAB-VISION_STATIC_PLUGINS_INSTALL_DIR} + YARP_INI DESTINATION ${ROBOTICSLAB-VISION_PLUGIN_MANIFESTS_INSTALL_DIR}) + +else() + + set(ENABLE_ArucoDetector OFF CACHE BOOL "Enable/disable ArucoDetector device" FORCE) + +endif() diff --git a/libraries/YarpPlugins/CMakeLists.txt b/libraries/YarpPlugins/CMakeLists.txt index 625507ce..18f6ac45 100644 --- a/libraries/YarpPlugins/CMakeLists.txt +++ b/libraries/YarpPlugins/CMakeLists.txt @@ -22,8 +22,8 @@ set_property(GLOBAL APPEND PROPERTY _exported_dependencies YARP_sig) add_library(ROBOTICSLAB::VisionInterfaces ALIAS VisionInterfaces) # YARP devices. +add_subdirectory(ArucoDetector) add_subdirectory(ColorRegionDetector) add_subdirectory(DnnDetector) add_subdirectory(HaarDetector) add_subdirectory(QrDetector) -add_subdirectory(ArucoCodeDetector)