use of boofcv.factory.tracker.ConfigPointTracker in project BoofCV by lessthanoptimal.
the class ExampleMultiViewSparseReconstruction method similarImagesFromSequence.
/**
* For a pairwise graph to be constructed, image feature relationships between frames are needed. For a video
* sequence, KLT is an easy and fast way to do this. However, KLT will not "close the loop", and it will
* not realize you're back at the initial location. Typically this results in a noticeable miss alignment.
*/
private void similarImagesFromSequence() {
System.out.println("----------------------------------------------------------------------------");
System.out.println("### Creating Similar Images from an ordered set of images");
// Configure the KLT tracker
ConfigPointTracker configTracker = FactorySceneRecognition.createDefaultTrackerConfig();
PointTracker<GrayU8> tracker = FactoryPointTracker.tracker(configTracker, GrayU8.class, null);
var activeTracks = new ArrayList<PointTrack>();
var config = new ConfigSimilarImagesTrackThenMatch();
final var dbSimilar = FactorySceneReconstruction.createTrackThenMatch(config, ImageType.SB_U8);
dbSimilar.setVerbose(System.out, BoofMiscOps.hashSet(BoofVerbose.RECURSIVE));
// Track features across the entire sequence and save the results
BoofMiscOps.profile(() -> {
boolean first = true;
for (int frameId = 0; frameId < imageFiles.size(); frameId++) {
String filePath = imageFiles.get(frameId);
GrayU8 frame = UtilImageIO.loadImage(filePath, GrayU8.class);
Objects.requireNonNull(frame, "Failed to load image");
if (first) {
first = false;
dbSimilar.initialize(frame.width, frame.height);
dbCams.addCameraCanonical(frame.width, frame.height, 60.0);
}
tracker.process(frame);
int activeCount = tracker.getTotalActive();
int droppedCount = tracker.getDroppedTracks(null).size();
tracker.spawnTracks();
tracker.getActiveTracks(activeTracks);
dbSimilar.processFrame(frame, activeTracks, tracker.getFrameID());
String id = frameId + "";
System.out.println("frame id = " + id + " active=" + activeCount + " dropped=" + droppedCount);
// Everything maps to the same camera
dbCams.addView(id, 0);
}
dbSimilar.finishedTracking();
}, "Finding Similar");
this.dbSimilar = dbSimilar;
}
use of boofcv.factory.tracker.ConfigPointTracker in project BoofCV by lessthanoptimal.
the class TestPointTrackerDda method createTracker.
@Override
public PointTracker<GrayF32> createTracker() {
ConfigPointTracker config = new ConfigPointTracker();
config.typeTracker = ConfigPointTracker.TrackerType.DDA;
config.detDesc.typeDetector = ConfigDetectInterestPoint.Type.POINT;
config.detDesc.detectPoint.shiTomasi.radius = 3;
config.detDesc.detectPoint.general.radius = 3;
config.detDesc.typeDescribe = ConfigDescribeRegion.Type.BRIEF;
config.detDesc.describeBrief.fixed = true;
return FactoryPointTracker.tracker(config, GrayF32.class, null);
}
use of boofcv.factory.tracker.ConfigPointTracker in project BoofCV by lessthanoptimal.
the class TestPointTrackerHybrid method createTracker.
@Override
public PointTracker<GrayF32> createTracker() {
ConfigPointTracker config = new ConfigPointTracker();
config.typeTracker = ConfigPointTracker.TrackerType.HYBRID;
config.detDesc.typeDetector = ConfigDetectInterestPoint.Type.POINT;
config.detDesc.detectPoint.shiTomasi.radius = 2;
config.detDesc.detectPoint.general.radius = 2;
config.detDesc.detectPoint.general.maxFeatures = 100;
config.detDesc.typeDescribe = ConfigDescribeRegion.Type.BRIEF;
config.detDesc.describeBrief.fixed = true;
config.associate.greedy.maxErrorThreshold = 400;
return FactoryPointTracker.tracker(config, GrayF32.class, null);
}
use of boofcv.factory.tracker.ConfigPointTracker in project BoofCV by lessthanoptimal.
the class TrackerPointControlPanel method createConfig.
private static ConfigPointTracker createConfig() {
int maxFeatures = 800;
int detRadius = 5;
ConfigPointTracker config = new ConfigPointTracker();
config.detDesc.detectPoint.general.maxFeatures = maxFeatures;
config.detDesc.detectPoint.general.radius = detRadius;
config.klt.pyramidLevels = ConfigDiscreteLevels.levels(4);
config.klt.templateRadius = 3;
config.detDesc.detectFastHessian.maxFeaturesPerScale = 500;
config.detDesc.detectSift.maxFeaturesPerScale = 500;
return config;
}
Aggregations