Search in sources :

Example 11 with CameraKannalaBrandt

use of boofcv.struct.calib.CameraKannalaBrandt in project BoofCV by lessthanoptimal.

the class TestKannalaBrandtPtoS_F64 method simpleSanityCheck_SymmetricOnly.

/**
 * Given spherical coordinates, compute pixel coordinates and see if we can invert them correctly.
 */
@Test
void simpleSanityCheck_SymmetricOnly() {
    CameraKannalaBrandt model = new CameraKannalaBrandt().fsetK(500, 550, 0.0, 600, 650);
    model.fsetSymmetric(1.0, 0.1);
    var expected = new Point3D_F64(0.1, -0.05, 0.8);
    var pixel = new Point2D_F64();
    var found = new Point3D_F64();
    new KannalaBrandtStoP_F64(model).compute(expected.x, expected.y, expected.z, pixel);
    new KannalaBrandtPtoS_F64(model).compute(pixel.x, pixel.y, found);
    // make sure both have them have a norm of 1
    expected.divideIP(expected.norm());
    found.divideIP(found.norm());
    // This should be very accurate. The inaccurate part isn't being called
    assertEquals(0.0, expected.distance(found), UtilEjml.TEST_F64);
}
Also used : Point3D_F64(georegression.struct.point.Point3D_F64) Point2D_F64(georegression.struct.point.Point2D_F64) CameraKannalaBrandt(boofcv.struct.calib.CameraKannalaBrandt) Test(org.junit.jupiter.api.Test)

Aggregations

CameraKannalaBrandt (boofcv.struct.calib.CameraKannalaBrandt)11 Test (org.junit.jupiter.api.Test)10 Point2D_F64 (georegression.struct.point.Point2D_F64)5 Point3D_F64 (georegression.struct.point.Point3D_F64)4 Point3Transform2_F64 (boofcv.struct.distort.Point3Transform2_F64)1 ArrayList (java.util.ArrayList)1 FunctionNtoM (org.ddogleg.optimization.functions.FunctionNtoM)1 FunctionNtoMxN (org.ddogleg.optimization.functions.FunctionNtoMxN)1 DMatrix2x2 (org.ejml.data.DMatrix2x2)1 DMatrixRMaj (org.ejml.data.DMatrixRMaj)1