Search in sources :

Example 1 with ExampleAssociatePoints

use of boofcv.examples.features.ExampleAssociatePoints 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)

Aggregations

DetectDescribePoint (boofcv.abst.feature.detdesc.DetectDescribePoint)1 ConfigFastHessian (boofcv.abst.feature.detect.interest.ConfigFastHessian)1 ExampleAssociatePoints (boofcv.examples.features.ExampleAssociatePoints)1 AssociatedIndex (boofcv.struct.feature.AssociatedIndex)1 BrightFeature (boofcv.struct.feature.BrightFeature)1 AssociatedPair (boofcv.struct.geo.AssociatedPair)1 GrayF32 (boofcv.struct.image.GrayF32)1 ArrayList (java.util.ArrayList)1