use of boofcv.struct.calib.CameraPinholeRadial in project BoofCV by lessthanoptimal.
the class TestRectifyImageOps method transformPixelToRectNorm_F64.
/**
* Test by using other tested functions, then manually applying the last step
*/
@Test
public void transformPixelToRectNorm_F64() {
CameraPinholeRadial param = new CameraPinholeRadial().fsetK(300, 320, 0, 150, 130, width, height).fsetRadial(0.1, 1e-4);
DMatrixRMaj rect = new DMatrixRMaj(3, 3, true, 1.1, 0, 0, 0, 2, 0, 0.1, 0, 3);
DMatrixRMaj rectK = PerspectiveOps.calibrationMatrix(param, (DMatrixRMaj) null);
DMatrixRMaj rectK_inv = new DMatrixRMaj(3, 3);
CommonOps_DDRM.invert(rectK, rectK_inv);
Point2Transform2_F64 tranRect = RectifyImageOps.transformPixelToRect(param, rect);
Point2Transform2_F64 alg = RectifyImageOps.transformPixelToRectNorm(param, rect, rectK);
double x = 10, y = 20;
// compute expected results
Point2D_F64 rectified = new Point2D_F64();
tranRect.compute(x, y, rectified);
Point2D_F64 expected = new Point2D_F64();
GeometryMath_F64.mult(rectK_inv, new Point2D_F64(rectified.x, rectified.y), expected);
// compute the 'found' results
Point2D_F64 found = new Point2D_F64();
alg.compute(x, y, found);
assertEquals(expected.x, found.x, 1e-4);
assertEquals(expected.y, found.y, 1e-4);
}
use of boofcv.struct.calib.CameraPinholeRadial in project BoofCV by lessthanoptimal.
the class TestPinholeRadialToEquirectangular_F32 method setDirection.
/**
* Rotate the camera and see if the camera center is pointing in the right direction now
*/
@Test
public void setDirection() {
CameraPinholeRadial intrinsic = new CameraPinholeRadial(400, 400, 0, imgWidth / 2, imgHeight / 2, imgWidth, imgHeight);
intrinsic.setRadial(0.1f, 0.2f);
PinholeRadialToEquirectangular_F32 alg = new PinholeRadialToEquirectangular_F32();
alg.setPinhole(intrinsic);
alg.setEquirectangularShape(equiWidth, equiHeight);
alg.setDirection(0, (float) Math.PI / 2, 0);
assertPointing(alg, imgWidth / 2, imgHeight / 2, 1, 0, 0);
}
use of boofcv.struct.calib.CameraPinholeRadial in project BoofCV by lessthanoptimal.
the class TestPinholeRadialToEquirectangular_F32 method canonicalIsPointedPositiveZ.
/**
* Makes sure the canonical orientation is pointed along the positive z axis. This is done by projecting
* the center of the pinhole at default orientation.
*/
@Test
public void canonicalIsPointedPositiveZ() {
CameraPinholeRadial intrinsic = new CameraPinholeRadial(400, 400, 0, imgWidth / 2, imgHeight / 2, imgWidth, imgHeight);
intrinsic.setRadial(0.1f, 0.2f);
PinholeRadialToEquirectangular_F32 alg = new PinholeRadialToEquirectangular_F32();
alg.setPinhole(intrinsic);
alg.setEquirectangularShape(equiWidth, equiHeight);
assertPointing(alg, imgWidth / 2, imgHeight / 2, 0, 0, 1);
}
use of boofcv.struct.calib.CameraPinholeRadial in project BoofCV by lessthanoptimal.
the class TestPinholeRadialToEquirectangular_F64 method canonicalIsPointedPositiveZ.
/**
* Makes sure the canonical orientation is pointed along the positive z axis. This is done by projecting
* the center of the pinhole at default orientation.
*/
@Test
public void canonicalIsPointedPositiveZ() {
CameraPinholeRadial intrinsic = new CameraPinholeRadial(400, 400, 0, imgWidth / 2, imgHeight / 2, imgWidth, imgHeight);
intrinsic.setRadial(0.1, 0.2);
PinholeRadialToEquirectangular_F64 alg = new PinholeRadialToEquirectangular_F64();
alg.setPinhole(intrinsic);
alg.setEquirectangularShape(equiWidth, equiHeight);
assertPointing(alg, imgWidth / 2, imgHeight / 2, 0, 0, 1);
}
use of boofcv.struct.calib.CameraPinholeRadial in project BoofCV by lessthanoptimal.
the class TestPinholeRadialToEquirectangular_F64 method setDirection.
/**
* Rotate the camera and see if the camera center is pointing in the right direction now
*/
@Test
public void setDirection() {
CameraPinholeRadial intrinsic = new CameraPinholeRadial(400, 400, 0, imgWidth / 2, imgHeight / 2, imgWidth, imgHeight);
intrinsic.setRadial(0.1, 0.2);
PinholeRadialToEquirectangular_F64 alg = new PinholeRadialToEquirectangular_F64();
alg.setPinhole(intrinsic);
alg.setEquirectangularShape(equiWidth, equiHeight);
alg.setDirection(0, Math.PI / 2, 0);
assertPointing(alg, imgWidth / 2, imgHeight / 2, 1, 0, 0);
}
Aggregations