0

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

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


FOUND 
0
[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)

Newbi
  • 31
  • 6
  • for world coordinates you will either need a gps and compass in your system, then just transform points from camera coordinate system to real wotl coordinate system by T*p where T is the 4x4 transformation mateix describing the gps coordinates of the camera (translation) and the orientation from compass (rotation). – Micka Apr 04 '21 at 00:37
  • @Micka I don't really understand why you speak about GPS and compass. ` cv::aruco::estimatePoseSingleMarkers(corners, 0.01, cameraMatrix, distCoeffs, rvecs, tvecs)` I have done the estimation Pose and the markers are detected by my camera and tvecs and rvecs are calculated by the camera and I think it is the position of my marker but in camera's coordinate. I need to do an operation to transform the coordinate system of theses vectors like : result = X * tvecs[i] for example which X is unknown because I don't know what is the operation for camera system -> world system – Newbi Apr 04 '21 at 15:44
  • (world system-> camera system is done by the estimation function I think) – Newbi Apr 04 '21 at 15:49
  • if you have extrinsics of your camera just ignore the gps/compass info and replace it by the known camera extrinsincs. If you dont have camera extrinsics you will need some information about the global information of your camera OR your marker. GPS/compass could provide such information. – Micka Apr 04 '21 at 16:05

0 Answers0