Search in sources :

Example 11 with CameraPinholeBrown

use of boofcv.struct.calib.CameraPinholeBrown 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().setTo(-0.2, 0.001, -0.012);
    ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0.001, -0.01, 0.0023, ret.getRightToLeft().getR());
    ret.left = new CameraPinholeBrown(200, 201, 0, width / 2, height / 2, width, height).fsetRadial(0, 0);
    ret.right = new CameraPinholeBrown(199, 200, 0, width / 2 + 2, height / 2 - 6, width, height).fsetRadial(0, 0);
    return ret;
}
Also used : CameraPinholeBrown(boofcv.struct.calib.CameraPinholeBrown) StereoParameters(boofcv.struct.calib.StereoParameters) Se3_F64(georegression.struct.se.Se3_F64)

Example 12 with CameraPinholeBrown

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

the class TestAssociateStereo2D method setup.

@BeforeEach
public void setup() {
    leftToRight = new Se3_F64();
    ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0.01, -0.001, 0.005, leftToRight.getR());
    leftToRight.getT().setTo(-0.1, 0, 0);
    param = new StereoParameters();
    param.right_to_left = leftToRight.invert(null);
    param.left = new CameraPinholeBrown(400, 500, 0.1, 160, 120, 320, 240).fsetRadial(0, 0);
    param.right = new CameraPinholeBrown(380, 505, 0.05, 165, 115, 320, 240).fsetRadial(0, 0);
    descLeft = new DogArray<>(() -> new TupleDesc_F64(10));
    descRight = new DogArray<>(() -> new TupleDesc_F64(10));
    pointsLeft.reset();
    pointsRight.reset();
}
Also used : CameraPinholeBrown(boofcv.struct.calib.CameraPinholeBrown) TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) StereoParameters(boofcv.struct.calib.StereoParameters) Se3_F64(georegression.struct.se.Se3_F64) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 13 with CameraPinholeBrown

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

the class TestStereoConsistencyCheck method checkRectification.

@Test
void checkRectification() {
    Se3_F64 leftToRight = new Se3_F64();
    ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0.01, -0.001, 0.005, leftToRight.getR());
    leftToRight.getT().setTo(-0.1, 0, 0);
    StereoParameters param = new StereoParameters();
    param.right_to_left = leftToRight.invert(null);
    param.left = new CameraPinholeBrown(400, 500, 0.1, 160, 120, 320, 240).fsetRadial(0, 0);
    param.right = new CameraPinholeBrown(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) CameraPinholeBrown(boofcv.struct.calib.CameraPinholeBrown) Point2D_F64(georegression.struct.point.Point2D_F64) StereoParameters(boofcv.struct.calib.StereoParameters) Se3_F64(georegression.struct.se.Se3_F64) Test(org.junit.jupiter.api.Test)

Example 14 with CameraPinholeBrown

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

the class TestMonocularPlaneVisualOdometryScaleInput method setCalibration.

@Test
void setCalibration() {
    param = null;
    CameraPinholeBrown 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) CameraPinholeBrown(boofcv.struct.calib.CameraPinholeBrown) MonoPlaneParameters(boofcv.struct.calib.MonoPlaneParameters) Se3_F64(georegression.struct.se.Se3_F64) Test(org.junit.jupiter.api.Test)

Example 15 with CameraPinholeBrown

use of boofcv.struct.calib.CameraPinholeBrown 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().setTo(-0.2, 0.001, -0.012);
    ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0.001, -0.01, 0.0023, ret.getRightToLeft().getR());
    ret.left = new CameraPinholeBrown(200, 201, 0, width / 2, height / 2, width, height).fsetRadial(0, 0);
    ret.right = new CameraPinholeBrown(199, 200, 0, width / 2 + 2, height / 2 - 6, width, height).fsetRadial(0, 0);
    return ret;
}
Also used : CameraPinholeBrown(boofcv.struct.calib.CameraPinholeBrown) StereoParameters(boofcv.struct.calib.StereoParameters) Se3_F64(georegression.struct.se.Se3_F64)

Aggregations

CameraPinholeBrown (boofcv.struct.calib.CameraPinholeBrown)99 Test (org.junit.jupiter.api.Test)62 Se3_F64 (georegression.struct.se.Se3_F64)39 GrayF32 (boofcv.struct.image.GrayF32)29 Point2D_F64 (georegression.struct.point.Point2D_F64)19 SimulatePlanarWorld (boofcv.simulation.SimulatePlanarWorld)16 LensDistortionBrown (boofcv.alg.distort.brown.LensDistortionBrown)14 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)14 BufferedImage (java.awt.image.BufferedImage)14 ArrayList (java.util.ArrayList)12 CameraPinhole (boofcv.struct.calib.CameraPinhole)11 Point2Transform2_F64 (boofcv.struct.distort.Point2Transform2_F64)10 DMatrixRMaj (org.ejml.data.DMatrixRMaj)10 File (java.io.File)9 StereoParameters (boofcv.struct.calib.StereoParameters)6 GrayU8 (boofcv.struct.image.GrayU8)6 Point3D_F64 (georegression.struct.point.Point3D_F64)6 ImageBase (boofcv.struct.image.ImageBase)5 ImageType (boofcv.struct.image.ImageType)5 DogArray (org.ddogleg.struct.DogArray)5