Search in sources :

Example 1 with PointTrack

use of boofcv.abst.feature.tracker.PointTrack in project BoofCV by lessthanoptimal.

the class ImageMotionPtkSmartRespawn method pruneClosePoints.

private void pruneClosePoints(PointTracker<I> tracker, int width, int height) {
    pruneClose.resize(width, height);
    // prune some of the ones which are too close
    prune.clear();
    pruneClose.process(tracker.getActiveTracks(null), prune);
    for (PointTrack t : prune) {
        tracker.dropTrack(t);
    }
}
Also used : PointTrack(boofcv.abst.feature.tracker.PointTrack)

Example 2 with PointTrack

use of boofcv.abst.feature.tracker.PointTrack in project BoofCV by lessthanoptimal.

the class PruneCloseTracks method process.

public void process(List<PointTrack> tracks, List<PointTrack> dropTracks) {
    int w = imgWidth / scale;
    int h = imgHeight / scale;
    int l = w * h;
    for (int i = 0; i < l; i++) pairImage[i] = null;
    for (int i = 0; i < tracks.size(); i++) {
        PointTrack p = tracks.get(i);
        int x = (int) (p.x / scale);
        int y = (int) (p.y / scale);
        int index = y * w + x;
        if (pairImage[index] == null) {
            pairImage[index] = p;
        } else {
            dropTracks.add(p);
        }
    }
}
Also used : PointTrack(boofcv.abst.feature.tracker.PointTrack)

Example 3 with PointTrack

use of boofcv.abst.feature.tracker.PointTrack in project BoofCV by lessthanoptimal.

the class VisOdomDualTrackPnP method refineMotionEstimate.

/**
 * Non-linear refinement of motion estimate
 */
private void refineMotionEstimate() {
    // use observations from the inlier set
    List<Stereo2D3D> data = new ArrayList<>();
    int N = matcher.getMatchSet().size();
    for (int i = 0; i < N; i++) {
        int index = matcher.getInputIndex(i);
        PointTrack l = candidates.get(index);
        LeftTrackInfo info = l.getCookie();
        PointTrack r = info.right;
        Stereo2D3D stereo = info.location;
        // compute normalized image coordinate for track in left and right image
        leftImageToNorm.compute(l.x, l.y, info.location.leftObs);
        rightImageToNorm.compute(r.x, r.y, info.location.rightObs);
        data.add(stereo);
    }
    // refine the motion estimate using non-linear optimization
    Se3_F64 keyToCurr = currToKey.invert(null);
    Se3_F64 found = new Se3_F64();
    if (modelRefiner.fitModel(data, keyToCurr, found)) {
        found.invert(currToKey);
    }
}
Also used : PointTrack(boofcv.abst.feature.tracker.PointTrack) Stereo2D3D(boofcv.struct.sfm.Stereo2D3D) ArrayList(java.util.ArrayList) DescribeRegionPoint(boofcv.abst.feature.describe.DescribeRegionPoint) Se3_F64(georegression.struct.se.Se3_F64)

Example 4 with PointTrack

use of boofcv.abst.feature.tracker.PointTrack in project BoofCV by lessthanoptimal.

the class VisOdomDualTrackPnP method dropUnusedTracks.

/**
 * Removes tracks which have not been included in the inlier set recently
 *
 * @return Number of dropped tracks
 */
private int dropUnusedTracks() {
    List<PointTrack> all = trackerLeft.getAllTracks(null);
    int num = 0;
    for (PointTrack t : all) {
        LeftTrackInfo info = t.getCookie();
        if (tick - info.lastInlier > thresholdRetire) {
            if (!trackerLeft.dropTrack(t))
                throw new IllegalArgumentException("failed to drop unused left track");
            if (!trackerRight.dropTrack(info.right))
                throw new IllegalArgumentException("failed to drop unused right track");
            num++;
        }
    }
    return num;
}
Also used : PointTrack(boofcv.abst.feature.tracker.PointTrack) DescribeRegionPoint(boofcv.abst.feature.describe.DescribeRegionPoint)

Example 5 with PointTrack

use of boofcv.abst.feature.tracker.PointTrack in project BoofCV by lessthanoptimal.

the class VisOdomDualTrackPnP method changePoseToReference.

/**
 * Updates the relative position of all points so that the current frame is the reference frame.  Mathematically
 * this is not needed, but should help keep numbers from getting too large.
 */
private void changePoseToReference() {
    Se3_F64 keyToCurr = currToKey.invert(null);
    List<PointTrack> all = trackerLeft.getAllTracks(null);
    for (PointTrack t : all) {
        LeftTrackInfo p = t.getCookie();
        SePointOps_F64.transform(keyToCurr, p.location.location, p.location.location);
    }
    concatMotion();
}
Also used : PointTrack(boofcv.abst.feature.tracker.PointTrack) Se3_F64(georegression.struct.se.Se3_F64)

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