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):
- Are you using row-major or column-major layout?
- Are you using right handed or left handed coordinate frames?
- Which axes directions are you commonly using, so what's up, what's right, what's forward?
Thanks a ton, iko
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.