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