0

我正在使用 aruco 标记来获取机器人的位置。从estimatePoseSingleMarkers 获得姿势后,我获得给定标记的rvecs 和tvecs。由此我如何获得标记围绕每个轴的旋转角度。

我使用下面的代码来检测和绘制 aruco 标记及其轴

while(true)
{
    vector< vector<Point2f>> corners; //All the Marker corners 
    vector<int> ids;

    cap >> frame;
    cvtColor(frame, gray, CV_BGR2GRAY);

    aruco::detectMarkers(gray, dictionary, corners, ids);
    aruco::drawDetectedMarkers(frame,corners,ids);
    aruco::estimatePoseSingleMarkers(corners, arucoMarkerLength, cameraMatrix, distanceCoefficients, rvecs, tvecs);

    for(int i = 0; i < ids.size(); i++)
    {
        aruco::drawAxis(frame, cameraMatrix, distanceCoefficients, rvecs[i], tvecs[i], 0.1f);
    }

    imshow("Markers", frame);
    int key = waitKey(10);
    if((char)key == 'q')
        break;
}
4

1 回答 1

2

通过首先从旋转向量 (rvec) 中获取旋转矩阵,然后获取欧拉角,来获得标记相对于相机的旋转。 这里给出了将旋转矩阵转换为欧勒角

于 2017-11-10T08:06:07.090 回答