Skip to content

Commit a350ab0

Browse files
Fix new opencv aruco api (backport #1072) (#1073)
This fix is based on ros/meta-ros@719fe6e. I have not found any matching PR here. This also fixes compiling for jazzy.<hr>This is an automatic backport of pull request #1072 done by [Mergify](https://mergify.com). Co-authored-by: Bernd Müller <github@muellerbernd.de>
1 parent 6a55dbb commit a350ab0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

image_proc/src/track_marker.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,17 @@ TrackMarkerNode::TrackMarkerNode(const rclcpp::NodeOptions & options)
6666
// Default dictionary is cv::aruco::DICT_6X6_250
6767
int dict_id = this->declare_parameter("dictionary", 10);
6868

69+
#if CV_VERSION_MAJOR > 4 || CV_VERSION_MAJOR == 4 && CV_VERSION_MINOR >= 7
70+
detector_params_ = cv::makePtr<cv::aruco::DetectorParameters>();
71+
#else
6972
detector_params_ = cv::aruco::DetectorParameters::create();
73+
#endif
74+
75+
#if CV_VERSION_MAJOR > 4 || CV_VERSION_MAJOR == 4 && CV_VERSION_MINOR >= 7
76+
dictionary_ = cv::makePtr<cv::aruco::Dictionary>(cv::aruco::getPredefinedDictionary(dict_id));
77+
#else
7078
dictionary_ = cv::aruco::getPredefinedDictionary(dict_id);
79+
#endif
7180

7281
// Setup lazy subscriber using publisher connection callback
7382
rclcpp::PublisherOptions pub_options;

0 commit comments

Comments
 (0)