Skip to content

Commit

Permalink
Add Aruco3 detection parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
bjsowa committed May 7, 2024
1 parent 2b80e17 commit 41c3210
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
12 changes: 12 additions & 0 deletions aruco_opencv/config/aruco_tracker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,15 @@

# to check if there is a white marker
detectInvertedMarker: false

# (required OpenCV 4.6.0+) enable the new and faster Aruco detection strategy.
# Proposed in the paper:
# Romero-Ramirez et al: Speeded up detection of squared fiducial markers (2018)
# https://www.researchgate.net/publication/325787310_Speeded_Up_Detection_of_Squared_Fiducial_Markers
useAruco3Detection: false

# (required OpenCV 4.6.0+) minimum side length of a marker in the canonical image. Latter is the binarized image in which contours are searched
minSideLengthCanonicalImg: 32

# (required OpenCV 4.6.0+) range [0,1], eq (2) from paper. The parameter tau_i has a direct influence on the processing speed.
minMarkerLengthRatioOriginalImg: 0.0
34 changes: 34 additions & 0 deletions aruco_opencv/include/aruco_opencv/parameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,17 @@ inline void declare_aruco_parameters(NodeT && node)
default_parameters->cornerRefinementMinAccuracy, 0.01, 1.0);
declare_param(node,
"aruco.detectInvertedMarker", default_parameters->detectInvertedMarker, true);

#if CV_VERSION_MAJOR > 4 || CV_VERSION_MAJOR == 4 && CV_VERSION_MINOR >= 6
declare_param(node,
"aruco.useAruco3Detection", default_parameters->useAruco3Detection, true);
declare_param_int_range(node,
"aruco.minSideLengthCanonicalImg",
default_parameters->minSideLengthCanonicalImg, 1, 100);
declare_param_double_range(node,
"aruco.minMarkerLengthRatioOriginalImg",
default_parameters->minMarkerLengthRatioOriginalImg, 0.0, 1.0);
#endif
}

template<class NodeT>
Expand Down Expand Up @@ -201,6 +212,15 @@ void retrieve_aruco_parameters(
node.get_parameter(
"aruco.detectInvertedMarker", detector_parameters->detectInvertedMarker);

#if CV_VERSION_MAJOR > 4 || CV_VERSION_MAJOR == 4 && CV_VERSION_MINOR >= 6
node.get_parameter(
"aruco.useAruco3Detection", detector_parameters->useAruco3Detection);
node.get_parameter(
"aruco.minSideLengthCanonicalImg", detector_parameters->minSideLengthCanonicalImg);
node.get_parameter(
"aruco.minMarkerLengthRatioOriginalImg", detector_parameters->minMarkerLengthRatioOriginalImg);
#endif

if (log_values) {
RCLCPP_INFO_STREAM(
node.get_logger(),
Expand Down Expand Up @@ -269,6 +289,20 @@ void retrieve_aruco_parameters(
node.get_logger(),
" * detectInvertedMarker: " <<
(detector_parameters->detectInvertedMarker ? "TRUE" : "FALSE"));

#if CV_VERSION_MAJOR > 4 || CV_VERSION_MAJOR == 4 && CV_VERSION_MINOR >= 6
RCLCPP_INFO_STREAM(
node.get_logger(),
" * useAruco3Detection: " <<
(detector_parameters->useAruco3Detection ? "TRUE" : "FALSE"));
RCLCPP_INFO_STREAM(
node.get_logger(),
" * minSideLengthCanonicalImg: " << detector_parameters->minSideLengthCanonicalImg);
RCLCPP_INFO_STREAM(
node.get_logger(),
" * minMarkerLengthRatioOriginalImg: " <<
detector_parameters->minMarkerLengthRatioOriginalImg);
#endif
}
}

Expand Down

0 comments on commit 41c3210

Please sign in to comment.