use of georegression.struct.se.Se2_F64 in project BoofCV by lessthanoptimal.
the class TestGenerateSe2_PlanePtPixel method perfect.
@Test
public 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.set(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);
}
use of georegression.struct.se.Se2_F64 in project BoofCV by lessthanoptimal.
the class TestQrCodePositionPatternDetector method considerConnect_negative_rotated.
/**
* The two patterns are rotated 45 degrees relative to each other
*/
@Test
public void considerConnect_negative_rotated() {
QrCodePositionPatternDetector<GrayF32> alg = createAlg();
SquareNode n0 = squareNode(40, 60, 70);
SquareNode n1 = squareNode(140, 60, 70);
Se2_F64 translate = new Se2_F64(-175, -95, 0);
Se2_F64 rotate = new Se2_F64(0, 0, UtilAngle.radian(45));
Se2_F64 tmp = translate.concat(rotate, null);
Se2_F64 combined = tmp.concat(translate.invert(null), null);
for (int i = 0; i < 4; i++) {
SePointOps_F64.transform(combined, n1.square.get(i), n1.square.get(i));
}
SePointOps_F64.transform(combined, n1.center, n1.center);
alg.considerConnect(n0, n1);
assertEquals(0, n0.getNumberOfConnections());
assertEquals(0, n1.getNumberOfConnections());
}
use of georegression.struct.se.Se2_F64 in project BoofCV by lessthanoptimal.
the class TestEllipseClustersIntoHexagonalGrid method process_affine.
/**
* Apply some affine distortion so that the grid isn't perfect
*/
@Test
public void process_affine() {
// scale different amounts along each axis and translate for fun
Affine2D_F64 affine0 = new Affine2D_F64(1.05, 0, 0, 0.95, 1, 2);
// rotate a bit
Affine2D_F64 affine1 = ConvertTransform_F64.convert(new Se2_F64(0, 0, 0.5), (Affine2D_F64) null);
// process_affine( 3,3,affine0);
process_affine(4, 3, affine0);
process_affine(4, 4, affine0);
process_affine(4, 5, affine0);
process_affine(5, 5, affine0);
// process_affine( 3,3,affine1);
process_affine(4, 3, affine1);
process_affine(4, 4, affine1);
process_affine(4, 5, affine1);
process_affine(5, 5, affine1);
}
use of georegression.struct.se.Se2_F64 in project BoofCV by lessthanoptimal.
the class TestSquaresIntoRegularClusters method createSquare.
private Polygon2D_F64 createSquare(double x, double y, double yaw, double width) {
Se2_F64 motion = new Se2_F64(x, y, yaw);
double r = width / 2;
Polygon2D_F64 poly = new Polygon2D_F64(4);
poly.get(0).set(-r, r);
poly.get(1).set(r, r);
poly.get(2).set(r, -r);
poly.get(3).set(-r, -r);
for (int i = 0; i < 4; i++) {
SePointOps_F64.transform(motion, poly.get(i), poly.get(i));
}
return poly;
}
use of georegression.struct.se.Se2_F64 in project BoofCV by lessthanoptimal.
the class TestSnapToLineEdge method fit_noisy_affine.
/**
* Fit the quad with a noisy initial guess
*/
@Test
public void fit_noisy_affine() {
// distorted and undistorted views
Affine2D_F64[] affines = new Affine2D_F64[2];
affines[0] = new Affine2D_F64();
affines[1] = new Affine2D_F64(1.3, 0.05, -0.15, 0.87, 0.1, 0.6);
ConvertTransform_F64.convert(new Se2_F64(0, 0, 0.2), affines[0]);
for (Class imageType : imageTypes) {
for (Affine2D_F64 a : affines) {
fit_noisy_affine(a, imageType);
}
}
}
Aggregations