OpenGL matrix from OpenCV matrix

asked 2016-01-22 05:02:37 -0500

iko79 gravatar image

Hi folks,

I desperately need some guideance here. This is actually supposed to be very simple as long as one has the necessary information at hand, but I can't find it in the documentation:

What I'm trying to do is to get a valid OpenGL matrix from an OpenCV matrix. I tried a lot but somehow I can't seem to get it right since there are too many unknowns. In detail, I'm using solvePnP to figure out the pose of a checker pattern and I'm trying to calculate the camera-to-object transformation matrix.

I would really appreciate somebody posting just the few lines of code it takes to do this correctly.

Bonus questions (but really I'm fine with just a few lines of code or a link to a working sample or detailled explaination, I'm confident that I can figure this out by my own as soon as I've got the code up and running):

  1. Are you using row-major or column-major layout?
  2. Are you using right handed or left handed coordinate frames?
  3. Which axes directions are you commonly using, so what's up, what's right, what's forward?

Thanks a ton, iko

edit retag flag offensive close merge delete

Comments

2

This link should help you:

In OpenCV, the camera frame used by solvePnP is right handed, the X-axis going to the right, the Y-axis going down and the Z-axis going forward.

Eduardo gravatar imageEduardo ( 2016-01-22 06:35:03 -0500 )edit