Search in sources :

Example 36 with PointTrack

use of boofcv.abst.feature.tracker.PointTrack in project MAVSlam by ecmnet.

the class MAVOdomPixelDepthPnP method getObservation.

// MSP
public Point2D3D getObservation(int index) {
    List<PointTrack> active = tracker.getActiveTracks(null);
    PointTrack t = active.get(index);
    Point2D3D p = t.getCookie();
    pixelToNorm.compute(t.x, t.y, p.observation);
    return p;
}
Also used : Point2D3D(boofcv.struct.geo.Point2D3D) PointTrack(boofcv.abst.feature.tracker.PointTrack)

Example 37 with PointTrack

use of boofcv.abst.feature.tracker.PointTrack in project MAVSlam by ecmnet.

the class MAVOdomPixelDepthPnP method addNewTracks.

/**
 * Detects new features and computes their 3D coordinates
 */
private void addNewTracks() {
    // System.out.println("----------- Adding new tracks ---------------");
    tracker.spawnTracks();
    try {
        List<PointTrack> spawned = tracker.getNewTracks(null);
        // estimate 3D coordinate using stereo vision
        for (PointTrack t : spawned) {
            Point2D3DTrack p = t.getCookie();
            if (p == null) {
                t.cookie = p = new Point2D3DTrack();
            }
            // discard point if it can't localized
            if (!pixelTo3D.process(t.x, t.y) || pixelTo3D.getW() == 0) {
                tracker.dropTrack(t);
            } else {
                Point3D_F64 X = p.getLocation();
                X.set(pixelTo3D.getX(), pixelTo3D.getY(), pixelTo3D.getZ());
                lastTrackAdded.set(X);
                // translate the point into the key frame
                SePointOps_F64.transform(currToKey, X, X);
                // not needed since the current frame was just set to be the key
                // frame
                p.lastInlier = tick;
                pixelToNorm.compute(t.x, t.y, p.observation);
            }
        }
    } catch (Exception e) {
        System.err.println("Add new tracks: " + e.getMessage());
    }
}
Also used : Point3D_F64(georegression.struct.point.Point3D_F64) PointTrack(boofcv.abst.feature.tracker.PointTrack) Point2D3DTrack(boofcv.struct.sfm.Point2D3DTrack)

Aggregations

PointTrack (boofcv.abst.feature.tracker.PointTrack)37 Se3_F64 (georegression.struct.se.Se3_F64)9 Point2D3DTrack (boofcv.struct.sfm.Point2D3DTrack)8 ArrayList (java.util.ArrayList)7 DescribeRegionPoint (boofcv.abst.feature.describe.DescribeRegionPoint)6 Point2D3D (boofcv.struct.geo.Point2D3D)5 Point3D_F64 (georegression.struct.point.Point3D_F64)5 Stereo2D3D (boofcv.struct.sfm.Stereo2D3D)3 BufferedImage (java.awt.image.BufferedImage)3 Test (org.junit.Test)3 ConfigGeneralDetector (boofcv.abst.feature.detect.interest.ConfigGeneralDetector)2 PkltConfig (boofcv.alg.tracker.klt.PkltConfig)2 ImagePanel (boofcv.gui.image.ImagePanel)2 Webcam (com.github.sarxos.webcam.Webcam)2 Point2D_F64 (georegression.struct.point.Point2D_F64)2 AssociatedPairTrack (boofcv.alg.sfm.d2.AssociatedPairTrack)1 VisOdomMonoPlaneInfinity (boofcv.alg.sfm.d3.VisOdomMonoPlaneInfinity)1 ConvertBufferedImage (boofcv.core.image.ConvertBufferedImage)1 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)1 AssociatedIndex (boofcv.struct.feature.AssociatedIndex)1