Search in sources :

Example 16 with TupleDesc_F64

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);
    }
}
Also used : GrayF32(boofcv.struct.image.GrayF32) TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) FastQueue(org.ddogleg.struct.FastQueue) IOException(java.io.IOException) File(java.io.File) BufferedImage(java.awt.image.BufferedImage) ConvertBufferedImage(boofcv.io.image.ConvertBufferedImage) DetectDescribePoint(boofcv.abst.feature.detdesc.DetectDescribePoint)

Example 17 with TupleDesc_F64

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);
}
Also used : TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) Test(org.junit.Test)

Example 18 with TupleDesc_F64

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);
}
Also used : TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) Test(org.junit.Test)

Example 19 with TupleDesc_F64

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
    }
}
Also used : GrayF32(boofcv.struct.image.GrayF32) TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) ConfigDenseHoG(boofcv.factory.feature.dense.ConfigDenseHoG) Point2D_I32(georegression.struct.point.Point2D_I32)

Example 20 with TupleDesc_F64

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);
}
Also used : TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) Test(org.junit.Test)

Aggregations

TupleDesc_F64 (boofcv.struct.feature.TupleDesc_F64)66 Test (org.junit.Test)47 GrayF32 (boofcv.struct.image.GrayF32)17 GrayU8 (boofcv.struct.image.GrayU8)8 Point2D_I32 (georegression.struct.point.Point2D_I32)6 TupleDesc_S8 (boofcv.struct.feature.TupleDesc_S8)5 ArrayList (java.util.ArrayList)5 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)4 BufferedImage (java.awt.image.BufferedImage)4 File (java.io.File)4 DescribeRegionPoint (boofcv.abst.feature.describe.DescribeRegionPoint)3 DetectDescribePoint (boofcv.abst.feature.detdesc.DetectDescribePoint)3 TupleDesc_U8 (boofcv.struct.feature.TupleDesc_U8)3 Planar (boofcv.struct.image.Planar)3 Point3D_F64 (georegression.struct.point.Point3D_F64)3 HistogramScene (boofcv.alg.scene.HistogramScene)2 AssociatedIndex (boofcv.struct.feature.AssociatedIndex)2 ImageGray (boofcv.struct.image.ImageGray)2 IOException (java.io.IOException)2 FastQueue (org.ddogleg.struct.FastQueue)2