我正在使用 ArUco 标记来校正透视并计算图像中的大小。在这张图片中,我知道标记外边缘之间的确切距离,并使用它来计算黑色矩形的大小。
我的问题是它aruco::detectMarkers
并不总是能识别标记的真实边缘(如细节图所示)。当我根据标记的角校正透视时,它会导致失真,从而影响图像中对象的大小计算。
有没有办法提高边缘检测精度aruco::detectMarkers
?
这是整个电路板的按比例缩小的照片:
这是显示边缘检测不准确的左下标记的详细信息:
这是右上角标记的详细信息,显示了对同一标记 ID 的准确边缘检测:
在这个缩小的图像中很难看到,但左上角的标记是准确的,而右下角的标记是不准确的。
我的函数调用detectMarkers
:
bool findMarkers(const Mat image, Point2d outerMarkerCoordinates[], Point2d innerMarkerCoordinates[], Size2d *boardSize) {
Ptr<aruco::Dictionary> theDictionary = aruco::getPredefinedDictionary(aruco::DICT_4X4_1000);
vector<vector<Point2f> > markers;
vector<int> ids;
aruco::detectMarkers(image, theDictionary, markers, ids);
aruco::drawDetectedMarkers(image, markers, ids);
return true; //There's actually more code here that makes sure there are four markers.
}