Search in sources :

Example 61 with CameraPinholeBrown

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

the class TestBundlePinholeBrown method zeroTangential.

@Test
void zeroTangential() {
    CameraPinholeBrown cam = new CameraPinholeBrown(1);
    cam.fx = 300;
    cam.fy = 200;
    cam.cx = cam.cy = 400;
    cam.radial[0] = 0.02;
    // since t1 and t2 are zero it will automatically turn off tangential
    BundlePinholeBrown alg = BundleAdjustmentOps.convert(cam, (BundlePinholeBrown) null);
    double[][] parameters = new double[1][alg.getIntrinsicCount()];
    alg.getIntrinsic(parameters[0], 0);
    new GenericChecksBundleAdjustmentCamera(alg, 0.02) {
    }.setParameters(parameters).checkAll();
}
Also used : CameraPinholeBrown(boofcv.struct.calib.CameraPinholeBrown) Test(org.junit.jupiter.api.Test)

Example 62 with CameraPinholeBrown

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

the class TestPerspectiveOps method convertNormToPixel_intrinsic_F64.

@Test
void convertNormToPixel_intrinsic_F64() {
    CameraPinholeBrown intrinsic = new CameraPinholeBrown(100, 150, 0.1, 120, 209, 500, 600);
    DMatrixRMaj K = PerspectiveOps.pinholeToMatrix(intrinsic, (DMatrixRMaj) null);
    Point2D_F64 norm = new Point2D_F64(-0.1, 0.25);
    Point2D_F64 expected = new Point2D_F64();
    GeometryMath_F64.mult(K, norm, expected);
    Point2D_F64 found = PerspectiveOps.convertNormToPixel(intrinsic, norm.x, norm.y, null);
    assertEquals(expected.x, found.x, 1e-8);
    assertEquals(expected.y, found.y, 1e-8);
}
Also used : CameraPinholeBrown(boofcv.struct.calib.CameraPinholeBrown) DMatrixRMaj(org.ejml.data.DMatrixRMaj) Test(org.junit.jupiter.api.Test)

Example 63 with CameraPinholeBrown

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

the class TestPerspectiveOps method convertPixelToNorm_intrinsic_F64.

@Test
void convertPixelToNorm_intrinsic_F64() {
    CameraPinholeBrown intrinsic = new CameraPinholeBrown(100, 150, 0.1, 120, 209, 500, 600).fsetRadial(0.1, -0.05);
    Point2Transform2_F64 p2n = LensDistortionFactory.narrow(intrinsic).undistort_F64(true, false);
    Point2D_F64 pixel = new Point2D_F64(100, 120);
    Point2D_F64 expected = new Point2D_F64();
    p2n.compute(pixel.x, pixel.y, expected);
    Point2D_F64 found = PerspectiveOps.convertPixelToNorm(intrinsic, pixel, null);
    assertEquals(expected.x, found.x, UtilEjml.TEST_F64);
    assertEquals(expected.y, found.y, UtilEjml.TEST_F64);
}
Also used : CameraPinholeBrown(boofcv.struct.calib.CameraPinholeBrown) Point2Transform2_F64(boofcv.struct.distort.Point2Transform2_F64) Test(org.junit.jupiter.api.Test)

Example 64 with CameraPinholeBrown

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

the class TestPerspectiveOps method adjustIntrinsic.

@Test
void adjustIntrinsic() {
    DMatrixRMaj B = new DMatrixRMaj(3, 3, true, 2, 0, 1, 0, 3, 2, 0, 0, 1);
    CameraPinholeBrown param = new CameraPinholeBrown(200, 300, 2, 250, 260, 200, 300).fsetRadial(0.1, 0.3);
    CameraPinholeBrown found = PerspectiveOps.adjustIntrinsic(param, B, null);
    DMatrixRMaj A = PerspectiveOps.pinholeToMatrix(param, (DMatrixRMaj) null);
    DMatrixRMaj expected = new DMatrixRMaj(3, 3);
    CommonOps_DDRM.mult(B, A, expected);
    assertArrayEquals(param.radial, found.radial, 1e-8);
    DMatrixRMaj foundM = PerspectiveOps.pinholeToMatrix(found, (DMatrixRMaj) null);
    assertTrue(MatrixFeatures_DDRM.isIdentical(expected, foundM, 1e-8));
}
Also used : CameraPinholeBrown(boofcv.struct.calib.CameraPinholeBrown) DMatrixRMaj(org.ejml.data.DMatrixRMaj) Test(org.junit.jupiter.api.Test)

Example 65 with CameraPinholeBrown

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

the class TestBundleAdjustmentOps method convert_brown_to_bundleBrown.

@Test
void convert_brown_to_bundleBrown() {
    var src = new CameraPinholeBrown().fsetK(1, 2, 3, 4, 5, 6, 7).fsetRadial(-1, -2).fsetTangental(0.1, 0.2);
    var dst = new BundlePinholeBrown(true, false);
    assertSame(dst, BundleAdjustmentOps.convert(src, dst));
    assertFalse(dst.zeroSkew);
    assertTrue(dst.tangential);
    assertArrayEquals(src.radial, dst.radial);
    assertEquals(src.t1, dst.t1);
    assertEquals(src.t2, dst.t2);
    assertEquals(src.fx, dst.fx);
    assertEquals(src.fy, dst.fy);
    assertEquals(src.cx, dst.cx);
    assertEquals(src.cy, dst.cy);
    assertEquals(src.skew, dst.skew);
}
Also used : CameraPinholeBrown(boofcv.struct.calib.CameraPinholeBrown) BundlePinholeBrown(boofcv.alg.geo.bundle.cameras.BundlePinholeBrown) Test(org.junit.jupiter.api.Test)

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