图像平面中的ArUco标记坐标

问题描述 投票:0回答:1

使用 OpenCV v3.1,我检测到 ArUco 标记,并使用

aruco::estimatePoseSingleMarkers(corners, markerLength, camMatrix, distCoeffs, rvecs,tvecs);

我可以获得所述标记从标记坐标系到相机坐标系的旋转和平移向量。

但是,我只需要图像平面中标记的 xy 坐标(以像素为单位)。我该怎么办呢?

我发现this有些相关,但这又是关于相机坐标系的。

c++ opencv marker aruco
1个回答
0
投票

Python: 从检测到的 ArUco 标记获取图像内的像素坐标,您可以按如下方式使用此代码:

detector = cv.aruco.ArucoDetector(aruco_dict, detetc_params)

for (marker, id) in zip(corners, ids): 
    corner = marker.reshape((4, 2))
    (tl, tr, br, bl) = corner
    cx = (tl[0] + br[0]) / 2
    cy = (tl[1] + br[1]) / 2

print(cx, cy, "cx /cy")

cv.circle(frame, (int(cx), int(cy)), 4, (255, 255, 1), 2) # Using this to draw a circle on the frame of the center point. 
最新问题
© www.soinside.com 2019 - 2024. All rights reserved.