Search in sources :

Example 11 with CameraPinholeRadial

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

the class TestRectifyImageOps method allInsideLeft_calibrated.

@Test
public void allInsideLeft_calibrated() {
    CameraPinholeRadial param = new CameraPinholeRadial().fsetK(300, 320, 0, 150, 130, width, height).fsetRadial(0.1, 1e-4);
    // do nothing rectification
    FMatrixRMaj rect1 = CommonOps_FDRM.identity(3);
    FMatrixRMaj rect2 = CommonOps_FDRM.identity(3);
    FMatrixRMaj rectK = PerspectiveOps.calibrationMatrix(param, (FMatrixRMaj) null);
    RectifyImageOps.allInsideLeft(param, rect1, rect2, rectK);
    // check left image
    Point2Transform2_F32 tran = RectifyImageOps.transformRectToPixel(param, rect1);
    checkInside(tran);
// the right view is not checked since it is not part of the contract
}
Also used : FMatrixRMaj(org.ejml.data.FMatrixRMaj) CameraPinholeRadial(boofcv.struct.calib.CameraPinholeRadial) Point2Transform2_F32(boofcv.struct.distort.Point2Transform2_F32) Test(org.junit.Test)

Example 12 with CameraPinholeRadial

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

the class TestPinholeNtoP_F64 method basicTest.

@Test
public void basicTest() {
    CameraPinholeRadial p = new CameraPinholeRadial().fsetK(1, 2, 3, 4, 5, 200, 300);
    DMatrixRMaj K = PerspectiveOps.calibrationMatrix(p, (DMatrixRMaj) null);
    Point2D_F64 pixel = new Point2D_F64(150, 200);
    Point2D_F64 expected = new Point2D_F64();
    Point2D_F64 found = new Point2D_F64();
    GeometryMath_F64.mult(K, pixel, expected);
    PinholeNtoP_F64 alg = new PinholeNtoP_F64();
    alg.set(p.fx, p.fy, p.skew, p.cx, p.cy);
    alg.compute(pixel.x, pixel.y, found);
    assertEquals(expected.x, found.x, 1e-8);
    assertEquals(expected.y, found.y, 1e-8);
}
Also used : CameraPinholeRadial(boofcv.struct.calib.CameraPinholeRadial) Point2D_F64(georegression.struct.point.Point2D_F64) DMatrixRMaj(org.ejml.data.DMatrixRMaj) Test(org.junit.Test)

Example 13 with CameraPinholeRadial

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

the class WrapVisOdomDualTrackPnP method setCalibration.

@Override
public void setCalibration(StereoParameters parameters) {
    Se3_F64 leftToRight = parameters.getRightToLeft().invert(null);
    pnp.setLeftToRight(leftToRight);
    if (refine != null)
        refine.setLeftToRight(leftToRight);
    alg.setCalibration(parameters);
    CameraPinholeRadial left = parameters.left;
    distanceMono.setIntrinsic(left.fx, left.fy, left.skew);
    distanceStereo.setStereoParameters(parameters);
    assoc.setCalibration(parameters);
}
Also used : CameraPinholeRadial(boofcv.struct.calib.CameraPinholeRadial) Se3_F64(georegression.struct.se.Se3_F64)

Example 14 with CameraPinholeRadial

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

the class WrapVisOdomQuadPnP method setCalibration.

@Override
public void setCalibration(StereoParameters parameters) {
    Se3_F64 leftToRight = parameters.getRightToLeft().invert(null);
    alg.setCalibration(parameters);
    associateStereo.setCalibration(parameters);
    distance.setStereoParameters(parameters);
    CameraPinholeRadial left = parameters.left;
    distanceMono.setIntrinsic(left.fx, left.fy, left.skew);
    if (refine != null)
        refine.setLeftToRight(leftToRight);
}
Also used : CameraPinholeRadial(boofcv.struct.calib.CameraPinholeRadial) Se3_F64(georegression.struct.se.Se3_F64)

Example 15 with CameraPinholeRadial

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

the class PnPStereoDistanceReprojectionSq method setStereoParameters.

public void setStereoParameters(StereoParameters param) {
    this.leftToRight = param.getRightToLeft().invert(null);
    CameraPinholeRadial left = param.left;
    CameraPinholeRadial right = param.right;
    leftPixelError = new NormalizedToPixelError(left.fx, left.fy, left.skew);
    rightPixelError = new NormalizedToPixelError(right.fx, right.fy, right.skew);
}
Also used : CameraPinholeRadial(boofcv.struct.calib.CameraPinholeRadial) NormalizedToPixelError(boofcv.alg.geo.NormalizedToPixelError)

Aggregations

CameraPinholeRadial (boofcv.struct.calib.CameraPinholeRadial)81 Test (org.junit.Test)37 Se3_F64 (georegression.struct.se.Se3_F64)26 GrayF32 (boofcv.struct.image.GrayF32)19 Point2D_F64 (georegression.struct.point.Point2D_F64)16 File (java.io.File)15 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)12 BufferedImage (java.awt.image.BufferedImage)12 DMatrixRMaj (org.ejml.data.DMatrixRMaj)12 Point2Transform2_F32 (boofcv.struct.distort.Point2Transform2_F32)10 LensDistortionRadialTangential (boofcv.alg.distort.radtan.LensDistortionRadialTangential)9 CameraPinhole (boofcv.struct.calib.CameraPinhole)9 Point3D_F64 (georegression.struct.point.Point3D_F64)8 ArrayList (java.util.ArrayList)7 SimulatePlanarWorld (boofcv.simulation.SimulatePlanarWorld)6 StereoParameters (boofcv.struct.calib.StereoParameters)6 Point2Transform2_F64 (boofcv.struct.distort.Point2Transform2_F64)6 Point2D_F32 (georegression.struct.point.Point2D_F32)5 FMatrixRMaj (org.ejml.data.FMatrixRMaj)5 GrayU8 (boofcv.struct.image.GrayU8)4