我尝试从我的相机获取转换矩阵到 aruco 标记的中点,然后使用cv2.aruco.estimatePoseSingleMarkers
函数。
在描述中它说:
返回的转换是将点从每个标记坐标系转换到相机坐标系的转换。
我将标记检测结果的角点提供给姿势估计函数,并使用 cv2.Rodriguez 将旋转向量转换为旋转矩阵。生成的平移向量已经不同于从相机坐标到标记坐标的测量平移,据我所知,它应该是相同的。
不管推断如何,我初始化一个 4x4 变换矩阵,并将旋转矩阵和来自姿态估计的平移向量放入 4x4 矩阵,我假设它给出了从标记坐标系到相机坐标系的变换,但是当我更正变换时从环境的另一点来看,它表明变换矩阵不正确。
我确信MARKER_SIZE。
marker2camera_r_vec, marker2camera_t_vec, _ = cv2.aruco.estimatePoseSingleMarkers(corners, MARKER_SIZE, camera.mtx, camera.dist)
marker2camera_r_mat = np.array(cv2.Rodrigues(marker2camera_r_vec)[0])
transformation_matrix = np.zeros([4, 4])
transformation_matrix[0:3, 0:3] = rotation_matrix
transformation_matrix[0:3, 3] = translation_vector
transformation_matrix[3, 3] = 1
Example results:
marker2camera_r_mat =
[[-0.96533802 -0.03093691 -0.25916292],
[ 0.07337548 0.92073721 -0.38322189],
[ 0.25047664 -0.38895487 -0.88655263]]
marker2camera_t_vec =
[ 1.45883855 6.98282269 77.73744481]
transformation_matrix =
[[-9.65338018e-01 -3.09369077e-02 -2.59162919e-01 1.45883855e+00],
[ 7.33754824e-02 9.20737214e-01 -3.83221895e-01 6.98282269e+00],
[ 2.50476645e-01 -3.88954869e-01 -8.86552627e-01 7.77374448e+01],
[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 1.00]]
Actual point coordinates of the marker from the camera coordinates is =
[-0.086 0.12 0.83]
谁能告诉我我做错了什么,并解释通过 获取从相机坐标到标记坐标的变换矩阵的步骤cv2.aruco.estimatePoseSingleMarkers
?