Aruco marker pose tracking method using fixed camera

asked 2018-06-05 15:26:02 -0500

kmath gravatar image

Here's some context: I'm trying to track an aruco marker on a robot using a camera placed at an unknown angle at a certain height. I have an aruco marker placed on the floor, which I use as my world frame and use it to calibrate the cameras. I need to get the position (x,y,z,roll,pitch,yaw) wrt the world frame. Here's what I do:

  • I use estimatePoseSingleMarkers() to track the world marker and I store the rvecs/tvecs somewhere
  • I run my main code which uses estimatePoseSingleMarkers() to detect the robot's rvecs/tvecs
  • I transform the world rvecs/tvecs to the camera frame and then compose that to the robot's rotation and translation vectors. I have tried and tested both composeRT() and Rodrigues()

I am definitely sure I have the aruco detection part all correct. I am able to detect each Aruco marker and able to draw their axes, so there's no problem there. The detection is very consistent. I have also gone through this '' and my code is very much in line with the answer there. However, I have some questions:

1. Is storing the rvecs/tvecs of the world marker the right way to go? How accurate are the stored values? Should I rather use a Charuco board to perform this calibration?

2. When I run the code to compute the pose (x,y,z, roll, pitch, yaw), I get highly inaccurate results. The pose values are either constant or rapidly switching to a ridiculous value like 2.3345e-245 or something. I see a change values when I move my robot but the numbers don't really make sense.

I have used the final composed rotation matrix (like this: and the translation vector directly. I have triple checked my code but I cannot find anything wrong. Is it my strategy? Or do you think I have maybe computed the rvecs, tvecs or the pose incorrectly?

Any help will be wonderful!

P.S. I am not sure if I can share my code here (its part of a larger project), but if you think you can help, I can definitely share some snippets over email.

edit retag flag offensive close merge delete


Storing your world marker should be correct.

For now, ignoring roll pitch yaw, are your x,y,z results good? That should be easy to check, using the output of composeRT, and some common sense with the robot. Put it on one side of the world marker, then the other, ect.

Tetragramm gravatar imageTetragramm ( 2018-06-05 21:12:22 -0500 )edit

Thanks for your reply, I had actually made a mistake (I was inversing the wrong matrix) and now I've corrected it. I have almost perfect roll pitch and yaw, and the x,y,z results make sense now but aren't very accurate. I might need to offset the pose to match my world coordinates. Shouldn't be difficult.

I have an additional question for you, in estimatePoseSingleMarkers(), which point am I tracking on the Aruco marker (which point is the origin)? Is it the origin corner or the center of the marker?

kmath gravatar imagekmath ( 2018-06-07 04:34:50 -0500 )edit

Looking at the results of drawAxis, it's the center of the marker.

Tetragramm gravatar imageTetragramm ( 2018-06-07 17:00:19 -0500 )edit