use of boofcv.struct.feature.TupleDesc_F64 in project BoofCV by lessthanoptimal.
the class BenchmarkAssociationSpeedSurf method createSet.
private FastQueue<TupleDesc_F64> createSet(String imageName) {
try {
BufferedImage image = ImageIO.read(new File(imageName));
GrayF32 gray = ConvertBufferedImage.convertFrom(image, (GrayF32) null);
FastQueue<TupleDesc_F64> ret = new FastQueue<>(10, TupleDesc_F64.class, false);
detector.detect(gray);
for (int i = 0; i < detector.getNumberOfFeatures(); i++) {
ret.add(detector.getDescription(i).copy());
}
return ret;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
use of boofcv.struct.feature.TupleDesc_F64 in project BoofCV by lessthanoptimal.
the class TestFeatureToWordHistogram_F64 method simpleTest_soft.
@Test
public void simpleTest_soft() {
FeatureToWordHistogram_F64 alg = new FeatureToWordHistogram_F64(new Assign(), false);
for (int i = 0; i < 7; i++) {
alg.addFeature(new TupleDesc_F64(5));
}
alg.process();
double[] histogram = alg.getHistogram();
checkSumOne(alg, histogram);
assertEquals(0, histogram[0], 1e-8);
assertEquals(0, histogram[1], 1e-8);
assertEquals(0.25, histogram[2], 1e-8);
assertEquals(0.75, histogram[3], 1e-8);
assertEquals(0, histogram[4], 1e-8);
}
use of boofcv.struct.feature.TupleDesc_F64 in project BoofCV by lessthanoptimal.
the class TestFeatureToWordHistogram_F64 method simpleTest_hard.
@Test
public void simpleTest_hard() {
FeatureToWordHistogram_F64 alg = new FeatureToWordHistogram_F64(new Assign(), true);
for (int i = 0; i < 7; i++) {
alg.addFeature(new TupleDesc_F64(5));
}
alg.process();
double[] histogram = alg.getHistogram();
checkSumOne(alg, histogram);
assertEquals(2.0 / 7.0, histogram[0], 1e-8);
assertEquals(2.0 / 7.0, histogram[1], 1e-8);
assertEquals(1.0 / 7.0, histogram[2], 1e-8);
assertEquals(1.0 / 7.0, histogram[3], 1e-8);
assertEquals(1.0 / 7.0, histogram[4], 1e-8);
}
use of boofcv.struct.feature.TupleDesc_F64 in project BoofCV by lessthanoptimal.
the class ExampleDenseImageFeatures method HighLevel.
// Here's an example of how to use the high level interface. There are a variety of algorithms to choose from
// For much larger images you might need to shrink the image down or change the cell size to get good results.
public static void HighLevel(GrayF32 input) {
System.out.println("\n------------------- Dense High Level");
DescribeImageDense<GrayF32, TupleDesc_F64> describer = FactoryDescribeImageDense.hog(new ConfigDenseHoG(), input.getImageType());
// sift(new ConfigDenseSift(),GrayF32.class);
// surfFast(new ConfigDenseSurfFast(),GrayF32.class);
// process the image and compute the dense image features
describer.process(input);
// print out part of the first few features
System.out.println("Total Features = " + describer.getLocations().size());
for (int i = 0; i < 5; i++) {
Point2D_I32 p = describer.getLocations().get(i);
TupleDesc_F64 d = describer.getDescriptions().get(i);
System.out.printf("%3d %3d = [ %f %f %f %f\n", p.x, p.y, d.value[0], d.value[1], d.value[2], d.value[3]);
// You would process the feature descriptor here
}
}
use of boofcv.struct.feature.TupleDesc_F64 in project BoofCV by lessthanoptimal.
the class TestClusterVisualWords method process.
@Test
public void process() {
DummyClusters clusters = new DummyClusters();
ClusterVisualWords alg = new ClusterVisualWords(clusters, DOF, SEED);
alg.addReference(new TupleDesc_F64(2));
alg.addReference(new TupleDesc_F64(2));
alg.addReference(new TupleDesc_F64(2));
alg.process(NUM_CLUSTERS);
assertEquals(1, clusters.numInit);
assertEquals(1, clusters.numProcess);
assertEquals(3, clusters.numInputPoints);
assertEquals(DISTANCE, clusters.getDistanceMeasure(), 1e-8);
}
Aggregations