0

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. enter image description here

Michael T
  • 339
  • 1
  • 2
  • 14
  • Did you calibrate your camera and invoke setCalibration() some place? – lessthanoptimal Dec 15 '16 at 21:26
  • yes, I did, and I have already found the problem in my code. The arcs are formed by the inliers from previous iterations. To solve my problem I have to add only new inliers to the scene: `if (access.isInlier(i) && (access.isNew(i)) {`. Thank your for the awesome library by the way – Michael T Dec 16 '16 at 09:16

0 Answers0