OpenCV中AprilTag与ArUco标记角点顺序为何不同?特性还是Bug?
关于OpenCV 4.9.0中ArUco与AprilTag角点顺序差异的问题
我正在使用OpenCV 4.9.0及ArUco Detector,代码如下:
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:

根据OpenCV官方文档描述,预期角点顺序为左上、右上、右下、左下。但AprilTag标记的角点顺序却是右下、左下、左上、右上,仿佛绕Z轴旋转了180度,ArUco标记的顺序则符合预期。请问这是OpenCV的特性还是Bug?
这是OpenCV的设计特性,而非Bug。原因在于AprilTag与ArUco标记的角点定义规则源自各自的原生设计:
- ArUco标记的角点顺序以标记的可读姿态(ID正向显示)为基准,遵循左上→右上→右下→左下的顺序;
- AprilTag的检测逻辑延续了其原始库的规范,角点顺序以标记的编码原点(通常为右下位置)为起始点,因此输出的顺序看起来像是旋转了180度。
OpenCV的ArUco Detector在兼容两种标记类型时,保留了它们各自原生的角点定义,确保与对应标记系统的实现一致,方便用户适配不同的应用场景。
内容的提问来源于stack exchange,提问作者BetterCallBene
相关产品推荐
相关产品推荐

