Search in sources :

Example 6 with Se2_F64

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);
}
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.Test)

Example 7 with Se2_F64

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());
}
Also used : GrayF32(boofcv.struct.image.GrayF32) SquareNode(boofcv.alg.fiducial.calib.squares.SquareNode) Se2_F64(georegression.struct.se.Se2_F64) Test(org.junit.Test)

Example 8 with Se2_F64

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);
}
Also used : Affine2D_F64(georegression.struct.affine.Affine2D_F64) Se2_F64(georegression.struct.se.Se2_F64) Test(org.junit.Test)

Example 9 with Se2_F64

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;
}
Also used : Se2_F64(georegression.struct.se.Se2_F64) Polygon2D_F64(georegression.struct.shapes.Polygon2D_F64)

Example 10 with Se2_F64

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);
        }
    }
}
Also used : Affine2D_F64(georegression.struct.affine.Affine2D_F64) Se2_F64(georegression.struct.se.Se2_F64) Test(org.junit.Test)

Aggregations

Se2_F64 (georegression.struct.se.Se2_F64)14 Test (org.junit.Test)8 Affine2D_F64 (georegression.struct.affine.Affine2D_F64)6 ModelManagerSe2_F64 (georegression.fitting.se.ModelManagerSe2_F64)3 PlanePtPixel (boofcv.struct.sfm.PlanePtPixel)2 Point2D_F64 (georegression.struct.point.Point2D_F64)2 Rectangle2D_I32 (georegression.struct.shapes.Rectangle2D_I32)2 Ransac (org.ddogleg.fitting.modelset.ransac.Ransac)2 PointTrack (boofcv.abst.feature.tracker.PointTrack)1 WrapImageMotionPtkSmartRespawn (boofcv.abst.sfm.d2.WrapImageMotionPtkSmartRespawn)1 SquareNode (boofcv.alg.fiducial.calib.squares.SquareNode)1 CameraPlaneProjection (boofcv.alg.sfm.overhead.CameraPlaneProjection)1 DistancePlane2DToPixelSq (boofcv.alg.sfm.robust.DistancePlane2DToPixelSq)1 GenerateSe2_PlanePtPixel (boofcv.alg.sfm.robust.GenerateSe2_PlanePtPixel)1 AssociatedPair (boofcv.struct.geo.AssociatedPair)1 GrayF32 (boofcv.struct.image.GrayF32)1 ModelManagerAffine2D_F64 (georegression.fitting.affine.ModelManagerAffine2D_F64)1 ModelManagerHomography2D_F64 (georegression.fitting.homography.ModelManagerHomography2D_F64)1 MotionSe2PointSVD_F64 (georegression.fitting.se.MotionSe2PointSVD_F64)1 Homography2D_F64 (georegression.struct.homography.Homography2D_F64)1