Search in sources :

Example 91 with Point2D_F32

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

the class TestPointTransformHomography_F32 method compareToDirect.

/**
 * Directly computes the output
 */
@Test
public void compareToDirect() {
    Point2D_F32 input = new Point2D_F32(50, 60);
    Point2D_F32 output = new Point2D_F32();
    Point2D_F32 expected = new Point2D_F32();
    Homography2D_F32 H = new Homography2D_F32(1, 2, 3, 4, 5, 6, 7, 8, 9);
    HomographyPointOps_F32.transform(H, input, expected);
    PointTransformHomography_F32 alg = new PointTransformHomography_F32();
    alg.set(H);
    alg.compute(input.x, input.y, output);
    assertEquals(expected.x, output.x, 1e-4);
    assertEquals(expected.y, output.y, 1e-4);
}
Also used : Point2D_F32(georegression.struct.point.Point2D_F32) Homography2D_F32(georegression.struct.homography.Homography2D_F32) Test(org.junit.Test)

Example 92 with Point2D_F32

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

the class TestImageDeformPointMLS_F32 method checkNoTransform.

private void checkNoTransform(ImageDeformPointMLS_F32 alg) {
    alg.fixateUndistorted();
    alg.fixateDistorted();
    // should be no change now
    Point2D_F32 found = new Point2D_F32();
    for (int i = 0; i < height; i++) {
        for (int j = 0; j < width; j++) {
            alg.compute(j, i, found);
            assertEquals(j, found.x, GrlConstants.TEST_F32);
            assertEquals(i, found.y, GrlConstants.TEST_F32);
        }
    }
}
Also used : Point2D_F32(georegression.struct.point.Point2D_F32)

Example 93 with Point2D_F32

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

the class TestImageDeformPointMLS_F32 method CheckInterpolated.

private void CheckInterpolated(float x, float y, float expectedX, float expectedY, ImageDeformPointMLS_F32 alg) {
    Point2D_F32 p = new Point2D_F32();
    alg.interpolateDeformedPoint(x, y, p);
    assertEquals(expectedX, p.x, GrlConstants.TEST_F32);
    assertEquals(expectedY, p.y, GrlConstants.TEST_F32);
}
Also used : Point2D_F32(georegression.struct.point.Point2D_F32)

Example 94 with Point2D_F32

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

the class TestImageDeformPointMLS_F32 method checkCompute.

private void checkCompute(float x, float y, float expectedX, float expectedY, ImageDeformPointMLS_F32 alg) {
    Point2D_F32 found = new Point2D_F32();
    alg.compute(x, y, found);
    assertEquals(expectedX, found.x, GrlConstants.TEST_F32);
    assertEquals(expectedY, found.y, GrlConstants.TEST_F32);
}
Also used : Point2D_F32(georegression.struct.point.Point2D_F32)

Example 95 with Point2D_F32

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

the class TestImageDeformPointMLS_F32 method testAllAtOnce_CloserToCloser.

/**
 * See if the distorted point is closer to the closest control point
 */
@Test
public void testAllAtOnce_CloserToCloser() {
    for (TypeDeformMLS type : TypeDeformMLS.values()) {
        ImageDeformPointMLS_F32 alg = new ImageDeformPointMLS_F32(type);
        alg.configure(width, height, rows, cols);
        alg.addControl(5, 5);
        alg.addControl(10, 20);
        alg.addControl(30, 50);
        alg.addControl(16, 0);
        alg.setDistorted(0, 10, 12);
        alg.setDistorted(1, 14, 30);
        alg.setDistorted(2, 25, 45);
        alg.setDistorted(3, 20, 8);
        alg.fixateUndistorted();
        alg.fixateDistorted();
        Point2D_F32 a = new Point2D_F32();
        Point2D_F32 b = new Point2D_F32();
        alg.compute(4, 4, a);
        alg.compute(1, 4, b);
        float distA = a.distance(10, 12);
        float distB = b.distance(10, 12);
        assertTrue(distA < distB);
    }
}
Also used : Point2D_F32(georegression.struct.point.Point2D_F32) Test(org.junit.Test)

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