use of boofcv.abst.feature.detect.extract.ConfigExtract in project BoofCV by lessthanoptimal.
the class ConfigSiftDetector method createPaper.
/**
* Creates a configuration similar to how it was originally described in the paper
*/
public static ConfigSiftDetector createPaper() {
ConfigSiftDetector config = new ConfigSiftDetector();
config.extract = new ConfigExtract(1, 0, 1, true, true, true);
config.extract.ignoreBorder = 1;
config.maxFeaturesPerScale = 0;
config.edgeR = 10;
return config;
}
use of boofcv.abst.feature.detect.extract.ConfigExtract 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);
}
use of boofcv.abst.feature.detect.extract.ConfigExtract 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);
}
use of boofcv.abst.feature.detect.extract.ConfigExtract 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);
}
use of boofcv.abst.feature.detect.extract.ConfigExtract 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();
}
Aggregations