Search in sources :

Example 1 with Transform2ThenPixel_F32

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

the class TestRemoveRadialPtoN_F32 method checkAgainstAdd.

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

Aggregations

Transform2ThenPixel_F32 (boofcv.alg.distort.Transform2ThenPixel_F32)1 Point2D_F32 (georegression.struct.point.Point2D_F32)1 FMatrixRMaj (org.ejml.data.FMatrixRMaj)1