use of boofcv.struct.calib.CameraPinhole in project BoofCV by lessthanoptimal.
the class ImplPerspectiveOps_F32 method matrixToParam.
public static <C extends CameraPinhole> C matrixToParam(FMatrixRMaj K, int width, int height, C param) {
if (param == null)
param = (C) new CameraPinhole();
param.fx = K.get(0, 0);
param.fy = K.get(1, 1);
param.skew = K.get(0, 1);
param.cx = K.get(0, 2);
param.cy = K.get(1, 2);
param.width = width;
param.height = height;
return param;
}
use of boofcv.struct.calib.CameraPinhole in project BoofCV by lessthanoptimal.
the class PerspectiveOps method createIntrinsic.
/**
* Creates a set of intrinsic parameters, without distortion, for a camera with the specified characteristics
*
* @param width Image width
* @param height Image height
* @param hfov Horizontal FOV in degrees
* @param vfov Vertical FOV in degrees
* @return guess camera parameters
*/
public static CameraPinhole createIntrinsic(int width, int height, double hfov, double vfov) {
CameraPinhole intrinsic = new CameraPinhole();
intrinsic.width = width;
intrinsic.height = height;
intrinsic.cx = width / 2;
intrinsic.cy = height / 2;
intrinsic.fx = intrinsic.cx / Math.tan(UtilAngle.degreeToRadian(hfov / 2.0));
intrinsic.fy = intrinsic.cy / Math.tan(UtilAngle.degreeToRadian(vfov / 2.0));
return intrinsic;
}
use of boofcv.struct.calib.CameraPinhole in project BoofCV by lessthanoptimal.
the class TestPinholeToEquirectangular_F32 method setDirection.
/**
* Rotate the camera and see if the camera center is pointing in the right direction now
*/
@Test
public void setDirection() {
CameraPinhole intrinsic = new CameraPinhole(400, 400, 0, imgWidth / 2, imgHeight / 2, imgWidth, imgHeight);
PinholeToEquirectangular_F32 alg = new PinholeToEquirectangular_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.CameraPinhole in project BoofCV by lessthanoptimal.
the class TestPinholeToEquirectangular_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() {
CameraPinhole intrinsic = new CameraPinhole(400, 400, 0, imgWidth / 2, imgHeight / 2, imgWidth, imgHeight);
PinholeToEquirectangular_F32 alg = new PinholeToEquirectangular_F32();
alg.setPinhole(intrinsic);
alg.setEquirectangularShape(equiWidth, equiHeight);
assertPointing(alg, imgWidth / 2, imgHeight / 2, 0, 0, 1);
}
use of boofcv.struct.calib.CameraPinhole in project BoofCV by lessthanoptimal.
the class TestPinholeToEquirectangular_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() {
CameraPinhole intrinsic = new CameraPinhole(400, 400, 0, imgWidth / 2, imgHeight / 2, imgWidth, imgHeight);
PinholeToEquirectangular_F64 alg = new PinholeToEquirectangular_F64();
alg.setPinhole(intrinsic);
alg.setEquirectangularShape(equiWidth, equiHeight);
assertPointing(alg, imgWidth / 2, imgHeight / 2, 0, 0, 1);
}
Aggregations