use of boofcv.alg.feature.detect.interest.EasyGeneralFeatureDetector in project BoofCV by lessthanoptimal.
the class DetectPointsWithNoiseApp method setActiveAlgorithm.
@Override
public synchronized void setActiveAlgorithm(int indexFamily, String name, Object cookie) {
if (input == null)
return;
// corrupt the input image
corruptPanel.corruptImage(grayImage, corruptImage);
final EasyGeneralFeatureDetector<T, D> det = (EasyGeneralFeatureDetector<T, D>) cookie;
det.detect(corruptImage, null);
render.reset();
if (det.getDetector().isDetectMinimums()) {
QueueCorner l = det.getMinimums();
for (int i = 0; i < l.size; i++) {
Point2D_I16 p = l.get(i);
render.addPoint(p.x, p.y, 3, Color.BLUE);
}
}
if (det.getDetector().isDetectMaximums()) {
QueueCorner l = det.getMaximums();
for (int i = 0; i < l.size; i++) {
Point2D_I16 p = l.get(i);
render.addPoint(p.x, p.y, 3, Color.RED);
}
}
SwingUtilities.invokeLater(new Runnable() {
public void run() {
ConvertBufferedImage.convertTo(corruptImage, workImage, true);
Graphics2D g2 = workImage.createGraphics();
g2.setStroke(new BasicStroke(3));
render.draw(g2);
panel.repaint();
}
});
}
use of boofcv.alg.feature.detect.interest.EasyGeneralFeatureDetector in project BoofCV by lessthanoptimal.
the class TestDdaManagerGeneralPoint method createTracker.
@Override
public PointTracker<GrayF32> createTracker() {
DescribePointBrief<GrayF32> brief = FactoryDescribePointAlgs.brief(FactoryBriefDefinition.gaussian2(new Random(123), 16, 512), FactoryBlurFilter.gaussian(ImageType.single(GrayF32.class), 0, 4));
GeneralFeatureDetector<GrayF32, GrayF32> corner = FactoryDetectPoint.createShiTomasi(new ConfigGeneralDetector(-1, 2, 0), false, GrayF32.class);
ScoreAssociateHamming_B score = new ScoreAssociateHamming_B();
AssociateDescription2D<TupleDesc_B> association = new AssociateDescTo2D<>(FactoryAssociation.greedy(score, 400, true));
DescribeRegionPoint<GrayF32, TupleDesc_B> describe = new WrapDescribeBrief<>(brief, GrayF32.class);
EasyGeneralFeatureDetector<GrayF32, GrayF32> easy = new EasyGeneralFeatureDetector<>(corner, GrayF32.class, GrayF32.class);
DdaManagerGeneralPoint<GrayF32, GrayF32, TupleDesc_B> manager;
manager = new DdaManagerGeneralPoint<>(easy, describe, 2);
DetectDescribeAssociate<GrayF32, TupleDesc_B> tracker = new DetectDescribeAssociate<>(manager, association, false);
return tracker;
}
use of boofcv.alg.feature.detect.interest.EasyGeneralFeatureDetector in project BoofCV by lessthanoptimal.
the class FactoryPointTracker method dda_ST_NCC.
/**
* Creates a tracker which detects Shi-Tomasi corner features and describes them with NCC.
*
* @see ShiTomasiCornerIntensity
* @see DescribePointPixelRegionNCC
* @see boofcv.abst.feature.tracker.DdaManagerDetectDescribePoint
*
* @param configExtract Configuration for extracting features
* @param describeRadius Radius of the region being described. Try 2.
* @param imageType Type of image being processed.
* @param derivType Type of image used to store the image derivative. null == use default
*/
public static <I extends ImageGray<I>, D extends ImageGray<D>> PointTracker<I> dda_ST_NCC(ConfigGeneralDetector configExtract, int describeRadius, Class<I> imageType, Class<D> derivType) {
if (derivType == null)
derivType = GImageDerivativeOps.getDerivativeType(imageType);
int w = 2 * describeRadius + 1;
DescribePointPixelRegionNCC<I> alg = FactoryDescribePointAlgs.pixelRegionNCC(w, w, imageType);
GeneralFeatureDetector<I, D> corner = createShiTomasi(configExtract, derivType);
EasyGeneralFeatureDetector<I, D> easy = new EasyGeneralFeatureDetector<>(corner, imageType, derivType);
ScoreAssociateNccFeature score = new ScoreAssociateNccFeature();
AssociateDescription2D<NccFeature> association = new AssociateDescTo2D<>(FactoryAssociation.greedy(score, Double.MAX_VALUE, true));
DdaManagerGeneralPoint<I, D, NccFeature> manager = new DdaManagerGeneralPoint<>(easy, new WrapDescribePixelRegionNCC<>(alg, imageType), 1.0);
return new DetectDescribeAssociate<>(manager, association, false);
}
use of boofcv.alg.feature.detect.interest.EasyGeneralFeatureDetector in project BoofCV by lessthanoptimal.
the class TestDetectDescribeAssociateTwoPass method createTracker.
@Override
public PointTrackerTwoPass<GrayF32> createTracker() {
DescribePointBrief<GrayF32> brief = FactoryDescribePointAlgs.brief(FactoryBriefDefinition.gaussian2(new Random(123), 16, 512), FactoryBlurFilter.gaussian(ImageType.single(GrayF32.class), 0, 4));
GeneralFeatureDetector<GrayF32, GrayF32> corner = FactoryDetectPoint.createShiTomasi(new ConfigGeneralDetector(-1, 2, 0), false, GrayF32.class);
ScoreAssociateHamming_B score = new ScoreAssociateHamming_B();
// use an association algorithm which uses the track's pose information
AssociateDescription2D<TupleDesc_B> association = new AssociateMaxDistanceNaive<>(score, true, 400, 20);
DescribeRegionPoint<GrayF32, TupleDesc_B> describe = new WrapDescribeBrief<>(brief, GrayF32.class);
EasyGeneralFeatureDetector<GrayF32, GrayF32> easy = new EasyGeneralFeatureDetector<>(corner, GrayF32.class, GrayF32.class);
DdaManagerGeneralPoint<GrayF32, GrayF32, TupleDesc_B> manager;
manager = new DdaManagerGeneralPoint<>(easy, describe, 2);
DetectDescribeAssociateTwoPass<GrayF32, TupleDesc_B> tracker = new DetectDescribeAssociateTwoPass<>(manager, association, association, false);
return tracker;
}
Aggregations