Search in sources :

Example 61 with TupleDesc_F64

use of boofcv.struct.feature.TupleDesc_F64 in project BoofCV by lessthanoptimal.

the class TestScoreAssociateSad_F64 method compareToExpected.

@Test
public void compareToExpected() {
    ScoreAssociateSad_F64 scorer = new ScoreAssociateSad_F64();
    TupleDesc_F64 a = new TupleDesc_F64(5);
    TupleDesc_F64 b = new TupleDesc_F64(5);
    a.value = new double[] { 1.1, 2, 3, 4.5, 5 };
    b.value = new double[] { -1, 2, 6.1, 3, 6 };
    assertEquals(7.7, scorer.score(a, b), 1e-2);
}
Also used : TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) Test(org.junit.Test)

Example 62 with TupleDesc_F64

use of boofcv.struct.feature.TupleDesc_F64 in project BoofCV by lessthanoptimal.

the class TestWrapAssociateSurfBasic method createAlg.

@Override
public AssociateDescription<BrightFeature> createAlg() {
    ScoreAssociation<TupleDesc_F64> score = new ScoreAssociateEuclidean_F64();
    AssociateDescription<TupleDesc_F64> assoc = FactoryAssociation.greedy(score, Double.MAX_VALUE, false);
    AssociateSurfBasic basic = new AssociateSurfBasic(assoc);
    return new WrapAssociateSurfBasic(basic);
}
Also used : TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) AssociateSurfBasic(boofcv.alg.feature.associate.AssociateSurfBasic)

Example 63 with TupleDesc_F64

use of boofcv.struct.feature.TupleDesc_F64 in project BoofCV by lessthanoptimal.

the class TestGenericDenseDescribeImage method process.

/**
 * Give it a known situation and see if it produces the expected results
 */
@Test
public void process() {
    DummyFeature sparse = new DummyFeature();
    GenericDenseDescribeImageDense alg = new GenericDenseDescribeImageDense(sparse, 1, 1.5, 3, 4);
    GrayU8 image = new GrayU8(100, 110);
    alg.process(image);
    List<TupleDesc_F64> descs = alg.getDescriptions();
    List<Point2D_I32> points = alg.getLocations();
    assertEquals(descs.size(), points.size());
    int featureRadius = (int) Math.round(1.5 * 7.0 / 2.0);
    int w = (100 - 2 * featureRadius) / 3;
    int h = (110 - 2 * featureRadius) / 4;
    // -1 since it intentionally skips feature 20
    assertEquals(w * h - 1, points.size());
    int count = 0;
    for (int y = 0; y < h; y++) {
        int pixelY = featureRadius + y * y;
        for (int x = 0; x < w; x++) {
            int pixelX = featureRadius + x * 3;
            Point2D_I32 p = null;
            if (count < 19) {
                p = points.get(count);
            } else if (count > 20) {
                p = points.get(count + 1);
            } else {
                continue;
            }
            assertEquals("count = " + count, pixelX, p.x);
            assertEquals(pixelY, p.y);
            count++;
        }
    }
}
Also used : TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) Point2D_I32(georegression.struct.point.Point2D_I32) GrayU8(boofcv.struct.image.GrayU8) DescribeRegionPoint(boofcv.abst.feature.describe.DescribeRegionPoint) Test(org.junit.Test)

Example 64 with TupleDesc_F64

use of boofcv.struct.feature.TupleDesc_F64 in project BoofCV by lessthanoptimal.

the class TestScoreAssociateCorrelation method compareToExpected.

@Test
public void compareToExpected() {
    ScoreAssociateCorrelation score = new ScoreAssociateCorrelation();
    TupleDesc_F64 a = new TupleDesc_F64(5);
    TupleDesc_F64 b = new TupleDesc_F64(5);
    a.value = new double[] { 1, 2, 3, 4, 5 };
    b.value = new double[] { 2, -1, 7, -8, 10 };
    assertEquals(-39, score.score(a, b), 1e-2);
}
Also used : TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) Test(org.junit.Test)

Example 65 with TupleDesc_F64

use of boofcv.struct.feature.TupleDesc_F64 in project BoofCV by lessthanoptimal.

the class TestScoreAssociateEuclideanSq_F64 method compareToExpected.

@Test
public void compareToExpected() {
    ScoreAssociateEuclideanSq_F64 score = new ScoreAssociateEuclideanSq_F64();
    TupleDesc_F64 a = new TupleDesc_F64(5);
    TupleDesc_F64 b = new TupleDesc_F64(5);
    a.value = new double[] { 1, 2, 3, 4, 5 };
    b.value = new double[] { 2, -1, 7, -8, 10 };
    assertEquals(195, score.score(a, b), 1e-4);
}
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