[osg-users] ArUco (AR) with OSG

Igor Jurík madi9mail at gmail.com
Tue Feb 16 15:06:02 PST 2016


Hi,
I am trying to make ArUco (http://www.uco.es/investiga/grupos/ava/node/26) works with OSG.

I am using basic example from ArUco with OpenGL and I am creating same visualisation using OSG. When I draw cube by OpenGL, it is right on marker. When I use OSG cube is missplaced.

The core is rewrite projection and modelview matrices which I get from AruCo from OpenGL to OSG. I am using viewer.realize();, not viewer.run();

OpenGL:
glMatrixMode(GL_PROJECTION);
glLoadMatrixd(proj_matrix);

glMatrixMode(GL_MODELVIEW);
glLoadMatrixd(modelview_matrix);

OSG:
projectionMatrix.set(proj_matrix);
viewer->getCamera()->setProjectionMatrix(projectionMatrix);

modelViewMatrix.set(modelview_matrix);
viewer->getCamera()->setViewMatrix(modelViewMatrix);
(also tried viewer->getCameraManipulator()->setByMatrix(modelViewMatrix);)


I have tried lot of ways to make these two cubes (OpenGL and OSG) to overlap (add/remove camera manipulator, difference matrices, transpose matrices, ...), but no luck so far.

I tried to set own projection and modelview matrices to get the cubes on exact same place. I have tried basic identity matrix as projection matrix, but I had to change Z coordinate to -1 to get OSG cube in right place. Are coordinates systems different in OpenGL, OSG?

It is possible that projection matrix from ArUco is correct only for OpenGL and I need to adjust matrix before using it by OSG? Or could the problem be in my way of setting matrices using OSG?

I will be very glad for your opinions and help.
Thank you!

Cheers,
Igor

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=66314#66314








More information about the osg-users mailing list