Search in sources :

Example 21 with CameraPinholeRadial

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

the class GenericQrCodeDetectorChecks method skewed.

/**
 * The marker is at a skewed angle and rotating
 */
@Test
public void skewed() {
    QrCodeDetector<GrayF32> detector = createDetector();
    CameraPinholeRadial model = CalibrationIO.load(getClass().getResource("calib/pinhole_radial.yaml"));
    SimulatePlanarWorld simulator = new SimulatePlanarWorld();
    simulator.setCamera(model);
    simulator.resetScene();
    Se3_F64 markerToWorld = new Se3_F64();
    simulator.addTarget(markerToWorld, simulatedTargetWidth, generateMarker());
    markerToWorld.T.set(0, 0, 0.5);
    for (int i = 0; i < 30; i++) {
        double roll = 2 * Math.PI * i / 30.0;
        double pitch = Math.PI * 0.3;
        ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, pitch, 0, roll, markerToWorld.R);
        renderAndCheck(detector, simulator);
    }
}
Also used : SimulatePlanarWorld(boofcv.simulation.SimulatePlanarWorld) GrayF32(boofcv.struct.image.GrayF32) CameraPinholeRadial(boofcv.struct.calib.CameraPinholeRadial) Se3_F64(georegression.struct.se.Se3_F64) Test(org.junit.Test)

Example 22 with CameraPinholeRadial

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

the class TestCalibrationFiducialDetector method loadDistortion.

@Override
public LensDistortionNarrowFOV loadDistortion(boolean distorted) {
    CameraPinholeRadial model = CalibrationIO.load(new File(directory, "intrinsic.yaml"));
    if (!distorted) {
        model.radial = null;
        model.t1 = model.t2 = 0;
    }
    return new LensDistortionRadialTangential(model);
}
Also used : LensDistortionRadialTangential(boofcv.alg.distort.radtan.LensDistortionRadialTangential) CameraPinholeRadial(boofcv.struct.calib.CameraPinholeRadial) File(java.io.File)

Example 23 with CameraPinholeRadial

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

the class TestSquareBinary_to_FiducialDetector method loadDistortion.

@Override
public LensDistortionNarrowFOV loadDistortion(boolean distorted) {
    CameraPinholeRadial model = CalibrationIO.load(getClass().getResource("intrinsic_binary.yaml"));
    if (!distorted) {
        model.radial = null;
        model.t1 = model.t2 = 0;
    }
    return new LensDistortionRadialTangential(model);
}
Also used : LensDistortionRadialTangential(boofcv.alg.distort.radtan.LensDistortionRadialTangential) CameraPinholeRadial(boofcv.struct.calib.CameraPinholeRadial)

Example 24 with CameraPinholeRadial

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

the class TestSquareImage_to_FiducialDetector method loadDistortion.

@Override
public LensDistortionNarrowFOV loadDistortion(boolean distorted) {
    CameraPinholeRadial model = CalibrationIO.load(getClass().getResource("intrinsic_image.yaml"));
    if (!distorted) {
        model.radial = null;
        model.t1 = model.t2 = 0;
    }
    return new LensDistortionRadialTangential(model);
}
Also used : LensDistortionRadialTangential(boofcv.alg.distort.radtan.LensDistortionRadialTangential) CameraPinholeRadial(boofcv.struct.calib.CameraPinholeRadial)

Example 25 with CameraPinholeRadial

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

the class GenericPlanarCalibrationDetectorChecks method pinhole_radial_fullview.

/**
 * Simulated scene using a pinhole camera model with radial distortion. Entire target is visible
 */
@Test
public void pinhole_radial_fullview() {
    CameraPinholeRadial model = CalibrationIO.load(getClass().getResource("pinhole_radial.yaml"));
    SimulatePlanarWorld simulator = new SimulatePlanarWorld();
    simulator.setCamera(model);
    List<Point2D_F64> locations2D = new ArrayList<>();
    GrayF32 pattern = new GrayF32(1, 1);
    for (int i = 0; i < targetConfigs.size(); i++) {
        // System.out.println("*---------- Configuration "+i);
        failedToDetect = 0;
        DetectorFiducialCalibration detector = createDetector(targetConfigs.get(i));
        renderTarget(targetConfigs.get(i), simulatedTargetWidth, pattern, locations2D);
        simulator.resetScene();
        Se3_F64 markerToWorld = new Se3_F64();
        simulator.addTarget(markerToWorld, simulatedTargetWidth, pattern);
        // up close exploding - center
        markerToWorld.T.set(0, 0, 0.5);
        checkRenderedResults(detector, simulator, locations2D);
        // farther away centered
        markerToWorld.T.set(0, 0, 1);
        checkRenderedResults(detector, simulator, locations2D);
        markerToWorld.T.set(-0.33, 0, 1);
        checkRenderedResults(detector, simulator, locations2D);
        ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0, -1, 0, markerToWorld.getR());
        checkRenderedResults(detector, simulator, locations2D);
        ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0, -1, 0.8, markerToWorld.getR());
        checkRenderedResults(detector, simulator, locations2D);
        markerToWorld.T.set(-0.33, 0.33, 1);
        ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0, -1, 0.8, markerToWorld.getR());
        checkRenderedResults(detector, simulator, locations2D);
        markerToWorld.T.set(0, -0.20, 1);
        ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0.8, -1, 0.8, markerToWorld.getR());
        checkRenderedResults(detector, simulator, locations2D);
        ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0.8, -1, 1.8, markerToWorld.getR());
        checkRenderedResults(detector, simulator, locations2D);
        markerToWorld.T.set(0, -0.15, 1);
        ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0.2, -1, 2.4, markerToWorld.getR());
        checkRenderedResults(detector, simulator, locations2D);
    }
    assertEquals(0, failedToDetect);
}
Also used : SimulatePlanarWorld(boofcv.simulation.SimulatePlanarWorld) DetectorFiducialCalibration(boofcv.abst.geo.calibration.DetectorFiducialCalibration) GrayF32(boofcv.struct.image.GrayF32) CameraPinholeRadial(boofcv.struct.calib.CameraPinholeRadial) Point2D_F64(georegression.struct.point.Point2D_F64) ArrayList(java.util.ArrayList) Se3_F64(georegression.struct.se.Se3_F64) Test(org.junit.Test)

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