Skip to content

Commit

Permalink
Rename ArucoCodeDetector to ArucoDetector
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterBowman committed Jun 18, 2024
1 parent 31fc54e commit 1cb8da2
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 52 deletions.
37 changes: 0 additions & 37 deletions libraries/YarpPlugins/ArucoCodeDetector/CMakeLists.txt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-

#include "ArucoCodeDetector.hpp"
#include "ArucoDetector.hpp"

#include <iostream>
#include <vector>

#include <yarp/os/LogComponent.h>
Expand All @@ -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();
Expand All @@ -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<yarp::sig::PixelBgr> inYarpImgBgr;
inYarpImgBgr.copy(inYarpImg);
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
37 changes: 37 additions & 0 deletions libraries/YarpPlugins/ArucoDetector/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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()
2 changes: 1 addition & 1 deletion libraries/YarpPlugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 1cb8da2

Please sign in to comment.