Search in sources :

Example 26 with CameraPinholeBrown

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

the class CalibrateStereoPlanar method calibrateMono.

/**
 * Compute intrinsic calibration for one of the cameras
 */
private CameraPinholeBrown calibrateMono(CalibrateMonoPlanar calib, List<Se3_F64> location) {
    calib.setVerbose(verbose, null);
    CameraPinholeBrown intrinsic = calib.process();
    SceneStructureMetric structure = calib.getStructure();
    for (int i = 0; i < structure.motions.size; i++) {
        location.add(structure.motions.data[i].motion);
    }
    return intrinsic;
}
Also used : SceneStructureMetric(boofcv.abst.geo.bundle.SceneStructureMetric) CodecSceneStructureMetric(boofcv.alg.geo.bundle.CodecSceneStructureMetric) CameraPinholeBrown(boofcv.struct.calib.CameraPinholeBrown) VerbosePrint(org.ddogleg.struct.VerbosePrint)

Example 27 with CameraPinholeBrown

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

the class CalibrateStereoPlanar method process.

/**
 * Compute stereo calibration parameters
 *
 * @return Stereo calibration parameters
 */
public StereoParameters process() {
    // calibrate left and right cameras
    if (verbose != null)
        verbose.println("Mono Left");
    CameraPinholeBrown leftParam = calibrateMono(calibLeft, viewLeft);
    if (verbose != null)
        verbose.println("Mono right");
    CameraPinholeBrown rightParam = calibrateMono(calibRight, viewRight);
    // fit motion from right to left
    Se3_F64 rightToLeft = computeRightToLeft();
    var results = new StereoParameters(leftParam, rightParam, rightToLeft);
    refineAll(results);
    return results;
}
Also used : CameraPinholeBrown(boofcv.struct.calib.CameraPinholeBrown) StereoParameters(boofcv.struct.calib.StereoParameters) Se3_F64(georegression.struct.se.Se3_F64)

Example 28 with CameraPinholeBrown

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

the class TestCameraToEquirectangular_F64 method copy.

@Test
void copy() {
    CameraPinholeBrown intrinsic = new CameraPinholeBrown(400, 400, 0, imgWidth / 2, imgHeight / 2, imgWidth, imgHeight);
    intrinsic.setRadial(0.1, 0.2);
    CameraToEquirectangular_F64 origin = new CameraToEquirectangular_F64();
    origin.setCameraModel(intrinsic);
    copy(origin, equiWidth, equiHeight);
}
Also used : CameraPinholeBrown(boofcv.struct.calib.CameraPinholeBrown) Test(org.junit.jupiter.api.Test)

Example 29 with CameraPinholeBrown

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

the class TestCameraToEquirectangular_F64 method setDirection.

/**
 * Rotate the camera and see if the camera center is pointing in the right direction now
 */
@Test
void setDirection() {
    CameraPinholeBrown intrinsic = new CameraPinholeBrown(400, 400, 0, imgWidth / 2, imgHeight / 2, imgWidth, imgHeight);
    intrinsic.setRadial(0.1, 0.2);
    CameraToEquirectangular_F64 alg = new CameraToEquirectangular_F64();
    alg.setCameraModel(intrinsic);
    alg.setEquirectangularShape(equiWidth, equiHeight);
    alg.setDirection(0, Math.PI / 2, 0);
    assertPointing(alg, imgWidth / 2, imgHeight / 2, 1, 0, 0);
}
Also used : CameraPinholeBrown(boofcv.struct.calib.CameraPinholeBrown) Test(org.junit.jupiter.api.Test)

Example 30 with CameraPinholeBrown

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

the class TestLensDistortionOps_F64 method transformChangeModel_EXPAND.

/**
 * Checks the border of the returned transform. Makes sure that no none-visible portion is visible.
 * Also makes sure that the requested inverse transform is actually the inverse.
 */
@Test
void transformChangeModel_EXPAND() {
    CameraPinholeBrown param;
    param = new CameraPinholeBrown().fsetK(300, 320, 0, 150, 130, width, height).fsetRadial(0.1, 1e-4);
    CameraPinhole desired = new CameraPinhole(param);
    Point2Transform2_F64 adjToDist = LensDistortionOps_F64.transformChangeModel(AdjustmentType.EXPAND, param, desired, true, null);
    Point2Transform2_F64 distToAdj = LensDistortionOps_F64.transformChangeModel(AdjustmentType.EXPAND, param, desired, false, null);
    checkInside(adjToDist, distToAdj);
    // distort it in the other direction
    param = new CameraPinholeBrown().fsetK(300, 320, 0, 150, 130, width, height).fsetRadial(-0.1, -1e-4);
    adjToDist = LensDistortionOps_F64.transformChangeModel(AdjustmentType.EXPAND, param, desired, true, null);
    distToAdj = LensDistortionOps_F64.transformChangeModel(AdjustmentType.EXPAND, param, desired, false, null);
    checkInside(adjToDist, distToAdj);
}
Also used : CameraPinholeBrown(boofcv.struct.calib.CameraPinholeBrown) Point2Transform2_F64(boofcv.struct.distort.Point2Transform2_F64) CameraPinhole(boofcv.struct.calib.CameraPinhole) 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