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();
}
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);
}
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);
}
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));
}
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);
}
Aggregations