Search in sources :

Example 51 with Point2D_F64

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

Example 52 with Point2D_F64

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

the class TestEquirectangularTools_F64 method lonlatToEquiFV.

@Test
public void lonlatToEquiFV() {
    EquirectangularTools_F64 tools = new EquirectangularTools_F64();
    tools.configure(width, height);
    Point2D_F64 found = new Point2D_F64();
    tools.latlonToEquiFV(-GrlConstants.PId2, 0, found);
    assertEquals(width / 2, found.x, GrlConstants.TEST_F64);
    assertEquals(height - 1, found.y, GrlConstants.TEST_F64);
    tools.latlonToEquiFV(GrlConstants.PId2, 0, found);
    assertEquals(width / 2, found.x, GrlConstants.TEST_F64);
    assertEquals(0, found.y, GrlConstants.TEST_F64);
}
Also used : Point2D_F64(georegression.struct.point.Point2D_F64) Test(org.junit.Test)

Example 53 with Point2D_F64

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

the class TestEquirectangularTools_F64 method equiToLonlatFV_reverse.

private void equiToLonlatFV_reverse(EquirectangularTools_F64 tools, double x, double y) {
    GeoLL_F64 ll = new GeoLL_F64();
    Point2D_F64 r = new Point2D_F64();
    tools.equiToLatLonFV(x, y, ll);
    tools.latlonToEquiFV(ll.lat, ll.lon, r);
    assertEquals(x, r.x, GrlConstants.TEST_F64);
    assertEquals(y, r.y, GrlConstants.TEST_F64);
}
Also used : Point2D_F64(georegression.struct.point.Point2D_F64) GeoLL_F64(boofcv.struct.geo.GeoLL_F64)

Example 54 with Point2D_F64

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

the class TestEquirectangularTools_F64 method equiToNorm_reverse.

private void equiToNorm_reverse(EquirectangularTools_F64 tools, double x, double y) {
    Point3D_F64 n = new Point3D_F64();
    Point2D_F64 r = new Point2D_F64();
    tools.equiToNorm(x, y, n);
    tools.normToEqui(n.x, n.y, n.z, r);
    assertEquals(x, r.x, GrlConstants.TEST_F64);
    assertEquals(y, r.y, GrlConstants.TEST_F64);
}
Also used : Point3D_F64(georegression.struct.point.Point3D_F64) Point2D_F64(georegression.struct.point.Point2D_F64)

Example 55 with Point2D_F64

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

the class TestEquirectangularTools_F64 method equiToLonlat_reverse.

private void equiToLonlat_reverse(EquirectangularTools_F64 tools, double x, double y) {
    GeoLL_F64 ll = new GeoLL_F64();
    Point2D_F64 r = new Point2D_F64();
    tools.equiToLatLon(x, y, ll);
    tools.latlonToEqui(ll.lat, ll.lon, r);
    assertEquals(x, r.x, GrlConstants.TEST_F64);
    assertEquals(y, r.y, GrlConstants.TEST_F64);
}
Also used : Point2D_F64(georegression.struct.point.Point2D_F64) GeoLL_F64(boofcv.struct.geo.GeoLL_F64)

Aggregations

Point2D_F64 (georegression.struct.point.Point2D_F64)360 Test (org.junit.Test)129 Point3D_F64 (georegression.struct.point.Point3D_F64)85 Se3_F64 (georegression.struct.se.Se3_F64)68 ArrayList (java.util.ArrayList)57 DMatrixRMaj (org.ejml.data.DMatrixRMaj)48 AssociatedPair (boofcv.struct.geo.AssociatedPair)28 CameraPinholeRadial (boofcv.struct.calib.CameraPinholeRadial)16 Point2Transform2_F64 (boofcv.struct.distort.Point2Transform2_F64)15 GrayF32 (boofcv.struct.image.GrayF32)13 Vector3D_F64 (georegression.struct.point.Vector3D_F64)13 Polygon2D_F64 (georegression.struct.shapes.Polygon2D_F64)13 Point2D3D (boofcv.struct.geo.Point2D3D)11 GrayU8 (boofcv.struct.image.GrayU8)11 Point2D_I32 (georegression.struct.point.Point2D_I32)11 AssociatedIndex (boofcv.struct.feature.AssociatedIndex)10 EllipseRotated_F64 (georegression.struct.curve.EllipseRotated_F64)9 DescribeRegionPoint (boofcv.abst.feature.describe.DescribeRegionPoint)8 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)8 BufferedImage (java.awt.image.BufferedImage)8