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);
}
Aggregations