Search in sources :

Example 1 with SiftScaleSpace

use of boofcv.alg.feature.detect.interest.SiftScaleSpace in project BoofCV by lessthanoptimal.

the class FactoryOrientation method sift.

/**
 * Creates an implementation of the SIFT orientation estimation algorithm
 *
 * @param configSS Configuration of the scale-space.  null for default
 * @param configOri  Orientation configuration. null for default
 * @param imageType Type of input image
 * @return SIFT orientation image
 */
public static <T extends ImageGray<T>> OrientationImage<T> sift(ConfigSiftScaleSpace configSS, ConfigSiftOrientation configOri, Class<T> imageType) {
    if (configSS == null)
        configSS = new ConfigSiftScaleSpace();
    configSS.checkValidity();
    OrientationHistogramSift<GrayF32> ori = FactoryOrientationAlgs.sift(configOri, GrayF32.class);
    SiftScaleSpace ss = new SiftScaleSpace(configSS.firstOctave, configSS.lastOctave, configSS.numScales, configSS.sigma0);
    return new OrientationSiftToImage<>(ori, ss, imageType);
}
Also used : GrayF32(boofcv.struct.image.GrayF32) SiftScaleSpace(boofcv.alg.feature.detect.interest.SiftScaleSpace) ConfigSiftScaleSpace(boofcv.abst.feature.describe.ConfigSiftScaleSpace) ConfigSiftScaleSpace(boofcv.abst.feature.describe.ConfigSiftScaleSpace)

Example 2 with SiftScaleSpace

use of boofcv.alg.feature.detect.interest.SiftScaleSpace in project BoofCV by lessthanoptimal.

the class FactoryDescribeRegionPoint method sift.

/**
 * <p>
 * Creates a SIFT region descriptor.
 * </p>
 *
 * <p>
 * NOTE: If detecting and describing SIFT features then it is more efficient to use
 * {@link boofcv.factory.feature.detdesc.FactoryDetectDescribe#sift} instead
 * </p>
 *
 * @param configSS SIFT scale-space configuration. Pass in null for default options.
 * @param configDescribe SIFT descriptor configuration.  Pass in null for default options.
 * @return SIFT descriptor
 */
public static <T extends ImageGray<T>> DescribeRegionPoint<T, TupleDesc_F64> sift(@Nullable ConfigSiftScaleSpace configSS, @Nullable ConfigSiftDescribe configDescribe, Class<T> imageType) {
    if (configSS == null)
        configSS = new ConfigSiftScaleSpace();
    configSS.checkValidity();
    SiftScaleSpace ss = new SiftScaleSpace(configSS.firstOctave, configSS.lastOctave, configSS.numScales, configSS.sigma0);
    DescribePointSift<GrayF32> alg = FactoryDescribePointAlgs.sift(configDescribe, GrayF32.class);
    return new DescribeRegionPoint_SIFT<>(ss, alg, imageType);
}
Also used : SiftScaleSpace(boofcv.alg.feature.detect.interest.SiftScaleSpace)

Example 3 with SiftScaleSpace

use of boofcv.alg.feature.detect.interest.SiftScaleSpace 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 4 with SiftScaleSpace

use of boofcv.alg.feature.detect.interest.SiftScaleSpace in project BoofCV by lessthanoptimal.

the class DebugSiftDetectorApp method main.

public static void main(String[] args) {
    BufferedImage input = UtilImageIO.loadImage(UtilIO.pathExample("sunflowers.jpg"));
    // BufferedImage input = UtilImageIO.loadImage(UtilIO.pathExample("shapes/shapes01.png");
    GrayF32 gray = ConvertBufferedImage.convertFromSingle(input, null, GrayF32.class);
    NonMaxSuppression nonmax = FactoryFeatureExtractor.nonmax(new ConfigExtract(3, 1, 1, true, true, true));
    NonMaxLimiter extractor = new NonMaxLimiter(nonmax, 400);
    SiftScaleSpace imageSS = new SiftScaleSpace(-1, 5, 3, 2.75);
    SiftDetector alg = new SiftDetector(imageSS, 10, extractor);
    alg.process(gray);
    System.out.println("total features found: " + alg.getDetections().size());
    VisualizeFeatures.drawScalePoints(input.createGraphics(), alg.getDetections().toList(), 1);
    // ListDisplayPanel dog = new ListDisplayPanel();
    // for( int i = 0; i < alg.getScaleSpace().getDog().length; i++ ) {
    // int scale = i % (alg.getScaleSpace().getNumScales()-1);
    // int octave = i / (alg.getScaleSpace().getNumScales()-1);
    // 
    // BufferedImage img = VisualizeImageData.colorizeSign(alg.getScaleSpace().getDog()[i],null,-1);
    // dog.addImage(img,octave+"  "+scale);
    // }
    // 
    // ListDisplayPanel ss = new ListDisplayPanel();
    // for( int i = 0; i < alg.getScaleSpace().getScale().length; i++ ) {
    // int scale = i % alg.getScaleSpace().getNumScales();
    // int octave = i / alg.getScaleSpace().getNumScales();
    // 
    // BufferedImage img = VisualizeImageData.grayMagnitude(alg.getScaleSpace().getScale()[i],null,255);
    // ss.addImage(img,octave+"  "+scale);
    // }
    // ShowImages.showWindow(dog, "Octave DOG");
    // ShowImages.showWindow(ss, "Octave Scales");
    ShowImages.showWindow(input, "Found Features", true);
    System.out.println("Done");
}
Also used : ConfigExtract(boofcv.abst.feature.detect.extract.ConfigExtract) NonMaxLimiter(boofcv.abst.feature.detect.extract.NonMaxLimiter) NonMaxSuppression(boofcv.abst.feature.detect.extract.NonMaxSuppression) GrayF32(boofcv.struct.image.GrayF32) SiftScaleSpace(boofcv.alg.feature.detect.interest.SiftScaleSpace) SiftDetector(boofcv.alg.feature.detect.interest.SiftDetector) BufferedImage(java.awt.image.BufferedImage) ConvertBufferedImage(boofcv.io.image.ConvertBufferedImage)

Example 5 with SiftScaleSpace

use of boofcv.alg.feature.detect.interest.SiftScaleSpace 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

SiftScaleSpace (boofcv.alg.feature.detect.interest.SiftScaleSpace)7 GrayF32 (boofcv.struct.image.GrayF32)6 NonMaxLimiter (boofcv.abst.feature.detect.extract.NonMaxLimiter)3 NonMaxSuppression (boofcv.abst.feature.detect.extract.NonMaxSuppression)3 ConfigSiftScaleSpace (boofcv.abst.feature.describe.ConfigSiftScaleSpace)2 ConfigExtract (boofcv.abst.feature.detect.extract.ConfigExtract)2 DescribePointSift (boofcv.alg.feature.describe.DescribePointSift)2 OrientationHistogramSift (boofcv.alg.feature.orientation.OrientationHistogramSift)2 ConfigSiftDescribe (boofcv.abst.feature.describe.ConfigSiftDescribe)1 ConfigSiftDetector (boofcv.abst.feature.detect.interest.ConfigSiftDetector)1 CompleteSift (boofcv.alg.feature.detdesc.CompleteSift)1 SiftDetector (boofcv.alg.feature.detect.interest.SiftDetector)1 GenericOrientationImageTests (boofcv.alg.feature.orientation.GenericOrientationImageTests)1 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)1 BufferedImage (java.awt.image.BufferedImage)1 Test (org.junit.Test)1