Search in sources :

Example 1 with DescribePointSift

use of boofcv.alg.feature.describe.DescribePointSift in project BoofCV by lessthanoptimal.

the class FactoryDetectDescribe method sift.

/**
 * Creates a new SIFT feature detector and describer.
 *
 * @see CompleteSift
 *
 * @param config Configuration for the SIFT detector and descriptor.
 * @return SIFT
 */
public static <T extends ImageGray<T>> DetectDescribePoint<T, BrightFeature> sift(@Nullable ConfigCompleteSift config) {
    if (config == null)
        config = new ConfigCompleteSift();
    ConfigSiftScaleSpace configSS = config.scaleSpace;
    ConfigSiftDetector configDetector = config.detector;
    ConfigSiftOrientation configOri = config.orientation;
    ConfigSiftDescribe configDesc = config.describe;
    SiftScaleSpace scaleSpace = new SiftScaleSpace(configSS.firstOctave, configSS.lastOctave, configSS.numScales, configSS.sigma0);
    OrientationHistogramSift<GrayF32> orientation = new OrientationHistogramSift<>(configOri.histogramSize, configOri.sigmaEnlarge, GrayF32.class);
    DescribePointSift<GrayF32> describe = new DescribePointSift<>(configDesc.widthSubregion, configDesc.widthGrid, configDesc.numHistogramBins, configDesc.sigmaToPixels, configDesc.weightingSigmaFraction, configDesc.maxDescriptorElementValue, GrayF32.class);
    NonMaxSuppression nns = FactoryFeatureExtractor.nonmax(configDetector.extract);
    NonMaxLimiter nonMax = new NonMaxLimiter(nns, configDetector.maxFeaturesPerScale);
    CompleteSift dds = new CompleteSift(scaleSpace, configDetector.edgeR, nonMax, orientation, describe);
    return new DetectDescribe_CompleteSift<>(dds);
}
Also used : OrientationHistogramSift(boofcv.alg.feature.orientation.OrientationHistogramSift) NonMaxSuppression(boofcv.abst.feature.detect.extract.NonMaxSuppression) ConfigSiftDescribe(boofcv.abst.feature.describe.ConfigSiftDescribe) DescribePointSift(boofcv.alg.feature.describe.DescribePointSift) SiftScaleSpace(boofcv.alg.feature.detect.interest.SiftScaleSpace) ConfigSiftScaleSpace(boofcv.abst.feature.describe.ConfigSiftScaleSpace) CompleteSift(boofcv.alg.feature.detdesc.CompleteSift) NonMaxLimiter(boofcv.abst.feature.detect.extract.NonMaxLimiter) ConfigSiftDetector(boofcv.abst.feature.detect.interest.ConfigSiftDetector) GrayF32(boofcv.struct.image.GrayF32) ConfigSiftScaleSpace(boofcv.abst.feature.describe.ConfigSiftScaleSpace)

Example 2 with DescribePointSift

use of boofcv.alg.feature.describe.DescribePointSift in project BoofCV by lessthanoptimal.

the class TestDescribeDenseSiftAlg method computeDescriptor.

/**
 * Compute to the general descriptor algorithm.  They should produce the same results
 */
@Test
public void computeDescriptor() {
    GrayF32 derivX = new GrayF32(100, 102);
    GrayF32 derivY = new GrayF32(100, 102);
    GImageMiscOps.fillUniform(derivX, rand, 0, 200);
    GImageMiscOps.fillUniform(derivY, rand, 0, 200);
    DescribeDenseSiftAlg<GrayF32> alg = new DescribeDenseSiftAlg<>(4, 4, 8, 0.5, 0.2, 10, 10, GrayF32.class);
    DescribePointSift<GrayF32> algTest = new DescribePointSift<>(4, 4, 8, 1, 0.5, 0.2, GrayF32.class);
    alg.setImageGradient(derivX, derivY);
    algTest.setImageGradient(derivX, derivY);
    List<Point2D_I32> samplePoints = new ArrayList<>();
    samplePoints.add(new Point2D_I32(30, 35));
    samplePoints.add(new Point2D_I32(45, 10));
    samplePoints.add(new Point2D_I32(60, 12));
    samplePoints.add(new Point2D_I32(50, 50));
    TupleDesc_F64 found = new TupleDesc_F64(128);
    TupleDesc_F64 expected = new TupleDesc_F64(128);
    for (Point2D_I32 p : samplePoints) {
        alg.computeDescriptor(p.x, p.y, found);
        algTest.process(p.x, p.y, 1, 0, expected);
        for (int i = 0; i < 128; i++) {
            assertEquals(expected.value[i], found.value[i], 1e-8);
        }
    }
}
Also used : GrayF32(boofcv.struct.image.GrayF32) TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) DescribePointSift(boofcv.alg.feature.describe.DescribePointSift) ArrayList(java.util.ArrayList) Point2D_I32(georegression.struct.point.Point2D_I32) Test(org.junit.Test)

Example 3 with DescribePointSift

use of boofcv.alg.feature.describe.DescribePointSift in project BoofCV by lessthanoptimal.

the class TestCompleteSift method createAlg.

private CompleteSift createAlg() {
    SiftScaleSpace ss = new SiftScaleSpace(-1, 4, 3, 1.6);
    NonMaxSuppression nonmax = FactoryFeatureExtractor.nonmax(new ConfigExtract(1, 0, 1, true, true, true));
    NonMaxLimiter limiter = new NonMaxLimiter(nonmax, 300);
    OrientationHistogramSift<GrayF32> ori = new OrientationHistogramSift<>(36, 1.5, GrayF32.class);
    DescribePointSift<GrayF32> describe = new DescribePointSift<>(4, 4, 8, 1.5, 0.5, 0.2, GrayF32.class);
    return new CompleteSift(ss, 10, limiter, ori, describe);
}
Also used : ConfigExtract(boofcv.abst.feature.detect.extract.ConfigExtract) NonMaxLimiter(boofcv.abst.feature.detect.extract.NonMaxLimiter) OrientationHistogramSift(boofcv.alg.feature.orientation.OrientationHistogramSift) NonMaxSuppression(boofcv.abst.feature.detect.extract.NonMaxSuppression) GrayF32(boofcv.struct.image.GrayF32) DescribePointSift(boofcv.alg.feature.describe.DescribePointSift) SiftScaleSpace(boofcv.alg.feature.detect.interest.SiftScaleSpace)

Aggregations

DescribePointSift (boofcv.alg.feature.describe.DescribePointSift)3 GrayF32 (boofcv.struct.image.GrayF32)3 NonMaxLimiter (boofcv.abst.feature.detect.extract.NonMaxLimiter)2 NonMaxSuppression (boofcv.abst.feature.detect.extract.NonMaxSuppression)2 SiftScaleSpace (boofcv.alg.feature.detect.interest.SiftScaleSpace)2 OrientationHistogramSift (boofcv.alg.feature.orientation.OrientationHistogramSift)2 ConfigSiftDescribe (boofcv.abst.feature.describe.ConfigSiftDescribe)1 ConfigSiftScaleSpace (boofcv.abst.feature.describe.ConfigSiftScaleSpace)1 ConfigExtract (boofcv.abst.feature.detect.extract.ConfigExtract)1 ConfigSiftDetector (boofcv.abst.feature.detect.interest.ConfigSiftDetector)1 CompleteSift (boofcv.alg.feature.detdesc.CompleteSift)1 TupleDesc_F64 (boofcv.struct.feature.TupleDesc_F64)1 Point2D_I32 (georegression.struct.point.Point2D_I32)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1