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