Search in sources :

Example 91 with CameraPinholeBrown

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

the class GenericFiducialDetectorChecks method modifyInput.

/**
 * Makes sure the input is not modified
 */
@Test
void modifyInput() {
    CameraPinholeBrown intrinsic = loadDistortion(true);
    LensDistortionBrown lensDistorted = new LensDistortionBrown(intrinsic);
    for (ImageType type : types) {
        ImageBase image = renderImage(intrinsic, type);
        ImageBase orig = image.clone();
        FiducialDetector detector = createDetector(type);
        detector.setLensDistortion(lensDistorted, image.width, image.height);
        detect(detector, image);
        BoofTesting.assertEquals(image, orig, 0);
    }
}
Also used : CameraPinholeBrown(boofcv.struct.calib.CameraPinholeBrown) LensDistortionBrown(boofcv.alg.distort.brown.LensDistortionBrown) ImageBase(boofcv.struct.image.ImageBase) ImageType(boofcv.struct.image.ImageType) Test(org.junit.jupiter.api.Test)

Example 92 with CameraPinholeBrown

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

the class GenericMicroQrCodeDetectorChecks method skewed.

/**
 * The marker is at a skewed angle and rotating
 */
@Test
void skewed() {
    MicroQrCodeDetector<GrayF32> detector = createDetector();
    CameraPinholeBrown model = CalibrationIO.load(getClass().getResource("calib/pinhole_radial.yaml"));
    var simulator = new SimulatePlanarWorld();
    simulator.setCamera(model);
    simulator.resetScene();
    Se3_F64 markerToWorld = new Se3_F64();
    simulator.addSurface(markerToWorld, simulatedTargetWidth, generateMarker());
    markerToWorld.T.setTo(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, Math.PI, roll, markerToWorld.R);
        renderAndCheck(detector, simulator);
    }
}
Also used : SimulatePlanarWorld(boofcv.simulation.SimulatePlanarWorld) GrayF32(boofcv.struct.image.GrayF32) CameraPinholeBrown(boofcv.struct.calib.CameraPinholeBrown) Se3_F64(georegression.struct.se.Se3_F64) Test(org.junit.jupiter.api.Test)

Example 93 with CameraPinholeBrown

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

the class GenericMicroQrCodeDetectorChecks method scale.

/**
 * The marker zooming in and out of the frame
 */
@Test
void scale() {
    MicroQrCodeDetector<GrayF32> detector = createDetector();
    CameraPinholeBrown model = CalibrationIO.load(getClass().getResource("calib/pinhole_radial.yaml"));
    var simulator = new SimulatePlanarWorld();
    simulator.setCamera(model);
    simulator.resetScene();
    Se3_F64 markerToWorld = new Se3_F64();
    simulator.addSurface(markerToWorld, simulatedTargetWidth, generateMarker());
    ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0, Math.PI, 0, markerToWorld.R);
    markerToWorld.T.setTo(0, 0, 0.4);
    for (int i = 0; i < 30; i++) {
        renderAndCheck(detector, simulator);
        markerToWorld.T.z += 0.03;
    }
}
Also used : SimulatePlanarWorld(boofcv.simulation.SimulatePlanarWorld) GrayF32(boofcv.struct.image.GrayF32) CameraPinholeBrown(boofcv.struct.calib.CameraPinholeBrown) Se3_F64(georegression.struct.se.Se3_F64) Test(org.junit.jupiter.api.Test)

Example 94 with CameraPinholeBrown

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

the class GenericMicroQrCodeDetectorChecks method multipleMarkers.

/**
 * See if it can detect multiple fiducials in the image at the same time
 */
@Test
void multipleMarkers() {
    MicroQrCodeDetector<GrayF32> detector = createDetector();
    CameraPinholeBrown model = CalibrationIO.load(getClass().getResource("calib/pinhole_radial.yaml"));
    var simulator = new SimulatePlanarWorld();
    simulator.setCamera(model);
    simulator.resetScene();
    var markerToWorld0 = new Se3_F64();
    var markerToWorld1 = new Se3_F64();
    simulator.addSurface(markerToWorld0, simulatedTargetWidth, generateMarker());
    simulator.addSurface(markerToWorld1, simulatedTargetWidth, generateMarker());
    ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0, Math.PI, 0, markerToWorld0.R);
    markerToWorld0.T.setTo(0.2, 0, 0.6);
    ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0, Math.PI, 0, markerToWorld1.R);
    markerToWorld1.T.setTo(-0.2, 0, 0.6);
    simulator.render();
    detector.process(simulator.getOutput());
    if (display) {
        ShowImages.showWindow(simulator.getOutput(), ShowImages.Colorization.MAGNITUDE, "Foo", true);
        BoofMiscOps.sleep(10000);
    }
    List<MicroQrCode> detections = detector.getDetections();
    assertEquals(2, detections.size());
}
Also used : SimulatePlanarWorld(boofcv.simulation.SimulatePlanarWorld) GrayF32(boofcv.struct.image.GrayF32) CameraPinholeBrown(boofcv.struct.calib.CameraPinholeBrown) MicroQrCode(boofcv.alg.fiducial.microqr.MicroQrCode) Se3_F64(georegression.struct.se.Se3_F64) Test(org.junit.jupiter.api.Test)

Example 95 with CameraPinholeBrown

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

the class GenericMicroQrCodeDetectorChecks method rotation.

/**
 * See if a clear well defined qr code can be detected while rating
 */
@Test
void rotation() {
    MicroQrCodeDetector<GrayF32> detector = createDetector();
    CameraPinholeBrown 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.addSurface(markerToWorld, simulatedTargetWidth, generateMarker());
    markerToWorld.T.setTo(0, 0, 0.5);
    for (int i = 0; i < 30; i++) {
        double roll = 2 * Math.PI * i / 30.0;
        ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0, Math.PI, roll, markerToWorld.R);
        renderAndCheck(detector, simulator);
    }
}
Also used : SimulatePlanarWorld(boofcv.simulation.SimulatePlanarWorld) GrayF32(boofcv.struct.image.GrayF32) CameraPinholeBrown(boofcv.struct.calib.CameraPinholeBrown) Se3_F64(georegression.struct.se.Se3_F64) 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