Search in sources :

Example 1 with NonMaxSuppression

use of boofcv.abst.feature.detect.extract.NonMaxSuppression 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 NonMaxSuppression

use of boofcv.abst.feature.detect.extract.NonMaxSuppression in project BoofCV by lessthanoptimal.

the class FactoryInterestPointAlgs method hessianLaplace.

/**
 * Creates a {@link boofcv.alg.feature.detect.interest.FeatureLaplacePyramid} which is uses a hessian blob detector.
 *
 * @param extractRadius   Size of the feature used to detect the corners.
 * @param detectThreshold Minimum corner intensity required
 * @param maxFeatures     Max number of features that can be found.
 * @param imageType       Type of input image.
 * @param derivType       Image derivative type.
 * @return CornerLaplaceScaleSpace
 */
public static <T extends ImageGray<T>, D extends ImageGray<D>> FeatureLaplacePyramid<T, D> hessianLaplace(int extractRadius, float detectThreshold, int maxFeatures, Class<T> imageType, Class<D> derivType) {
    GeneralFeatureIntensity<T, D> intensity = new WrapperHessianBlobIntensity<>(HessianBlobIntensity.Type.DETERMINANT, derivType);
    NonMaxSuppression extractor = FactoryFeatureExtractor.nonmax(new ConfigExtract(extractRadius, detectThreshold, extractRadius, true));
    GeneralFeatureDetector<T, D> detector = new GeneralFeatureDetector<>(intensity, extractor);
    detector.setMaxFeatures(maxFeatures);
    AnyImageDerivative<T, D> deriv = GImageDerivativeOps.derivativeForScaleSpace(imageType, derivType);
    ImageFunctionSparse<T> sparseLaplace = FactoryDerivativeSparse.createLaplacian(imageType, null);
    return new FeatureLaplacePyramid<>(detector, sparseLaplace, deriv, 2);
}
Also used : ConfigExtract(boofcv.abst.feature.detect.extract.ConfigExtract) NonMaxSuppression(boofcv.abst.feature.detect.extract.NonMaxSuppression) WrapperHessianBlobIntensity(boofcv.abst.feature.detect.intensity.WrapperHessianBlobIntensity)

Example 3 with NonMaxSuppression

use of boofcv.abst.feature.detect.extract.NonMaxSuppression in project BoofCV by lessthanoptimal.

the class FactoryInterestPointAlgs method harrisPyramid.

/**
 * Creates a {@link FeaturePyramid} which is uses the Harris corner detector.
 *
 * @param extractRadius   Size of the feature used to detect the corners.
 * @param detectThreshold Minimum corner intensity required
 * @param maxFeatures     Max number of features that can be found.
 * @param imageType       Type of input image.
 * @param derivType       Image derivative type.
 * @return CornerLaplaceScaleSpace
 */
public static <T extends ImageGray<T>, D extends ImageGray<D>> FeaturePyramid<T, D> harrisPyramid(int extractRadius, float detectThreshold, int maxFeatures, Class<T> imageType, Class<D> derivType) {
    GradientCornerIntensity<D> harris = FactoryIntensityPointAlg.harris(extractRadius, 0.04f, false, derivType);
    GeneralFeatureIntensity<T, D> intensity = new WrapperGradientCornerIntensity<>(harris);
    NonMaxSuppression extractor = FactoryFeatureExtractor.nonmax(new ConfigExtract(extractRadius, detectThreshold, extractRadius, true));
    GeneralFeatureDetector<T, D> detector = new GeneralFeatureDetector<>(intensity, extractor);
    detector.setMaxFeatures(maxFeatures);
    AnyImageDerivative<T, D> deriv = GImageDerivativeOps.derivativeForScaleSpace(imageType, derivType);
    return new FeaturePyramid<>(detector, deriv, 2);
}
Also used : ConfigExtract(boofcv.abst.feature.detect.extract.ConfigExtract) NonMaxSuppression(boofcv.abst.feature.detect.extract.NonMaxSuppression) WrapperGradientCornerIntensity(boofcv.abst.feature.detect.intensity.WrapperGradientCornerIntensity)

Example 4 with NonMaxSuppression

use of boofcv.abst.feature.detect.extract.NonMaxSuppression in project BoofCV by lessthanoptimal.

the class FactoryInterestPointAlgs method hessianPyramid.

/**
 * Creates a {@link FeaturePyramid} which is uses a hessian blob detector.
 *
 * @param extractRadius   Size of the feature used to detect the corners.
 * @param detectThreshold Minimum corner intensity required
 * @param maxFeatures     Max number of features that can be found.
 * @param imageType       Type of input image.
 * @param derivType       Image derivative type.
 * @return CornerLaplaceScaleSpace
 */
public static <T extends ImageGray<T>, D extends ImageGray<D>> FeaturePyramid<T, D> hessianPyramid(int extractRadius, float detectThreshold, int maxFeatures, Class<T> imageType, Class<D> derivType) {
    GeneralFeatureIntensity<T, D> intensity = new WrapperHessianBlobIntensity<>(HessianBlobIntensity.Type.DETERMINANT, derivType);
    NonMaxSuppression extractor = FactoryFeatureExtractor.nonmax(new ConfigExtract(extractRadius, detectThreshold, extractRadius, true));
    GeneralFeatureDetector<T, D> detector = new GeneralFeatureDetector<>(intensity, extractor);
    detector.setMaxFeatures(maxFeatures);
    AnyImageDerivative<T, D> deriv = GImageDerivativeOps.derivativeForScaleSpace(imageType, derivType);
    return new FeaturePyramid<>(detector, deriv, 2);
}
Also used : ConfigExtract(boofcv.abst.feature.detect.extract.ConfigExtract) NonMaxSuppression(boofcv.abst.feature.detect.extract.NonMaxSuppression) WrapperHessianBlobIntensity(boofcv.abst.feature.detect.intensity.WrapperHessianBlobIntensity)

Example 5 with NonMaxSuppression

use of boofcv.abst.feature.detect.extract.NonMaxSuppression in project BoofCV by lessthanoptimal.

the class CompareFeatureExtractorApp method doProcess.

private synchronized void doProcess() {
    // System.out.println("radius "+radius+" min separation "+minSeparation+" thresholdFraction "+thresholdFraction+" numFeatures "+numFeatures);
    deriv.setInput(grayImage);
    D derivX = deriv.getDerivative(true);
    D derivY = deriv.getDerivative(false);
    D derivXX = deriv.getDerivative(true, true);
    D derivYY = deriv.getDerivative(false, false);
    D derivXY = deriv.getDerivative(true, false);
    // todo modifying buffered images which might be actively being displayed, could mess up swing
    intensityAlg.process(grayImage, derivX, derivY, derivXX, derivYY, derivXY);
    GrayF32 intensity = intensityAlg.getIntensity();
    intensityImage = VisualizeImageData.colorizeSign(intensityAlg.getIntensity(), null, ImageStatistics.maxAbs(intensity));
    float max = ImageStatistics.maxAbs(intensity);
    float threshold = max * thresholdFraction;
    NonMaxSuppression extractor = FactoryFeatureExtractor.nonmax(new ConfigExtract(minSeparation, threshold, radius, true));
    GeneralFeatureDetector<T, D> detector = new GeneralFeatureDetector<>(intensityAlg, extractor);
    detector.setMaxFeatures(numFeatures);
    detector.process(grayImage, derivX, derivY, derivXX, derivYY, derivXY);
    QueueCorner foundCorners = detector.getMaximums();
    render.reset();
    for (int i = 0; i < foundCorners.size(); i++) {
        Point2D_I16 p = foundCorners.get(i);
        render.addPoint(p.x, p.y, 3, Color.RED);
    }
    Graphics2D g2 = workImage.createGraphics();
    g2.drawImage(input, 0, 0, grayImage.width, grayImage.height, null);
    render.draw(g2);
    drawImage();
}
Also used : ConfigExtract(boofcv.abst.feature.detect.extract.ConfigExtract) NonMaxSuppression(boofcv.abst.feature.detect.extract.NonMaxSuppression) GrayF32(boofcv.struct.image.GrayF32) Point2D_I16(georegression.struct.point.Point2D_I16) QueueCorner(boofcv.struct.QueueCorner) GeneralFeatureDetector(boofcv.alg.feature.detect.interest.GeneralFeatureDetector) FactoryIntensityPoint(boofcv.factory.feature.detect.intensity.FactoryIntensityPoint)

Aggregations

NonMaxSuppression (boofcv.abst.feature.detect.extract.NonMaxSuppression)23 ConfigExtract (boofcv.abst.feature.detect.extract.ConfigExtract)19 GrayF32 (boofcv.struct.image.GrayF32)7 NonMaxLimiter (boofcv.abst.feature.detect.extract.NonMaxLimiter)5 GeneralFeatureDetector (boofcv.alg.feature.detect.interest.GeneralFeatureDetector)5 WrapperGradientCornerIntensity (boofcv.abst.feature.detect.intensity.WrapperGradientCornerIntensity)3 SiftScaleSpace (boofcv.alg.feature.detect.interest.SiftScaleSpace)3 QueueCorner (boofcv.struct.QueueCorner)3 Point2D_I16 (georegression.struct.point.Point2D_I16)3 Test (org.junit.Test)3 ConfigSiftScaleSpace (boofcv.abst.feature.describe.ConfigSiftScaleSpace)2 DescribeRegionPoint (boofcv.abst.feature.describe.DescribeRegionPoint)2 DetectDescribeMulti (boofcv.abst.feature.detdesc.DetectDescribeMulti)2 DetectDescribeMultiFusion (boofcv.abst.feature.detdesc.DetectDescribeMultiFusion)2 GeneralFeatureIntensity (boofcv.abst.feature.detect.intensity.GeneralFeatureIntensity)2 WrapperHessianBlobIntensity (boofcv.abst.feature.detect.intensity.WrapperHessianBlobIntensity)2 ConfigGeneralDetector (boofcv.abst.feature.detect.interest.ConfigGeneralDetector)2 DetectorInterestPointMulti (boofcv.abst.feature.detect.interest.DetectorInterestPointMulti)2 GeneralToInterestMulti (boofcv.abst.feature.detect.interest.GeneralToInterestMulti)2 DescribePointSift (boofcv.alg.feature.describe.DescribePointSift)2