use of boofcv.alg.feature.describe.llah.LlahDocument in project BoofCV by lessthanoptimal.
the class TestUchiyaMarkerTracker method fitHomography.
@Test
void fitHomography() {
var doc_to_image = new Homography2D_F64(2, 0, 10, 0, 1.5, -5.6, 0, 0, 1);
List<Point2D_F64> landmarks = UtilPoint2D_F64.random(-1, 1, 10, rand);
List<Point2D_F64> dots = new ArrayList<>();
for (var m : landmarks) {
var d = new Point2D_F64();
HomographyPointOps_F64.transform(doc_to_image, m, d);
dots.add(d);
}
// Shuffle the order to test to see if the correct book keeping is being done
List<Point2D_F64> dotsShuffled = new ArrayList<>(dots);
Collections.shuffle(dotsShuffled, rand);
var document = new LlahDocument();
document.landmarks.copyAll(landmarks, (src, dst) -> dst.setTo(src));
var observed = new LlahOperations.FoundDocument();
observed.init(document);
for (int i = 0; i < landmarks.size(); i++) {
observed.landmarkHits.data[i] = 1000;
observed.landmarkToDots.data[i] = dotsShuffled.indexOf(dots.get(i));
}
UchiyaMarkerTracker alg = createTracker();
assertTrue(alg.fitHomography(dotsShuffled, observed));
Homography2D_F64 found = alg.ransac.getModelParameters();
CommonOps_DDF3.divide(found, found.a33);
assertTrue(MatrixFeatures_DDF3.isIdentical(doc_to_image, found, UtilEjml.TEST_F64));
}
Aggregations