Search in sources :

Example 1 with CameraPlaneProjection

use of boofcv.alg.sfm.overhead.CameraPlaneProjection in project BoofCV by lessthanoptimal.

the class TestGenerateSe2_PlanePtPixel method perfect.

@Test
void perfect() {
    alg.setExtrinsic(planeToCamera);
    CameraPlaneProjection planeProjection = new CameraPlaneProjection();
    planeProjection.setConfiguration(planeToCamera, intrinsic);
    for (int i = 0; i < alg.getMinimumPoints(); i++) {
        PlanePtPixel s = new PlanePtPixel();
        double x = rand.nextDouble() * intrinsic.width;
        double y = rand.nextDouble() * intrinsic.height;
        Point2D_F64 pixelA = new Point2D_F64(x, y);
        Point2D_F64 planePtA = new Point2D_F64();
        planeProjection.pixelToPlane(pixelA.x, pixelA.y, planePtA);
        Point2D_F64 planePtB = new Point2D_F64();
        SePointOps_F64.transform(motion2D, planePtA, planePtB);
        planeProjection.planeToNormalized(planePtB.x, planePtB.y, s.normalizedCurr);
        s.planeKey.setTo(planePtA);
        observations.add(s);
    }
    Se2_F64 found = new Se2_F64();
    assertTrue(alg.generate(observations, found));
    assertEquals(motion2D.T.x, found.T.x, 1e-8);
    assertEquals(motion2D.T.y, found.T.y, 1e-8);
    assertEquals(motion2D.getYaw(), found.getYaw(), 1e-8);
}
Also used : Point2D_F64(georegression.struct.point.Point2D_F64) PlanePtPixel(boofcv.struct.sfm.PlanePtPixel) CameraPlaneProjection(boofcv.alg.sfm.overhead.CameraPlaneProjection) Se2_F64(georegression.struct.se.Se2_F64) Test(org.junit.jupiter.api.Test)

Aggregations

CameraPlaneProjection (boofcv.alg.sfm.overhead.CameraPlaneProjection)1 PlanePtPixel (boofcv.struct.sfm.PlanePtPixel)1 Point2D_F64 (georegression.struct.point.Point2D_F64)1 Se2_F64 (georegression.struct.se.Se2_F64)1 Test (org.junit.jupiter.api.Test)1