Ask Your Question
0

Camera coordinates from solvePnP

asked 2016-11-16 23:49:03 -0600

I have a box with a square sticker attached to the side of it. I know the image plane coordinates of the vertices of the sticker and the dimensions of sticker and the box. Using solvePnP I am able to get rvecs and tvecs, and using cv2.projectPoints() I'm able to get estimate of the vertices of the box on the image plane. Using these information, how can I translate the coordinates of the vertices of the box to camera coordinates?

edit retag flag offensive close merge delete

Comments

I guess that this related Question could help? If not, I'm not quite sure what you want.

Vintez gravatar imageVintez ( 2016-11-17 01:45:57 -0600 )edit

Thanks for your reply! Attached the following image, hopefully will provide more clarity. http://www.tiikoni.com/tis/view/?id=7... I get the corners of the QR sticker using Zbar, which in this case is qr_corners = [[1169.93591309, 1793.27539062], [1177.9317627 , 2021.24707031], [1443.9107666 , 2020.03417969], [1445.08056641, 1788.99108887]]. qr_dimension = [[0., 0., 0.], [QR_WIDTH, 0., 0.], [QR_WIDTH, QR_WIDTH, 0.], [0., QR_WIDTH, 0.]] rvecs, tvecs, _ = cv2.solvePnPRansac(qr_dimension, qr_corners, mtx, dist). points = cv2.projectPoints(axis, rvecs, tvecs, mtx, dist), axis being the dimensions of the box. From this, points will be the pixel coordinates of the vertices of the box and that's how I draw it on the image. How can I translate these points to 3D coords?

lalala5 gravatar imagelalala5 ( 2016-11-17 13:38:11 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-11-17 21:26:25 -0600

Tetragramm gravatar image

You can switch between camera and world coordinates as follows:

Rodrigues(rvecold, R);
R = R.t();
tnew = -R*told;
Rodrigues(R, rvecnew);
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-11-16 23:49:03 -0600

Seen: 291 times

Last updated: Nov 17 '16