Drawing a new coordinate system (B) based on other known coordinate system (A) in opencv 4.0.0

asked 2019-01-03 03:52:30 -0600

MedoCV gravatar image

Hello ,

I have :

1- Rotation vector and translation vector of coordinate system (A) relative to camera (using Solvepnp()) .

2- constant Rotation "matrix" and translation vector between two coordinate systems ( A and B ).

3- 3d Point of the origin (B) relative to camera and the Pixel of (B).

I want only to translate a coordinate system (point A) and rotate it about Axis Z to make a coordinate (B) . so after multiplying matrices i obtained rotation vector and translation vector of coordinate system (B) relative to camera.

but how can i draw this coordinate ?

I used (cv::projectPoints()) for Drawing this coordinate (B) but the result was strange (see please in 2. image).

image description

image description

edit retag flag offensive close merge delete

Comments

1

can you show, what you tried ? (code)

the coord system in the drawing seems to be wrong (x-axis pointing into the wrong direction)

berak gravatar imageberak ( 2019-01-03 03:58:34 -0600 )edit

From solvePnP you have the following transformation: P_cam = T_A2cam x P_A.

If you have the fixed transformation between A and B: P_A = T_B2A x P_B, to draw the frame B you will have to update the rotation matrix and the translation vector with the following: P_cam = T_A2cam x T_B2A x P_B. With P_cam, you just have to project to the camera image plane using the intrinsic parameters.

Eduardo gravatar imageEduardo ( 2019-01-05 21:17:49 -0600 )edit
1

hello @MedoCV i was playing around and trying to implement something similar.. i get also some issues when i start rotating, i can just rotate upon the 'Z' axis.. on the other axis i get a bad projection, using null translation vector, identity matrix as cameraMatrix and no distortions coefficients..maybe some missing step?, could you post what you are trying?. I created a gist with my procedure.. https://gist.github.com/richipower/9c...

aguila gravatar imageaguila ( 2019-01-09 03:01:07 -0600 )edit