use of boofcv.struct.feature.TupleDesc_F64 in project BoofCV by lessthanoptimal.
the class ExampleFeatureSurf method easy.
/**
* Use generalized interfaces for working with SURF. This removes much of the drudgery, but also reduces flexibility
* and slightly increases memory and computational requirements.
*
* @param image Input image type. DOES NOT NEED TO BE GrayF32, GrayU8 works too
*/
public static void easy(GrayF32 image) {
// create the detector and descriptors
ConfigFastHessian configDetector = new ConfigFastHessian();
configDetector.extract = new ConfigExtract(2, 0, 5, true);
configDetector.maxFeaturesPerScale = 200;
configDetector.initialSampleStep = 2;
DetectDescribePoint<GrayF32, TupleDesc_F64> surf = FactoryDetectDescribe.surfStable(configDetector, null, null, GrayF32.class);
// specify the image to process
surf.detect(image);
System.out.println("Found Features: " + surf.getNumberOfFeatures());
System.out.println("First descriptor's first value: " + surf.getDescription(0).data[0]);
}
use of boofcv.struct.feature.TupleDesc_F64 in project BoofCV by lessthanoptimal.
the class ExampleFeatureSurf method harder.
/**
* Configured exactly the same as the easy example above, but require a lot more code and a more in depth
* understanding of how SURF works and is configured. Each sub-problem which composes "SURF" is now explicitly
* created and configured independently. This allows an advance user to tune it for a specific problem.
*
* @param image Input image type. DOES NOT NEED TO BE GrayF32, GrayU8 works too
*/
public static <II extends ImageGray<II>> void harder(GrayF32 image) {
// SURF works off of integral images
Class<II> integralType = GIntegralImageOps.getIntegralType(GrayF32.class);
// define the feature detection algorithm
ConfigFastHessian config = new ConfigFastHessian();
config.extract = new ConfigExtract(2, 0, 5, true);
config.maxFeaturesPerScale = 200;
config.initialSampleStep = 2;
FastHessianFeatureDetector<II> detector = FactoryInterestPointAlgs.fastHessian(config);
// estimate orientation
OrientationIntegral<II> orientation = FactoryOrientationAlgs.sliding_ii(null, integralType);
DescribePointSurf<II> descriptor = FactoryDescribeAlgs.surfStability(null, integralType);
// compute the integral image of 'image'
II integral = GeneralizedImageOps.createSingleBand(integralType, image.width, image.height);
GIntegralImageOps.transform(image, integral);
// detect fast hessian features
detector.detect(integral);
// tell algorithms which image to process
orientation.setImage(integral);
descriptor.setImage(integral);
List<ScalePoint> points = detector.getFoundFeatures();
List<TupleDesc_F64> descriptions = new ArrayList<>();
for (ScalePoint p : points) {
// estimate orientation
orientation.setObjectRadius(p.scale * BoofDefaults.SURF_SCALE_TO_RADIUS);
double angle = orientation.compute(p.pixel.x, p.pixel.y);
// extract the SURF description for this region
TupleDesc_F64 desc = descriptor.createDescription();
descriptor.describe(p.pixel.x, p.pixel.y, angle, p.scale, true, desc);
// save everything for processing later on
descriptions.add(desc);
}
System.out.println("Found Features: " + points.size());
System.out.println("First descriptor's first value: " + descriptions.get(0).data[0]);
}
use of boofcv.struct.feature.TupleDesc_F64 in project BoofCV by lessthanoptimal.
the class TestConvertTupleDesc_F64_F32 method convert.
@Test
void convert() {
var alg = new ConvertTupleDesc_F64_F32(5);
var input = new TupleDesc_F64(5);
input.data = new double[] { 2.5, 3, 20, -43.45, 2.123 };
TupleDesc_F32 found = alg.createOutput();
alg.convert(input, found);
for (int i = 0; i < 5; i++) {
assertEquals(input.data[i], found.data[i], UtilEjml.TEST_F32);
}
}
use of boofcv.struct.feature.TupleDesc_F64 in project BoofCV by lessthanoptimal.
the class TestDescribeRegionPointConvert method basic.
@Test
public void basic() {
DummyConvert convert = new DummyConvert();
DummyDescribe original = new DummyDescribe();
DescribePointRadiusAngleConvertTuple<GrayF32, TupleDesc_F64, TupleDesc_S8> alg = new DescribePointRadiusAngleConvertTuple<>(original, convert);
TupleDesc_S8 found = alg.createDescription();
assertEquals(found.data.length, 5);
assertFalse(original.calledImageSet);
alg.setImage(null);
assertTrue(original.calledImageSet);
alg.process(1, 2, 2, 2, found);
assertEquals(5, found.data[0]);
assertEquals(original.isOriented(), alg.isOriented());
assertEquals(original.isScalable(), alg.isScalable());
assertSame(alg.getDescriptionType(), TupleDesc_S8.class);
}
use of boofcv.struct.feature.TupleDesc_F64 in project BoofCV by lessthanoptimal.
the class TestDescribeImageDenseSift method describe.
private TupleDesc_F64 describe(int x, int y, DescribeImageDense alg) {
DescribeImageDenseSift sift = (DescribeImageDenseSift) alg;
TupleDesc_F64 output = sift.createDescription();
sift.alg.computeDescriptor(x, y, output);
return output;
}
Aggregations