Search in sources :

Example 1 with EasyGeneralFeatureDetector

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();
        }
    });
}
Also used : Point2D_I16(georegression.struct.point.Point2D_I16) QueueCorner(boofcv.struct.QueueCorner) EasyGeneralFeatureDetector(boofcv.alg.feature.detect.interest.EasyGeneralFeatureDetector) FactoryDetectPoint(boofcv.factory.feature.detect.interest.FactoryDetectPoint)

Example 2 with EasyGeneralFeatureDetector

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;
}
Also used : ConfigGeneralDetector(boofcv.abst.feature.detect.interest.ConfigGeneralDetector) AssociateDescTo2D(boofcv.abst.feature.associate.AssociateDescTo2D) ScoreAssociateHamming_B(boofcv.abst.feature.associate.ScoreAssociateHamming_B) WrapDescribeBrief(boofcv.abst.feature.describe.WrapDescribeBrief) TupleDesc_B(boofcv.struct.feature.TupleDesc_B) GrayF32(boofcv.struct.image.GrayF32) Random(java.util.Random) EasyGeneralFeatureDetector(boofcv.alg.feature.detect.interest.EasyGeneralFeatureDetector)

Example 3 with EasyGeneralFeatureDetector

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);
}
Also used : FactoryDetectPoint(boofcv.factory.feature.detect.interest.FactoryDetectPoint) FactoryDescribeRegionPoint(boofcv.factory.feature.describe.FactoryDescribeRegionPoint) DescribeRegionPoint(boofcv.abst.feature.describe.DescribeRegionPoint) CombinedTrackerScalePoint(boofcv.alg.tracker.combined.CombinedTrackerScalePoint) DetectDescribePoint(boofcv.abst.feature.detdesc.DetectDescribePoint) FactoryInterestPoint(boofcv.factory.feature.detect.interest.FactoryInterestPoint) EasyGeneralFeatureDetector(boofcv.alg.feature.detect.interest.EasyGeneralFeatureDetector)

Example 4 with EasyGeneralFeatureDetector

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;
}
Also used : ConfigGeneralDetector(boofcv.abst.feature.detect.interest.ConfigGeneralDetector) AssociateMaxDistanceNaive(boofcv.alg.feature.associate.AssociateMaxDistanceNaive) ScoreAssociateHamming_B(boofcv.abst.feature.associate.ScoreAssociateHamming_B) WrapDescribeBrief(boofcv.abst.feature.describe.WrapDescribeBrief) TupleDesc_B(boofcv.struct.feature.TupleDesc_B) GrayF32(boofcv.struct.image.GrayF32) Random(java.util.Random) EasyGeneralFeatureDetector(boofcv.alg.feature.detect.interest.EasyGeneralFeatureDetector)

Aggregations

EasyGeneralFeatureDetector (boofcv.alg.feature.detect.interest.EasyGeneralFeatureDetector)4 ScoreAssociateHamming_B (boofcv.abst.feature.associate.ScoreAssociateHamming_B)2 WrapDescribeBrief (boofcv.abst.feature.describe.WrapDescribeBrief)2 ConfigGeneralDetector (boofcv.abst.feature.detect.interest.ConfigGeneralDetector)2 FactoryDetectPoint (boofcv.factory.feature.detect.interest.FactoryDetectPoint)2 TupleDesc_B (boofcv.struct.feature.TupleDesc_B)2 GrayF32 (boofcv.struct.image.GrayF32)2 Random (java.util.Random)2 AssociateDescTo2D (boofcv.abst.feature.associate.AssociateDescTo2D)1 DescribeRegionPoint (boofcv.abst.feature.describe.DescribeRegionPoint)1 DetectDescribePoint (boofcv.abst.feature.detdesc.DetectDescribePoint)1 AssociateMaxDistanceNaive (boofcv.alg.feature.associate.AssociateMaxDistanceNaive)1 CombinedTrackerScalePoint (boofcv.alg.tracker.combined.CombinedTrackerScalePoint)1 FactoryDescribeRegionPoint (boofcv.factory.feature.describe.FactoryDescribeRegionPoint)1 FactoryInterestPoint (boofcv.factory.feature.detect.interest.FactoryInterestPoint)1 QueueCorner (boofcv.struct.QueueCorner)1 Point2D_I16 (georegression.struct.point.Point2D_I16)1