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]);
}
}
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]);
}
}
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;
}
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));
}
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;
}
Aggregations