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;
}
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);
}
}
}
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);
}
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);
}
}
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);
}
}
}
Aggregations