I am not able to implement augmented reality using the viz3d module. After getting the pose information somehow (by feature matching) I am doing the following standard steps:
viz::Viz3d vWindow("Viz3D");
viz::Camera vcam(vcammat, Size(640, 480)); //vcammat contains the intrinsic which is calculated beforehand and loaded.
vWindow.setCamera(vcam);
vWindow.setBackgroundTexture(frame_vis); //background frame for augmented reality
vWindow.setViewerPose(pose); //pose got by by solvepnp
vWindow.setCamera(vcam);
vWindow.showWidget("mesh", vwidget); //some mesh read before
vWindow.spinOnce(30, true); //this entire thing is in a loop
the pose got is correct as I am able to do a very good overlay of the mesh when I manually draw it in the image using its projected (by pose
and intrinsic inside vcammat
) points of the mesh. But in the viz3d window I get the window completely occluded by the mesh.
Anyone successfully used opencv viz3d module for augmented reality? Any reason why it is failing ?