use of boofcv.alg.geo.h.HomographyDirectLinearTransform in project BoofCV by lessthanoptimal.
the class CheckRefineHomography method perfectInput.
@Test
public void perfectInput() {
createScene(30, false);
// use the linear algorithm to compute the homography
HomographyDirectLinearTransform estimator = new HomographyDirectLinearTransform(true);
estimator.process(pairs, H);
ModelFitter<DMatrixRMaj, AssociatedPair> alg = createAlgorithm();
// give it the perfect matrix and see if it screwed it up
assertTrue(alg.fitModel(pairs, H, found));
// normalize so that they are the same
CommonOps_DDRM.divide(H, H.get(2, 2));
CommonOps_DDRM.divide(found, found.get(2, 2));
assertTrue(MatrixFeatures_DDRM.isEquals(H, found, 1e-8));
}
use of boofcv.alg.geo.h.HomographyDirectLinearTransform in project BoofCV by lessthanoptimal.
the class CheckRefineHomography method incorrectInput.
@Test
public void incorrectInput() {
createScene(30, false);
// use the linear algorithm to compute the homography
HomographyDirectLinearTransform estimator = new HomographyDirectLinearTransform(true);
estimator.process(pairs, H);
ModelFitter<DMatrixRMaj, AssociatedPair> alg = createAlgorithm();
// give it the perfect matrix and see if it screwed it up
DMatrixRMaj Hmod = H.copy();
Hmod.data[0] += 0.1;
Hmod.data[5] += 0.1;
assertTrue(alg.fitModel(pairs, Hmod, found));
// normalize to allow comparison
CommonOps_DDRM.divide(H, H.get(2, 2));
CommonOps_DDRM.divide(Hmod, Hmod.get(2, 2));
CommonOps_DDRM.divide(found, found.get(2, 2));
double error0 = 0;
double error1 = 0;
// very crude error metric
for (int i = 0; i < 9; i++) {
error0 += Math.abs(Hmod.data[i] - H.data[i]);
error1 += Math.abs(found.data[i] - H.data[i]);
}
// System.out.println("error "+error1);
assertTrue(error1 < error0);
}
Aggregations