how to find the rotated angle of aruco marker

asked 2017-11-09 02:45:07 -0500

yomal gravatar image

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;
}
edit retag flag offensive close merge delete

Comments

you can use rodrigues function (see wikipedia)

LBerger gravatar imageLBerger ( 2017-11-09 03:06:10 -0500 )edit

Rotated relative to what?

You need to define some reference direction along the plane of the marker. Once you define that, it should be easy, but doing so is a matter of your specific problem, and not something we can help you with.

Tetragramm gravatar imageTetragramm ( 2017-11-09 18:03:51 -0500 )edit