Search in sources :

Example 76 with Point2D_F32

use of georegression.struct.point.Point2D_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)

Example 77 with Point2D_F32

use of georegression.struct.point.Point2D_F32 in project BoofCV by lessthanoptimal.

the class TestEquirectangularTools_F32 method equiToLonlat_reverse.

private void equiToLonlat_reverse(EquirectangularTools_F32 tools, float x, float y) {
    GeoLL_F32 ll = new GeoLL_F32();
    Point2D_F32 r = new Point2D_F32();
    tools.equiToLatLon(x, y, ll);
    tools.latlonToEqui(ll.lat, ll.lon, r);
    assertEquals(x, r.x, GrlConstants.TEST_F32);
    assertEquals(y, r.y, GrlConstants.TEST_F32);
}
Also used : GeoLL_F32(boofcv.struct.geo.GeoLL_F32) Point2D_F32(georegression.struct.point.Point2D_F32)

Example 78 with Point2D_F32

use of georegression.struct.point.Point2D_F32 in project BoofCV by lessthanoptimal.

the class TestEquirectangularTools_F32 method lonlatToEqui.

@Test
public void lonlatToEqui() {
    EquirectangularTools_F32 tools = new EquirectangularTools_F32();
    tools.configure(width, height);
    Point2D_F32 found = new Point2D_F32();
    tools.latlonToEqui(GrlConstants.F_PId2, 0, found);
    assertEquals(width / 2, found.x, GrlConstants.TEST_F32);
    assertEquals(height - 1, found.y, GrlConstants.TEST_F32);
    tools.latlonToEqui(-GrlConstants.F_PId2, 0, found);
    assertEquals(width / 2, found.x, GrlConstants.TEST_F32);
    assertEquals(0, found.y, GrlConstants.TEST_F32);
}
Also used : Point2D_F32(georegression.struct.point.Point2D_F32) Test(org.junit.Test)

Example 79 with Point2D_F32

use of georegression.struct.point.Point2D_F32 in project BoofCV by lessthanoptimal.

the class TestEquirectangularTools_F32 method equiToNorm_reverseFV.

private void equiToNorm_reverseFV(EquirectangularTools_F32 tools, float x, float y) {
    Point3D_F32 n = new Point3D_F32();
    Point2D_F32 r = new Point2D_F32();
    tools.equiToNormFV(x, y, n);
    tools.normToEquiFV(n.x, n.y, n.z, r);
    assertEquals(x, r.x, GrlConstants.TEST_F32);
    assertEquals(y, r.y, GrlConstants.TEST_F32);
}
Also used : Point3D_F32(georegression.struct.point.Point3D_F32) Point2D_F32(georegression.struct.point.Point2D_F32)

Example 80 with Point2D_F32

use of georegression.struct.point.Point2D_F32 in project BoofCV by lessthanoptimal.

the class TestEquirectangularTools_F32 method equiToLonlatFV_reverse.

private void equiToLonlatFV_reverse(EquirectangularTools_F32 tools, float x, float y) {
    GeoLL_F32 ll = new GeoLL_F32();
    Point2D_F32 r = new Point2D_F32();
    tools.equiToLatLonFV(x, y, ll);
    tools.latlonToEquiFV(ll.lat, ll.lon, r);
    assertEquals(x, r.x, GrlConstants.TEST_F32);
    assertEquals(y, r.y, GrlConstants.TEST_F32);
}
Also used : GeoLL_F32(boofcv.struct.geo.GeoLL_F32) Point2D_F32(georegression.struct.point.Point2D_F32)

Aggregations

Point2D_F32 (georegression.struct.point.Point2D_F32)98 Test (org.junit.Test)36 Point3D_F32 (georegression.struct.point.Point3D_F32)10 Point2Transform2_F32 (boofcv.struct.distort.Point2Transform2_F32)9 LineSegment2D_F32 (georegression.struct.line.LineSegment2D_F32)8 ArrayList (java.util.ArrayList)8 Point2D_F64 (georegression.struct.point.Point2D_F64)7 FMatrixRMaj (org.ejml.data.FMatrixRMaj)7 CameraPinholeRadial (boofcv.struct.calib.CameraPinholeRadial)5 LineParametric2D_F32 (georegression.struct.line.LineParametric2D_F32)5 Point2Transform3_F32 (boofcv.struct.distort.Point2Transform3_F32)4 Point3Transform2_F32 (boofcv.struct.distort.Point3Transform2_F32)4 GrayF32 (boofcv.struct.image.GrayF32)4 ClosestPoint2D_F32 (georegression.metric.ClosestPoint2D_F32)4 PointToPixelTransform_F32 (boofcv.alg.distort.PointToPixelTransform_F32)3 CameraPinhole (boofcv.struct.calib.CameraPinhole)3 GrayU8 (boofcv.struct.image.GrayU8)3 PixelTransformCached_F32 (boofcv.alg.distort.PixelTransformCached_F32)2 PinholePtoN_F32 (boofcv.alg.distort.pinhole.PinholePtoN_F32)2 CalibrationObservation (boofcv.alg.geo.calibration.CalibrationObservation)2