Search in sources :

Example 1 with Transform2ThenPixel_F64

use of boofcv.alg.distort.Transform2ThenPixel_F64 in project BoofCV by lessthanoptimal.

the class TestRemoveRadialPtoN_F64 method checkAgainstAdd.

public void checkAgainstAdd(double t1, double t2) {
    double fx = 600;
    double fy = 500;
    double skew = 2;
    double xc = 300;
    double yc = 350;
    /**/
    double[] radial = new /**/
    double[] { 0.12, -0.13 };
    Point2D_F64 point = new Point2D_F64();
    double undistX = 19.5;
    double undistY = 200.1;
    AddRadialPtoN_F64 p_to_n = new AddRadialPtoN_F64().setK(fx, fy, skew, xc, yc).setDistortion(radial, t1, t2);
    new Transform2ThenPixel_F64(p_to_n).set(fx, fy, skew, xc, yc).compute(undistX, undistY, point);
    double distX = point.x;
    double distY = point.y;
    RemoveRadialPtoN_F64 alg = new RemoveRadialPtoN_F64().setK(fx, fy, skew, xc, yc).setDistortion(radial, t1, t2);
    alg.compute(distX, distY, point);
    // / go from calibrated coordinates to pixel
    DMatrixRMaj K = PerspectiveOps.calibrationMatrix(fx, fy, skew, xc, yc);
    GeometryMath_F64.mult(K, point, point);
    assertEquals(undistX, point.x, GrlConstants.TEST_SQ_F64);
    assertEquals(undistY, point.y, GrlConstants.TEST_SQ_F64);
}
Also used : Transform2ThenPixel_F64(boofcv.alg.distort.Transform2ThenPixel_F64) Point2D_F64(georegression.struct.point.Point2D_F64) DMatrixRMaj(org.ejml.data.DMatrixRMaj)

Aggregations

Transform2ThenPixel_F64 (boofcv.alg.distort.Transform2ThenPixel_F64)1 Point2D_F64 (georegression.struct.point.Point2D_F64)1 DMatrixRMaj (org.ejml.data.DMatrixRMaj)1