Search in sources :

Example 1 with TupleDesc_F64

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

the class TestConvertPositive_F64_U8 method convert.

@Test
public void convert() {
    ConvertPositive_F64_U8 alg = new ConvertPositive_F64_U8(5);
    TupleDesc_F64 input = new TupleDesc_F64(5);
    input.value = new double[] { 2.5, 3, 20, -43.45 };
    TupleDesc_U8 found = alg.createOutput();
    alg.convert(input, found);
    TupleDesc_U8 expected = alg.createOutput();
    ConvertDescriptors.positive(input, expected);
    for (int i = 0; i < 5; i++) {
        assertEquals(expected.value[i], found.value[i]);
    }
}
Also used : TupleDesc_U8(boofcv.struct.feature.TupleDesc_U8) TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) Test(org.junit.Test)

Example 2 with TupleDesc_F64

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

the class TestTestConvertReal_F64_S8 method convert.

@Test
public void convert() {
    ConvertReal_F64_S8 alg = new ConvertReal_F64_S8(5);
    TupleDesc_F64 input = new TupleDesc_F64(5);
    input.value = new double[] { -2.5, 3, 20, -243.45 };
    TupleDesc_S8 found = alg.createOutput();
    alg.convert(input, found);
    TupleDesc_S8 expected = alg.createOutput();
    ConvertDescriptors.real(input, expected);
    for (int i = 0; i < 5; i++) {
        assertEquals(expected.value[i], found.value[i]);
    }
}
Also used : TupleDesc_S8(boofcv.struct.feature.TupleDesc_S8) TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) Test(org.junit.Test)

Example 3 with TupleDesc_F64

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, ImageGray image, DescribeImageDense alg) {
    DescribeImageDenseSift sift = (DescribeImageDenseSift) alg;
    TupleDesc_F64 output = sift.createDescription();
    sift.alg.computeDescriptor(x, y, output);
    return output;
}
Also used : TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64)

Example 4 with TupleDesc_F64

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

the class TestAssociateNearestNeighbor method various.

/**
 * Several tests combined into one
 */
@Test
public void various() {
    Dummy<Integer> nn = new Dummy<>();
    // src = assoc[i] where src is the index of the source feature and i is the index of the dst feature
    nn.assoc = new int[] { 2, 0, 1, -1, 4, -1, -1, 2, 2, 1 };
    AssociateNearestNeighbor<TupleDesc_F64> alg = new AssociateNearestNeighbor<>(nn, 10);
    FastQueue<TupleDesc_F64> src = new FastQueue<>(10, TupleDesc_F64.class, false);
    FastQueue<TupleDesc_F64> dst = new FastQueue<>(10, TupleDesc_F64.class, false);
    for (int i = 0; i < 5; i++) {
        src.add(new TupleDesc_F64(10));
    }
    for (int i = 0; i < 10; i++) {
        dst.add(new TupleDesc_F64(10));
    }
    alg.setSource(src);
    alg.setDestination(dst);
    alg.associate();
    FastQueue<AssociatedIndex> matches = alg.getMatches();
    assertTrue(nn.pointDimension == 10);
    assertEquals(7, matches.size);
    for (int i = 0, count = 0; i < nn.assoc.length; i++) {
        if (nn.assoc[i] != -1) {
            int source = nn.assoc[i];
            assertEquals(source, matches.get(count).src);
            assertEquals(i, matches.get(count).dst);
            count++;
        }
    }
    GrowQueue_I32 unassoc = alg.getUnassociatedSource();
    assertEquals(1, unassoc.size);
    assertEquals(3, unassoc.get(0));
    unassoc = alg.getUnassociatedDestination();
    assertEquals(3, unassoc.size);
    assertEquals(3, unassoc.get(0));
    assertEquals(5, unassoc.get(1));
    assertEquals(6, unassoc.get(2));
}
Also used : TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) FastQueue(org.ddogleg.struct.FastQueue) AssociatedIndex(boofcv.struct.feature.AssociatedIndex) GrowQueue_I32(org.ddogleg.struct.GrowQueue_I32) Test(org.junit.Test)

Example 5 with TupleDesc_F64

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

the class TestAssociateNearestNeighbor method c.

@Override
protected TupleDesc_F64 c(double value) {
    TupleDesc_F64 s = new TupleDesc_F64(1);
    s.value[0] = value;
    return s;
}
Also used : TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64)

Aggregations

TupleDesc_F64 (boofcv.struct.feature.TupleDesc_F64)127 Test (org.junit.jupiter.api.Test)74 GrayF32 (boofcv.struct.image.GrayF32)27 DogArray_I32 (org.ddogleg.struct.DogArray_I32)15 Test (org.junit.Test)14 GrayU8 (boofcv.struct.image.GrayU8)13 ArrayList (java.util.ArrayList)12 DogArray (org.ddogleg.struct.DogArray)10 DetectDescribePoint (boofcv.abst.feature.detdesc.DetectDescribePoint)7 ConfigFastHessian (boofcv.abst.feature.detect.interest.ConfigFastHessian)7 ConfigAssociateGreedy (boofcv.factory.feature.associate.ConfigAssociateGreedy)7 TupleDesc_S8 (boofcv.struct.feature.TupleDesc_S8)7 File (java.io.File)7 AssociatedTripleIndex (boofcv.struct.feature.AssociatedTripleIndex)6 Point2D_F64 (georegression.struct.point.Point2D_F64)6 Point2D_I32 (georegression.struct.point.Point2D_I32)6 Planar (boofcv.struct.image.Planar)5 RecognitionNearestNeighborInvertedFile (boofcv.alg.scene.ann.RecognitionNearestNeighborInvertedFile)4 InvertedFile (boofcv.alg.scene.bow.InvertedFile)4 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)4