Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenGL matrix from OpenCV matrix

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