Get position of Aruco marker in world’s coordinate to compare with the real distance

  aruco, augmented-reality, c++, opencv

I work on a project with aruco markers with OpenCV and I want to compare some parameters :

  1. I’m going to enter the distance between the marker and camera for example 30cm/0.03m, the size of the marker and the orientation.

  2. Then I’m going to do the marker detection and the pose estimation : I can see on my screen that the axis are drawn on the marker

And now I want get the marker’s position that the camera has calculated to compare if the distance is the same or not.

The marker’s position that the camera has calculated, I think there are in the camera’s coordinates but I want them in world coordinates.

When I searched in OpenCV’s docs and in StackOverflow, I understood that tvecs is the translation vector so the position of my marker and rvecs is the rotation of my marker but the both in camera’s coordinates.
Some of the others topics talk about Rodrigues function or about camera’s coordinates so I don’t think it can help me, because I want to compare distance so I need the same landmark.
If what am I saying is true, I need to transform tvecs and rvecs to get the world coordinate of my marker.

A little print to explain my results :
(in order : FOUND, i, rvec[i], tvec[i]) -> i is index that represents the number of detected markers

[1.62518, 1.07437, -0.872242]
[-0.3794, -0.0123949, 1.4374]

[1.62059, 1.08047, -0.901514]
[-0.378006, -0.0120786, 1.43043]

I put my marker at 24cm of my camera so as I say : [-0.3794, -0.0123949, 1.4374] I think this is the camera’s coordinate.

How can use the results tvecs and rvecs to get the world’s coordinate and get approximately 24cm for the position and compare with the position that I have enter ?

(I work with C++ and aruco in OpenCV but if the answer is with an other language it’s fine, I think the principle is the same)

Source: Windows Questions C++