boofcv.factory.feature.detdesc.FactoryDetectDescribe Java Examples

The following examples show how to use boofcv.factory.feature.detdesc.FactoryDetectDescribe. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SURFExtractor.java    From multimedia-indexing with Apache License 2.0 6 votes vote down vote up
/**
 * Detects key points inside the image and computes descriptions at those points.
 */
protected double[][] extractFeaturesInternal(BufferedImage image) {
	ImageFloat32 boofcvImage = ConvertBufferedImage.convertFromSingle(image, null, ImageFloat32.class);

	// create the SURF detector and descriptor in BoofCV v0.15
	ConfigFastHessian conf = new ConfigFastHessian(detectThreshold, 2, maxFeaturesPerScale, 2, 9, 4, 4);
	DetectDescribePoint<ImageFloat32, SurfFeature> surf = FactoryDetectDescribe.surfStable(conf, null,
			null, ImageFloat32.class);
	// specify the image to process
	surf.detect(boofcvImage);
	int numPoints = surf.getNumberOfFeatures();
	double[][] descriptions = new double[numPoints][SURFLength];
	for (int i = 0; i < numPoints; i++) {
		descriptions[i] = surf.getDescription(i).getValue();
	}
	return descriptions;
}
 
Example #2
Source File: SIFTExtractor.java    From multimedia-indexing with Apache License 2.0 6 votes vote down vote up
/**
 * Detects key points inside the image and computes descriptions at those points.
 */
protected double[][] extractFeaturesInternal(BufferedImage image) {
	ImageFloat32 boofcvImage = ConvertBufferedImage.convertFromSingle(image, null, ImageFloat32.class);
	// create the SIFT detector and descriptor in BoofCV v0.15
	ConfigSiftDetector conf = new ConfigSiftDetector(2, detectThreshold, maxFeaturesPerScale, 5);
	DetectDescribePoint<ImageFloat32, SurfFeature> sift = FactoryDetectDescribe.sift(null, conf, null,
			null);

	// specify the image to process
	sift.detect(boofcvImage);
	int numPoints = sift.getNumberOfFeatures();
	double[][] descriptions = new double[numPoints][SIFTLength];
	for (int i = 0; i < numPoints; i++) {
		descriptions[i] = sift.getDescription(i).getValue();
	}
	return descriptions;
}
 
Example #3
Source File: SURFHelper.java    From cineast with MIT License 5 votes vote down vote up
/**
 * Returns SURF descriptors for an image using the settings above. Uses the BoofCV stable SURF algorithm.
 *
 * @param image Image for which to obtain the SURF descriptors.
 * @return
 */
public static DetectDescribePoint<GrayF32, BrightFeature> getStableSurf(BufferedImage image) {
     /* Obtain raw SURF descriptors using the configuration above (FH-9 according to [1]). */
    GrayF32 gray = ConvertBufferedImage.convertFromSingle(image, null, GrayF32.class);
    ConfigFastHessian config = new ConfigFastHessian(0, 2, FH_MAX_FEATURES_PER_SCALE, FH_INITIAL_SAMPLE_SIZE, FH_INITIAL_SIZE, FH_NUMBER_SCALES_PER_OCTAVE, FH_NUMBER_OF_OCTAVES);
    DetectDescribePoint<GrayF32, BrightFeature> surf = FactoryDetectDescribe.surfStable(config, null, null, GrayF32.class);
    surf.detect(gray);
    return surf;
}
 
Example #4
Source File: SURFHelper.java    From cineast with MIT License 5 votes vote down vote up
/**
 * Returns SURF descriptors for an image using the settings above. Uses the BoofCV fast SURF algorithm,
 * which yields less images but operates a bit faster.
 *
 * @param image Image for which to obtain the SURF descriptors.
 * @return
 */
public static DetectDescribePoint<GrayF32, BrightFeature> getFastSurf(BufferedImage image) {
     /* Obtain raw SURF descriptors using the configuration above (FH-9 according to [1]). */
    GrayF32 gray = ConvertBufferedImage.convertFromSingle(image, null, GrayF32.class);
    ConfigFastHessian config = new ConfigFastHessian(0, 2, FH_MAX_FEATURES_PER_SCALE, FH_INITIAL_SAMPLE_SIZE, FH_INITIAL_SIZE, FH_NUMBER_SCALES_PER_OCTAVE, FH_NUMBER_OF_OCTAVES);
    DetectDescribePoint<GrayF32, BrightFeature> surf = FactoryDetectDescribe.surfFast(config, null, null, GrayF32.class);
    surf.detect(gray);
    return surf;
}