为什么在OpenCV中的Apriltag和Aruco标记之间的传入拐角的顺序是不同的? 我正在使用OpenCV/4.9.0和Aruco检测器。我的代码看起来像这样: const auto image = cv :: imread('tagfile.png',imread_grayscale); const auto family = cv :: aruco :: predefined -dictionarytype ::

问题描述 投票:0回答:0
const auto image = cv::imread('tagfile.png', IMREAD_GRAYSCALE); const auto family = cv::aruco::PredefinedDictionaryType::<family>; cv::aruco::ArucoDetector detector {cv::aruco::getPredefinedDictionary(family)}; auto ids = std::vector<int>{}; auto markers = std::vector<std::vector<::cv::Point2f>>{}; detector.detectMarkers(image, markers, ids); for (const auto& marker : markers) { const auto top_left = marker[0]; const auto top_right = marker[1]; const auto bottom_right = marker[2]; const auto bottom_left = marker[3]; std::cout << "top_left: " << top_left << std::endl; std::cout << "top right: " << top_right << std::endl; std::cout << "bottom right: " << bottom_right << std::endl; std::cout << "bottom left: " << bottom_left << std::endl; }

我正在使用以下图像作为输入: DICT_6X6_1000:

DICT_APRILTAG_25H9:DICT_6X6_1000

预期的转角顺序如“ documentation”中描述的左上,右上,右下和左下。

但对于apriltagDICT_APRILTAG_25h9,我得到了以下顺序:右下,左下,左上和右上角。 似乎以180度围绕Z轴旋转Apriltag图案。 Aruco标记是正确的顺序。所以我的问题在这里,opencv的功能或错误。

我不确定OpenCV为什么这样做,但这是我用来修复它的Python代码:

corner_arrays, id_array, rejected_img_points_arrays = detector.detectMarkers(image) match dictionary_num: case cv2.aruco.DICT_APRILTAG_16H5 | cv2.aruco.DICT_APRILTAG_25H9 | cv2.aruco.DICT_APRILTAG_36H10 | cv2.aruco.DICT_APRILTAG_36H11: corner_arrays = [np.roll(corner_array, 2, axis=1) for corner_array in corner_arrays]

c++ opencv augmented-reality aruco apriltags
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.