use of boofcv.abst.feature.tracker.PointTrack in project BoofCV by lessthanoptimal.
the class VisOdomDualTrackPnP method mutualTrackDrop.
/**
* If a track was dropped in one image make sure it was dropped in the other image
*/
private void mutualTrackDrop() {
for (PointTrack t : trackerLeft.getDroppedTracks(null)) {
LeftTrackInfo info = t.getCookie();
trackerRight.dropTrack(info.right);
}
for (PointTrack t : trackerRight.getDroppedTracks(null)) {
RightTrackInfo info = t.getCookie();
// a track could be dropped twice here, such requests are ignored by the tracker
trackerLeft.dropTrack(info.left);
}
}
use of boofcv.abst.feature.tracker.PointTrack in project BoofCV by lessthanoptimal.
the class VisOdomDualTrackPnP method addNewToList.
private void addNewToList(T image, List<PointTrack> tracks, FastQueue<Point2D_F64> points, FastQueue<Desc> descs) {
describe.setImage(image);
points.reset();
descs.reset();
for (int i = 0; i < tracks.size(); i++) {
PointTrack t = tracks.get(i);
// ignoring the return value. most descriptors never return false and the ones that due will rarely do so
describe.process(t.x, t.y, 0, 2, descs.grow());
points.add(t);
}
}
use of boofcv.abst.feature.tracker.PointTrack in project BoofCV by lessthanoptimal.
the class VisOdomMonoPlaneInfinity 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 = tracker.getAllTracks(null);
int num = 0;
for (PointTrack t : all) {
VoTrack p = t.getCookie();
if (tick - p.lastInlier > thresholdRetire) {
tracker.dropTrack(t);
num++;
}
}
return num;
}
use of boofcv.abst.feature.tracker.PointTrack in project BoofCV by lessthanoptimal.
the class VisOdomMonoPlaneInfinity method sortTracksForEstimation.
/**
* Splits the set of active tracks into on plane and infinity sets. For each set also perform specific sanity
* checks to make sure basic constraints are still being meet. If not then the track will not be considered for
* motion estimation.
*/
private void sortTracksForEstimation() {
// reset data structures
planeSamples.reset();
farAngles.reset();
tracksOnPlane.clear();
tracksFar.clear();
// list of active tracks
List<PointTrack> active = tracker.getActiveTracks(null);
for (PointTrack t : active) {
VoTrack p = t.getCookie();
// compute normalized image coordinate
pixelToNorm.compute(t.x, t.y, n);
// rotate pointing vector into plane reference frame
pointing.set(n.x, n.y, 1);
GeometryMath_F64.mult(cameraToPlane.getR(), pointing, pointing);
pointing.normalize();
if (p.onPlane) {
// see if it still intersects the plane
if (pointing.y > 0) {
// create data structure for robust motion estimation
PlanePtPixel ppp = planeSamples.grow();
ppp.normalizedCurr.set(n);
ppp.planeKey.set(p.ground);
tracksOnPlane.add(t);
}
} else {
// if the point is not on the plane visually and (optionally) if it passes a strict y-axis rotation
// test, consider using the point for estimating rotation.
boolean allGood = pointing.y < 0;
if (strictFar) {
allGood = isRotationFromAxisY(t, pointing);
}
// is it still above the ground plane and only has motion consistent with rotation on ground plane axis
if (allGood) {
computeAngleOfRotation(t, pointing);
tracksFar.add(t);
}
}
}
}
use of boofcv.abst.feature.tracker.PointTrack in project BoofCV by lessthanoptimal.
the class VisOdomMonoPlaneInfinity method estimateFar.
/**
* Estimates only rotation using points at infinity. A robust estimation algorithm is used which finds an angle
* which maximizes the inlier set, like RANSAC does. Unlike RANSAC this will produce an optimal result.
*/
private void estimateFar() {
// do nothing if there are objects at infinity
farInlierCount = 0;
if (farAngles.size == 0)
return;
farAnglesCopy.reset();
farAnglesCopy.addAll(farAngles);
// find angle which maximizes inlier set
farAngle = maximizeCountInSpread(farAnglesCopy.data, farAngles.size, 2 * thresholdFarAngleError);
// mark and count inliers
for (int i = 0; i < tracksFar.size(); i++) {
PointTrack t = tracksFar.get(i);
VoTrack p = t.getCookie();
if (UtilAngle.dist(farAngles.get(i), farAngle) <= thresholdFarAngleError) {
p.lastInlier = tick;
farInlierCount++;
}
}
}
Aggregations