I am using this example and try to add a point cloud visualization to it.
Essentially my code is modified code from the linked example:
PointTrackerTwoPass<GrayU8> tracker = FactoryPointTrackerTwoPass.klt(configKlt,
new ConfigGeneralDetector(600, 3, 1), GrayU8.class, GrayS16.class);
visualOdometry = FactoryVisualOdometry.depthDepthPnP(-1, 120, 2, 150, 100, true, sparseDepth, tracker,
GrayU8.class, GrayU16.class);
<...>
visualOdometry.process(grayScaleImage, depth));
Se3_F64 leftToWorld = visualOdometry.getCameraToWorld();
AccessPointTracks3D access = (AccessPointTracks3D) visualOdometry;
int N = access.getAllTracks().size();
for (int i = 0; i < N; i++) {
if (access.isInlier(i)) {
Point3D_F64 inlierWorld = new Point3D_F64();
Point3D_F64 inlierCamera = access.getTrackLocation(i);
georegression.transform.se.SePointOps_F64.transform(leftToWorld, inlierCamera, inlierWorld);
if (tree.add(new My3DPoint(inlierWorld.x, inlierWorld.y, inlierWorld.z)))
totalElementsInTree++;
it produces a point cloud, but it does not resemble my scene closely. Here is a top-to-bottom view of the cloud achieved by rotation of a kinect-camera around it's up-vector. Pictured is a corner of a room. As you see, instead of two straight walls connected in a right angle the code above produces series of arcs or curves. The effect gets even more pronounced if I set the first parameter of FactoryVisualOdometry.depthDepthPnP
to a positive integer.