use of boofcv.abst.feature.associate.ScoreAssociateEuclidean_F64 in project BoofCV by lessthanoptimal.
the class TestAssociateGreedyBruteForce2D_MT method compare.
void compare(boolean backwards, double ratioTest) {
DogArray<TupleDesc_F64> descSrc = createData(200);
DogArray<TupleDesc_F64> descDst = createData(200);
DogArray<Point2D_F64> pointsSrc = createPoints(200);
DogArray<Point2D_F64> pointsDst = createPoints(200);
var distance = new AssociateImageDistanceEuclideanSq();
var sequentialAlg = new AssociateGreedyBruteForce2D<>(new ScoreAssociateEuclidean_F64(), distance);
sequentialAlg.init(width, height);
sequentialAlg.maxDistanceLength.setTo(ConfigLength.relative(0.25, 6));
sequentialAlg.backwardsValidation = backwards;
sequentialAlg.setRatioTest(ratioTest);
sequentialAlg.setMaxFitError(0.5);
sequentialAlg.setSource(pointsSrc, descSrc);
sequentialAlg.setDestination(pointsDst, descDst);
sequentialAlg.associate();
var parallelAlg = new AssociateGreedyBruteForce2D_MT<>(new ScoreAssociateEuclidean_F64(), distance);
parallelAlg.init(width, height);
parallelAlg.maxDistanceLength.setTo(ConfigLength.relative(0.25, 6));
parallelAlg.backwardsValidation = backwards;
parallelAlg.setRatioTest(ratioTest);
parallelAlg.setMaxFitError(0.5);
parallelAlg.setSource(pointsSrc, descSrc);
parallelAlg.setDestination(pointsDst, descDst);
parallelAlg.associate();
int[] pairs0 = sequentialAlg.getPairs().data;
int[] pairs1 = parallelAlg.getPairs().data;
double[] quality0 = sequentialAlg.getFitQuality().data;
double[] quality1 = parallelAlg.getFitQuality().data;
assertEquals(pairs0.length, pairs1.length);
for (int i = 0; i < pairs0.length; i++) {
assertEquals(pairs0[i], pairs1[i]);
assertEquals(quality0[i], quality1[i]);
}
}
use of boofcv.abst.feature.associate.ScoreAssociateEuclidean_F64 in project BoofCV by lessthanoptimal.
the class TestAssociateGreedyDesc_MT method compare.
void compare(boolean backwards, double ratioTest) {
DogArray<TupleDesc_F64> a = createData(200);
DogArray<TupleDesc_F64> b = createData(200);
AssociateGreedyDesc<TupleDesc_F64> sequentialAlg = new AssociateGreedyDesc<>(new ScoreAssociateEuclidean_F64());
sequentialAlg.backwardsValidation = backwards;
sequentialAlg.setRatioTest(ratioTest);
sequentialAlg.setMaxFitError(0.5);
sequentialAlg.associate(a, b);
AssociateGreedyDesc_MT<TupleDesc_F64> parallelAlg = new AssociateGreedyDesc_MT<>(new ScoreAssociateEuclidean_F64());
parallelAlg.backwardsValidation = backwards;
parallelAlg.setRatioTest(ratioTest);
parallelAlg.setMaxFitError(0.5);
parallelAlg.associate(a, b);
int[] pairs0 = sequentialAlg.getPairs().data;
int[] pairs1 = parallelAlg.getPairs().data;
double[] quality0 = sequentialAlg.getFitQuality().data;
double[] quality1 = parallelAlg.getFitQuality().data;
assertEquals(pairs0.length, pairs1.length);
for (int i = 0; i < pairs0.length; i++) {
assertEquals(pairs0[i], pairs1[i]);
assertEquals(quality0[i], quality1[i]);
}
}
Aggregations