Search in sources :

Example 31 with CameraPinholeRadial

use of boofcv.struct.calib.CameraPinholeRadial in project BoofCV by lessthanoptimal.

the class TestStereoConsistencyCheck method checkRectification.

@Test
public void checkRectification() {
    Se3_F64 leftToRight = new Se3_F64();
    ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0.01, -0.001, 0.005, leftToRight.getR());
    leftToRight.getT().set(-0.1, 0, 0);
    StereoParameters param = new StereoParameters();
    param.rightToLeft = leftToRight.invert(null);
    param.left = new CameraPinholeRadial(400, 500, 0.1, 160, 120, 320, 240).fsetRadial(0, 0);
    param.right = new CameraPinholeRadial(380, 505, 0.05, 165, 115, 320, 240).fsetRadial(0, 0);
    Point3D_F64 X = new Point3D_F64(0.02, -0.5, 3);
    Point2D_F64 leftP = new Point2D_F64();
    Point2D_F64 rightP = new Point2D_F64();
    SfmTestHelper.renderPointPixel(param, X, leftP, rightP);
    StereoConsistencyCheck alg = new StereoConsistencyCheck(1, 2);
    alg.setCalibration(param);
    alg.checkPixel(leftP, rightP);
    assertEquals(alg.rectLeft.y, alg.rectRight.y, 1e-5);
    assertTrue(alg.rectLeft.x > alg.rectRight.x);
}
Also used : Point3D_F64(georegression.struct.point.Point3D_F64) CameraPinholeRadial(boofcv.struct.calib.CameraPinholeRadial) Point2D_F64(georegression.struct.point.Point2D_F64) StereoParameters(boofcv.struct.calib.StereoParameters) Se3_F64(georegression.struct.se.Se3_F64) Test(org.junit.Test)

Example 32 with CameraPinholeRadial

use of boofcv.struct.calib.CameraPinholeRadial in project BoofCV by lessthanoptimal.

the class TestStereoProcessingBase method createStereoParam.

public static StereoParameters createStereoParam(int width, int height) {
    StereoParameters ret = new StereoParameters();
    ret.setRightToLeft(new Se3_F64());
    ret.getRightToLeft().getT().set(-0.2, 0.001, -0.012);
    ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0.001, -0.01, 0.0023, ret.getRightToLeft().getR());
    ret.left = new CameraPinholeRadial().fsetK(300, 320, 0, width / 2, height / 2, width, height).fsetRadial(0.1, 1e-4);
    ret.right = new CameraPinholeRadial().fsetK(290, 310, 0, width / 2 + 2, height / 2 - 6, width, height).fsetRadial(0.05, -2e-4);
    return ret;
}
Also used : CameraPinholeRadial(boofcv.struct.calib.CameraPinholeRadial) StereoParameters(boofcv.struct.calib.StereoParameters) Se3_F64(georegression.struct.se.Se3_F64)

Example 33 with CameraPinholeRadial

use of boofcv.struct.calib.CameraPinholeRadial in project BoofCV by lessthanoptimal.

the class CheckVisualOdometryStereoSim method createStereoParam.

public StereoParameters createStereoParam() {
    StereoParameters ret = new StereoParameters();
    ret.setRightToLeft(new Se3_F64());
    ret.getRightToLeft().getT().set(-0.2, 0.001, -0.012);
    ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0.001, -0.01, 0.0023, ret.getRightToLeft().getR());
    ret.left = new CameraPinholeRadial(200, 201, 0, width / 2, height / 2, width, height).fsetRadial(0, 0);
    ret.right = new CameraPinholeRadial(199, 200, 0, width / 2 + 2, height / 2 - 6, width, height).fsetRadial(0, 0);
    return ret;
}
Also used : CameraPinholeRadial(boofcv.struct.calib.CameraPinholeRadial) StereoParameters(boofcv.struct.calib.StereoParameters) Se3_F64(georegression.struct.se.Se3_F64)

Example 34 with CameraPinholeRadial

use of boofcv.struct.calib.CameraPinholeRadial in project BoofCV by lessthanoptimal.

the class TestMonocularPlaneVisualOdometryScaleInput method setCalibration.

@Test
public void setCalibration() {
    param = null;
    CameraPinholeRadial intrinsic = createIntrinsic();
    Se3_F64 extrinsic = new Se3_F64();
    extrinsic.T.x = 8;
    Dummy dummy = new Dummy();
    MonocularPlaneVisualOdometry<GrayF32> alg = new MonocularPlaneVisualOdometryScaleInput<>(dummy, 0.5);
    assertTrue(this.param == null);
    alg.setCalibration(new MonoPlaneParameters(intrinsic, extrinsic));
    assertEquals(320, this.param.intrinsic.width);
    assertEquals(160, this.param.intrinsic.height);
    assertTrue(this.param.planeToCamera.T.x == extrinsic.T.x);
}
Also used : GrayF32(boofcv.struct.image.GrayF32) CameraPinholeRadial(boofcv.struct.calib.CameraPinholeRadial) MonoPlaneParameters(boofcv.struct.calib.MonoPlaneParameters) Se3_F64(georegression.struct.se.Se3_F64) Test(org.junit.Test)

Example 35 with CameraPinholeRadial

use of boofcv.struct.calib.CameraPinholeRadial in project BoofCV by lessthanoptimal.

the class TestStereoVisualOdometryScaleInput method createStereoParam.

public StereoParameters createStereoParam() {
    StereoParameters ret = new StereoParameters();
    ret.setRightToLeft(new Se3_F64());
    ret.getRightToLeft().getT().set(-0.2, 0.001, -0.012);
    ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0.001, -0.01, 0.0023, ret.getRightToLeft().getR());
    ret.left = new CameraPinholeRadial(200, 201, 0, width / 2, height / 2, width, height).fsetRadial(0, 0);
    ret.right = new CameraPinholeRadial(199, 200, 0, width / 2 + 2, height / 2 - 6, width, height).fsetRadial(0, 0);
    return ret;
}
Also used : CameraPinholeRadial(boofcv.struct.calib.CameraPinholeRadial) StereoParameters(boofcv.struct.calib.StereoParameters) Se3_F64(georegression.struct.se.Se3_F64)

Aggregations

CameraPinholeRadial (boofcv.struct.calib.CameraPinholeRadial)81 Test (org.junit.Test)37 Se3_F64 (georegression.struct.se.Se3_F64)26 GrayF32 (boofcv.struct.image.GrayF32)19 Point2D_F64 (georegression.struct.point.Point2D_F64)16 File (java.io.File)15 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)12 BufferedImage (java.awt.image.BufferedImage)12 DMatrixRMaj (org.ejml.data.DMatrixRMaj)12 Point2Transform2_F32 (boofcv.struct.distort.Point2Transform2_F32)10 LensDistortionRadialTangential (boofcv.alg.distort.radtan.LensDistortionRadialTangential)9 CameraPinhole (boofcv.struct.calib.CameraPinhole)9 Point3D_F64 (georegression.struct.point.Point3D_F64)8 ArrayList (java.util.ArrayList)7 SimulatePlanarWorld (boofcv.simulation.SimulatePlanarWorld)6 StereoParameters (boofcv.struct.calib.StereoParameters)6 Point2Transform2_F64 (boofcv.struct.distort.Point2Transform2_F64)6 Point2D_F32 (georegression.struct.point.Point2D_F32)5 FMatrixRMaj (org.ejml.data.FMatrixRMaj)5 GrayU8 (boofcv.struct.image.GrayU8)4