0

I am using aruco markers to get the location of a robot. After getting the pose from the estimatePoseSingleMarkers i obtain the rvecs and tvecs for a given marker. From this how could i obtain the rotated angle of the marker about each axis.

i used the code below to detect and draw the aruco markers along with its axis

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;
}
Yomal
  • 362
  • 2
  • 15
  • [Rodrigues](https://docs.opencv.org/master/d9/d0c/group__calib3d.html#ga61585db663d9da06b68e70cfbf6a1eac) – Miki Nov 09 '17 at 07:57
  • I checked it but it gives some values what i want is the angle rotated in degrees – Yomal Nov 09 '17 at 08:19

1 Answers1

2

The rotation of the marker with respect to the camera was obtained by first taking the rotation matrix from the rotation vector(rvec) and then by taking the euler angle. Converting Rotation matrix to Eurler angles are given here

Yomal
  • 362
  • 2
  • 15