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 'http://answers.opencv.org/question/122301/aruco-marker-tracking-with-fixed-camera/' 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: http://planning.cs.uiuc.edu/node103.html) 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.