Search in sources :

Example 1 with PyramidKltFeature

use of boofcv.alg.tracker.klt.PyramidKltFeature in project BoofCV by lessthanoptimal.

the class PointTrackerTwoPassKltPyramid method finishTracking.

@Override
public void finishTracking() {
    for (int i = 0; i < active.size(); ) {
        PyramidKltFeature t = active.get(i);
        if (tracker.setDescription(t)) {
            i++;
        } else {
            candidateDrop.add(t);
            active.remove(i);
        }
    }
    for (int i = 0; i < candidateDrop.size(); i++) {
        PyramidKltFeature t = candidateDrop.get(i);
        dropped.add(t);
        unused.add(t);
    }
    finishedTracking = true;
}
Also used : PyramidKltFeature(boofcv.alg.tracker.klt.PyramidKltFeature)

Example 2 with PyramidKltFeature

use of boofcv.alg.tracker.klt.PyramidKltFeature in project BoofCV by lessthanoptimal.

the class PointTrackerTwoPassKltPyramid method performSecondPass.

@Override
public void performSecondPass() {
    candidateDrop.clear();
    active.clear();
    for (int i = 0; i < originalActive.size(); i++) {
        PyramidKltFeature t = originalActive.get(i);
        KltTrackFault ret = tracker.track(t);
        boolean success = false;
        if (ret == KltTrackFault.SUCCESS) {
            // discard a track if its center drifts outside the image.
            if (BoofMiscOps.checkInside(input, t.x, t.y)) {
                active.add(t);
                PointTrack p = t.getCookie();
                p.set(t.x, t.y);
                success = true;
            }
        }
        if (!success) {
            candidateDrop.add(t);
        }
    }
}
Also used : PyramidKltFeature(boofcv.alg.tracker.klt.PyramidKltFeature) KltTrackFault(boofcv.alg.tracker.klt.KltTrackFault)

Example 3 with PyramidKltFeature

use of boofcv.alg.tracker.klt.PyramidKltFeature in project BoofCV by lessthanoptimal.

the class PointTrackerTwoPassKltPyramid method setHint.

@Override
public void setHint(double pixelX, double pixelY, PointTrack track) {
    PyramidKltFeature kltTrack = track.getDescription();
    kltTrack.setPosition((float) pixelX, (float) pixelY);
}
Also used : PyramidKltFeature(boofcv.alg.tracker.klt.PyramidKltFeature)

Example 4 with PyramidKltFeature

use of boofcv.alg.tracker.klt.PyramidKltFeature in project BoofCV by lessthanoptimal.

the class TestCombinedTrackerScalePoint method addTracks.

private void addTracks(List l, int num) {
    for (int i = 0; i < num; i++) {
        CombinedTrack t = new CombinedTrack();
        t.track = new PyramidKltFeature(2, 5);
        l.add(t);
    }
}
Also used : PyramidKltFeature(boofcv.alg.tracker.klt.PyramidKltFeature) DetectDescribePoint(boofcv.abst.feature.detdesc.DetectDescribePoint)

Example 5 with PyramidKltFeature

use of boofcv.alg.tracker.klt.PyramidKltFeature in project BoofCV by lessthanoptimal.

the class PointTrackerTwoPassKltPyramid method process.

@Override
public void process(I image) {
    this.input = image;
    finishedTracking = false;
    spawned.clear();
    dropped.clear();
    // update image pyramids
    basePyramid.process(image);
    declareOutput();
    PyramidOps.gradient(basePyramid, gradient, derivX, derivY);
    // setup active list
    originalActive.clear();
    originalActive.addAll(active);
    // track features
    candidateDrop.clear();
    active.clear();
    tracker.setImage(basePyramid, derivX, derivY);
    for (int i = 0; i < originalActive.size(); i++) {
        PyramidKltFeature t = originalActive.get(i);
        KltTrackFault ret = tracker.track(t);
        boolean success = false;
        if (ret == KltTrackFault.SUCCESS) {
            // discard a track if its center drifts outside the image.
            if (BoofMiscOps.checkInside(input, t.x, t.y)) {
                active.add(t);
                PointTrack p = t.getCookie();
                p.set(t.x, t.y);
                success = true;
            }
        }
        if (!success) {
            candidateDrop.add(t);
        }
    }
}
Also used : PyramidKltFeature(boofcv.alg.tracker.klt.PyramidKltFeature) KltTrackFault(boofcv.alg.tracker.klt.KltTrackFault)

Aggregations

PyramidKltFeature (boofcv.alg.tracker.klt.PyramidKltFeature)9 KltTrackFault (boofcv.alg.tracker.klt.KltTrackFault)2 GrayF32 (boofcv.struct.image.GrayF32)2 Test (org.junit.Test)2 DetectDescribePoint (boofcv.abst.feature.detdesc.DetectDescribePoint)1