Search in sources :

Example 6 with ConfigFastHessian

use of boofcv.abst.feature.detect.interest.ConfigFastHessian in project BoofCV by lessthanoptimal.

the class ExampleFundamentalMatrix method computeMatches.

/**
 * Use the associate point feature example to create a list of {@link AssociatedPair} for use in computing the
 * fundamental matrix.
 */
public static List<AssociatedPair> computeMatches(BufferedImage left, BufferedImage right) {
    DetectDescribePoint detDesc = FactoryDetectDescribe.surfStable(new ConfigFastHessian(1, 2, 200, 1, 9, 4, 4), null, null, GrayF32.class);
    // DetectDescribePoint detDesc = FactoryDetectDescribe.sift(null,new ConfigSiftDetector(2,0,200,5),null,null);
    ScoreAssociation<BrightFeature> scorer = FactoryAssociation.scoreEuclidean(BrightFeature.class, true);
    AssociateDescription<BrightFeature> associate = FactoryAssociation.greedy(scorer, 1, true);
    ExampleAssociatePoints<GrayF32, BrightFeature> findMatches = new ExampleAssociatePoints<>(detDesc, associate, GrayF32.class);
    findMatches.associate(left, right);
    List<AssociatedPair> matches = new ArrayList<>();
    FastQueue<AssociatedIndex> matchIndexes = associate.getMatches();
    for (int i = 0; i < matchIndexes.size; i++) {
        AssociatedIndex a = matchIndexes.get(i);
        AssociatedPair p = new AssociatedPair(findMatches.pointsA.get(a.src), findMatches.pointsB.get(a.dst));
        matches.add(p);
    }
    return matches;
}
Also used : DetectDescribePoint(boofcv.abst.feature.detdesc.DetectDescribePoint) AssociatedPair(boofcv.struct.geo.AssociatedPair) ConfigFastHessian(boofcv.abst.feature.detect.interest.ConfigFastHessian) ArrayList(java.util.ArrayList) DetectDescribePoint(boofcv.abst.feature.detdesc.DetectDescribePoint) BrightFeature(boofcv.struct.feature.BrightFeature) GrayF32(boofcv.struct.image.GrayF32) ExampleAssociatePoints(boofcv.examples.features.ExampleAssociatePoints) AssociatedIndex(boofcv.struct.feature.AssociatedIndex)

Example 7 with ConfigFastHessian

use of boofcv.abst.feature.detect.interest.ConfigFastHessian in project BoofCV by lessthanoptimal.

the class FactoryInterestPointAlgs method fastHessian.

/**
 * Creates a Fast Hessian blob detector used by SURF.
 *
 * @param config Configuration for detector. Pass in null for default options.
 * @param <II> Integral Image
 * @return The feature detector
 */
public static <II extends ImageGray<II>> FastHessianFeatureDetector<II> fastHessian(@Nullable ConfigFastHessian config) {
    if (config == null)
        config = new ConfigFastHessian();
    config.checkValidity();
    // ignore border is overwritten by Fast Hessian at detection time
    NonMaxSuppression extractor = FactoryFeatureExtractor.nonmax(new ConfigExtract(config.extractRadius, config.detectThreshold, 0, true));
    return new FastHessianFeatureDetector<>(extractor, config.maxFeaturesPerScale, config.initialSampleSize, config.initialSize, config.numberScalesPerOctave, config.numberOfOctaves, config.scaleStepSize);
}
Also used : ConfigExtract(boofcv.abst.feature.detect.extract.ConfigExtract) NonMaxSuppression(boofcv.abst.feature.detect.extract.NonMaxSuppression) ConfigFastHessian(boofcv.abst.feature.detect.interest.ConfigFastHessian)

Example 8 with ConfigFastHessian

use of boofcv.abst.feature.detect.interest.ConfigFastHessian in project BoofCV by lessthanoptimal.

the class ExampleInterestPoint method detect.

public static <T extends ImageGray<T>> void detect(BufferedImage image, Class<T> imageType) {
    T input = ConvertBufferedImage.convertFromSingle(image, null, imageType);
    // Create a Fast Hessian detector from the SURF paper.
    // Other detectors can be used in this example too.
    InterestPointDetector<T> detector = FactoryInterestPoint.fastHessian(new ConfigFastHessian(10, 2, 100, 2, 9, 3, 4));
    // find interest points in the image
    detector.detect(input);
    // Show the features
    displayResults(image, detector);
}
Also used : ConfigFastHessian(boofcv.abst.feature.detect.interest.ConfigFastHessian)

Example 9 with ConfigFastHessian

use of boofcv.abst.feature.detect.interest.ConfigFastHessian in project BoofCV by lessthanoptimal.

the class ExampleAssociatePoints method main.

public static void main(String[] args) {
    Class imageType = GrayF32.class;
    // Class imageType = GrayU8.class;
    // select which algorithms to use
    DetectDescribePoint detDesc = FactoryDetectDescribe.surfStable(new ConfigFastHessian(1, 2, 300, 1, 9, 4, 4), null, null, imageType);
    // sift(new ConfigCompleteSift(0,5,600));
    ScoreAssociation scorer = FactoryAssociation.defaultScore(detDesc.getDescriptionType());
    AssociateDescription associate = FactoryAssociation.greedy(scorer, Double.MAX_VALUE, true);
    // load and match images
    ExampleAssociatePoints app = new ExampleAssociatePoints(detDesc, associate, imageType);
    BufferedImage imageA = UtilImageIO.loadImage(UtilIO.pathExample("stitch/kayak_01.jpg"));
    BufferedImage imageB = UtilImageIO.loadImage(UtilIO.pathExample("stitch/kayak_03.jpg"));
    app.associate(imageA, imageB);
}
Also used : DetectDescribePoint(boofcv.abst.feature.detdesc.DetectDescribePoint) GrayF32(boofcv.struct.image.GrayF32) ConfigFastHessian(boofcv.abst.feature.detect.interest.ConfigFastHessian) AssociateDescription(boofcv.abst.feature.associate.AssociateDescription) ScoreAssociation(boofcv.abst.feature.associate.ScoreAssociation) BufferedImage(java.awt.image.BufferedImage) ConvertBufferedImage(boofcv.io.image.ConvertBufferedImage)

Example 10 with ConfigFastHessian

use of boofcv.abst.feature.detect.interest.ConfigFastHessian in project BoofCV by lessthanoptimal.

the class ExampleFeatureSurf method easy.

/**
 * Use generalized interfaces for working with SURF.  This removes much of the drudgery, but also reduces flexibility
 * and slightly increases memory and computational requirements.
 *
 *  @param image Input image type. DOES NOT NEED TO BE GrayF32, GrayU8 works too
 */
public static void easy(GrayF32 image) {
    // create the detector and descriptors
    DetectDescribePoint<GrayF32, BrightFeature> surf = FactoryDetectDescribe.surfStable(new ConfigFastHessian(0, 2, 200, 2, 9, 4, 4), null, null, GrayF32.class);
    // specify the image to process
    surf.detect(image);
    System.out.println("Found Features: " + surf.getNumberOfFeatures());
    System.out.println("First descriptor's first value: " + surf.getDescription(0).value[0]);
}
Also used : BrightFeature(boofcv.struct.feature.BrightFeature) GrayF32(boofcv.struct.image.GrayF32) ConfigFastHessian(boofcv.abst.feature.detect.interest.ConfigFastHessian)

Aggregations

ConfigFastHessian (boofcv.abst.feature.detect.interest.ConfigFastHessian)11 DetectDescribePoint (boofcv.abst.feature.detdesc.DetectDescribePoint)4 BrightFeature (boofcv.struct.feature.BrightFeature)4 GrayF32 (boofcv.struct.image.GrayF32)4 AssociatedPair (boofcv.struct.geo.AssociatedPair)3 BufferedImage (java.awt.image.BufferedImage)3 FactoryInterestPoint (boofcv.factory.feature.detect.interest.FactoryInterestPoint)2 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)2 AssociatedIndex (boofcv.struct.feature.AssociatedIndex)2 AssociateDescription (boofcv.abst.feature.associate.AssociateDescription)1 ScoreAssociation (boofcv.abst.feature.associate.ScoreAssociation)1 DescribeRegionPoint (boofcv.abst.feature.describe.DescribeRegionPoint)1 DescribeRegionPointConvert (boofcv.abst.feature.describe.DescribeRegionPointConvert)1 ConfigExtract (boofcv.abst.feature.detect.extract.ConfigExtract)1 NonMaxSuppression (boofcv.abst.feature.detect.extract.NonMaxSuppression)1 InterestPointDetector (boofcv.abst.feature.detect.interest.InterestPointDetector)1 ConvertBufferedImage (boofcv.core.image.ConvertBufferedImage)1 ExampleAssociatePoints (boofcv.examples.features.ExampleAssociatePoints)1 FactoryDescribeRegionPoint (boofcv.factory.feature.describe.FactoryDescribeRegionPoint)1 ConfigRansac (boofcv.factory.geo.ConfigRansac)1