Search in sources :

Example 1 with WrapperGradientCornerIntensity

use of boofcv.abst.feature.detect.intensity.WrapperGradientCornerIntensity 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 2 with WrapperGradientCornerIntensity

use of boofcv.abst.feature.detect.intensity.WrapperGradientCornerIntensity in project BoofCV by lessthanoptimal.

the class VideoDetectCorners method perform.

public static <T extends ImageGray<T>, D extends ImageGray<D>> void perform(String fileName, Class<T> imageType, Class<D> derivType) {
    SimpleImageSequence<T> sequence = BoofVideoManager.loadManagerDefault().load(fileName, ImageType.single(imageType));
    int maxCorners = 200;
    int radius = 2;
    GeneralFeatureIntensity<T, D> intensity = new WrapperGradientCornerIntensity<>(FactoryIntensityPointAlg.shiTomasi(radius, false, derivType));
    // GeneralFeatureIntensity<T, D> intensity =
    // new WrapperFastCornerIntensity<T, D>(FactoryIntensityPointAlg.createFast12(defaultType, 8 , 12));
    NonMaxSuppression extractor = new WrapperNonMaximumBlock(new NonMaxBlockStrict.Max());
    // FeatureExtractor extractor = new WrapperNonMaximumBlock( new NonMaxExtractorNaive(radius+10,10f));
    // FeatureExtractor extractor = new WrapperNonMaxCandidate(new NonMaxCandidateStrict(radius+10, 10f));
    extractor.setIgnoreBorder(radius + 10);
    extractor.setThresholdMaximum(10f);
    GeneralFeatureDetector<T, D> detector = new GeneralFeatureDetector<>(intensity, extractor);
    detector.setMaxFeatures(maxCorners);
    VideoDetectCorners<T, D> display = new VideoDetectCorners<>(sequence, detector, derivType);
    display.process();
}
Also used : NonMaxSuppression(boofcv.abst.feature.detect.extract.NonMaxSuppression) WrapperNonMaximumBlock(boofcv.abst.feature.detect.extract.WrapperNonMaximumBlock) NonMaxBlockStrict(boofcv.alg.feature.detect.extract.NonMaxBlockStrict) WrapperGradientCornerIntensity(boofcv.abst.feature.detect.intensity.WrapperGradientCornerIntensity) GeneralFeatureDetector(boofcv.alg.feature.detect.interest.GeneralFeatureDetector)

Example 3 with WrapperGradientCornerIntensity

use of boofcv.abst.feature.detect.intensity.WrapperGradientCornerIntensity in project BoofCV by lessthanoptimal.

the class FactoryInterestPointAlgs method harrisLaplace.

/**
 * Creates a {@link FeatureLaplacePyramid} 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>> FeatureLaplacePyramid<T, D> harrisLaplace(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);
    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) WrapperGradientCornerIntensity(boofcv.abst.feature.detect.intensity.WrapperGradientCornerIntensity)

Aggregations

NonMaxSuppression (boofcv.abst.feature.detect.extract.NonMaxSuppression)3 WrapperGradientCornerIntensity (boofcv.abst.feature.detect.intensity.WrapperGradientCornerIntensity)3 ConfigExtract (boofcv.abst.feature.detect.extract.ConfigExtract)2 WrapperNonMaximumBlock (boofcv.abst.feature.detect.extract.WrapperNonMaximumBlock)1 NonMaxBlockStrict (boofcv.alg.feature.detect.extract.NonMaxBlockStrict)1 GeneralFeatureDetector (boofcv.alg.feature.detect.interest.GeneralFeatureDetector)1