Search in sources :

Example 76 with CameraPinhole

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;
}
Also used : CameraPinhole(boofcv.struct.calib.CameraPinhole)

Example 77 with CameraPinhole

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;
}
Also used : CameraPinhole(boofcv.struct.calib.CameraPinhole)

Example 78 with CameraPinhole

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);
}
Also used : CameraPinhole(boofcv.struct.calib.CameraPinhole) Test(org.junit.Test)

Example 79 with CameraPinhole

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);
}
Also used : CameraPinhole(boofcv.struct.calib.CameraPinhole) Test(org.junit.Test)

Example 80 with CameraPinhole

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);
}
Also used : CameraPinhole(boofcv.struct.calib.CameraPinhole) Test(org.junit.Test)

Aggregations

CameraPinhole (boofcv.struct.calib.CameraPinhole)154 Test (org.junit.jupiter.api.Test)81 Se3_F64 (georegression.struct.se.Se3_F64)36 DMatrixRMaj (org.ejml.data.DMatrixRMaj)32 Point2D_F64 (georegression.struct.point.Point2D_F64)24 ArrayList (java.util.ArrayList)23 Point3D_F64 (georegression.struct.point.Point3D_F64)19 Homography2D_F64 (georegression.struct.homography.Homography2D_F64)12 SceneStructureMetric (boofcv.abst.geo.bundle.SceneStructureMetric)11 CameraPinholeBrown (boofcv.struct.calib.CameraPinholeBrown)11 Test (org.junit.Test)10 GrayF32 (boofcv.struct.image.GrayF32)9 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)8 Point2Transform2_F32 (boofcv.struct.distort.Point2Transform2_F32)8 BufferedImage (java.awt.image.BufferedImage)8 Point2Transform2_F64 (boofcv.struct.distort.Point2Transform2_F64)7 VerbosePrint (org.ddogleg.struct.VerbosePrint)7 LensDistortionPinhole (boofcv.alg.distort.pinhole.LensDistortionPinhole)6 WorldToCameraToPixel (boofcv.alg.geo.WorldToCameraToPixel)6 CameraPinholeRadial (boofcv.struct.calib.CameraPinholeRadial)5