Search in sources :

Example 6 with DetectSingleFiducialCalibration

use of boofcv.abst.geo.calibration.DetectSingleFiducialCalibration in project BoofCV by lessthanoptimal.

the class TestCreateCalibrationTarget method circle_regular.

@Test
void circle_regular() throws IOException {
    createDocument("-r 8 -c 6 -o target -t CIRCLE_GRID -u cm -w 2 -d 3 -p LETTER");
    BufferedImage image = loadPDF();
    GrayF32 gray = new GrayF32(image.getWidth(), image.getHeight());
    ConvertBufferedImage.convertFrom(image, gray);
    DetectSingleFiducialCalibration detector = FactoryFiducialCalibration.circleRegularGrid(null, new ConfigGridDimen(8, 6, 2, 3));
    assertTrue(detector.process(gray));
}
Also used : ConfigGridDimen(boofcv.abst.fiducial.calib.ConfigGridDimen) DetectSingleFiducialCalibration(boofcv.abst.geo.calibration.DetectSingleFiducialCalibration) GrayF32(boofcv.struct.image.GrayF32) BufferedImage(java.awt.image.BufferedImage) ConvertBufferedImage(boofcv.io.image.ConvertBufferedImage) Test(org.junit.jupiter.api.Test)

Example 7 with DetectSingleFiducialCalibration

use of boofcv.abst.geo.calibration.DetectSingleFiducialCalibration in project BoofCV by lessthanoptimal.

the class GenericDetectSingleFiducialCalibrationChecks method checkPointIndexIncreasingOrder.

/**
 * Observations points should always be in increasing order
 */
@Test
void checkPointIndexIncreasingOrder() {
    for (ConfigGridDimen layout : targetConfigs) {
        DetectSingleFiducialCalibration detector = createDetector(layout);
        GrayF32 original = renderEasy(layout, null);
        assertTrue(detector.process(original));
        CalibrationObservation found = detector.getDetectedPoints();
        assertEquals(detector.getLayout().size(), found.size());
        for (int i = 0; i < found.size(); i++) {
            assertEquals(i, found.get(i).index);
        }
    }
}
Also used : DetectSingleFiducialCalibration(boofcv.abst.geo.calibration.DetectSingleFiducialCalibration) GrayF32(boofcv.struct.image.GrayF32) CalibrationObservation(boofcv.alg.geo.calibration.CalibrationObservation) Test(org.junit.jupiter.api.Test)

Example 8 with DetectSingleFiducialCalibration

use of boofcv.abst.geo.calibration.DetectSingleFiducialCalibration in project BoofCV by lessthanoptimal.

the class GenericDetectSingleFiducialCalibrationChecks method checkDetectionsResetOnFailure.

/**
 * First call something was detected, second call nothing was detected. it should return an empty list
 */
@Test
void checkDetectionsResetOnFailure() {
    DetectSingleFiducialCalibration detector = createDetector(targetConfigs.get(0));
    GrayF32 original = renderEasy(targetConfigs.get(0), null);
    detector.process(original);
    assertTrue(detector.getDetectedPoints().size() > 0);
    detector.process(new GrayF32(300, 400));
    assertNotNull(detector.getDetectedPoints());
    assertEquals(detector.getDetectedPoints().size(), 0);
}
Also used : DetectSingleFiducialCalibration(boofcv.abst.geo.calibration.DetectSingleFiducialCalibration) GrayF32(boofcv.struct.image.GrayF32) Test(org.junit.jupiter.api.Test)

Example 9 with DetectSingleFiducialCalibration

use of boofcv.abst.geo.calibration.DetectSingleFiducialCalibration in project BoofCV by lessthanoptimal.

the class GenericDetectSingleFiducialCalibrationChecks method fisheye_fullview.

/**
 * See if it can detect targets distorted by fisheye lens. Entire target is always seen
 */
@Test
void fisheye_fullview() {
    CameraUniversalOmni model = CalibrationIO.load(getClass().getResource("fisheye.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++) {
        DetectSingleFiducialCalibration detector = createDetector(targetConfigs.get(i));
        renderTarget(targetConfigs.get(i), simulatedTargetWidth, pattern, locations2D);
        simulator.resetScene();
        Se3_F64 markerToWorld = new Se3_F64();
        simulator.addSurface(markerToWorld, simulatedTargetWidth, pattern);
        failedToDetect = 0;
        for (int j = 0; j < fisheye_poses.size(); j++) {
            // System.out.println("fisheye pose = "+j);
            markerToWorld.setTo(fisheye_poses.get(j));
            checkRenderedResults(detector, simulator, locations2D);
        }
    }
    assertTrue(failedToDetect <= fisheyeAllowedFails);
}
Also used : DetectSingleFiducialCalibration(boofcv.abst.geo.calibration.DetectSingleFiducialCalibration) SimulatePlanarWorld(boofcv.simulation.SimulatePlanarWorld) GrayF32(boofcv.struct.image.GrayF32) CameraUniversalOmni(boofcv.struct.calib.CameraUniversalOmni) Point2D_F64(georegression.struct.point.Point2D_F64) ArrayList(java.util.ArrayList) Se3_F64(georegression.struct.se.Se3_F64) Test(org.junit.jupiter.api.Test)

Example 10 with DetectSingleFiducialCalibration

use of boofcv.abst.geo.calibration.DetectSingleFiducialCalibration in project BoofCV by lessthanoptimal.

the class GenericDetectSingleFiducialCalibrationChecks method checkDetectionsNonnull.

/**
 * Nothing was detected. make sure it doesn't return null.
 */
@Test
void checkDetectionsNonnull() {
    for (ConfigGridDimen layout : targetConfigs) {
        DetectSingleFiducialCalibration detector = createDetector(layout);
        detector.process(new GrayF32(300, 400));
        assertNotNull(detector.getDetectedPoints());
        assertEquals(0, detector.getDetectedPoints().size());
    }
}
Also used : DetectSingleFiducialCalibration(boofcv.abst.geo.calibration.DetectSingleFiducialCalibration) GrayF32(boofcv.struct.image.GrayF32) Test(org.junit.jupiter.api.Test)

Aggregations

DetectSingleFiducialCalibration (boofcv.abst.geo.calibration.DetectSingleFiducialCalibration)10 GrayF32 (boofcv.struct.image.GrayF32)10 Test (org.junit.jupiter.api.Test)7 ConfigGridDimen (boofcv.abst.fiducial.calib.ConfigGridDimen)4 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)4 BufferedImage (java.awt.image.BufferedImage)4 CalibrationObservation (boofcv.alg.geo.calibration.CalibrationObservation)3 CalibrateMonoPlanar (boofcv.abst.geo.calibration.CalibrateMonoPlanar)2 SimulatePlanarWorld (boofcv.simulation.SimulatePlanarWorld)2 CameraPinholeBrown (boofcv.struct.calib.CameraPinholeBrown)2 PointIndex2D_F64 (boofcv.struct.geo.PointIndex2D_F64)2 Point2D_F64 (georegression.struct.point.Point2D_F64)2 Se3_F64 (georegression.struct.se.Se3_F64)2 ArrayList (java.util.ArrayList)2 CameraModel (boofcv.struct.calib.CameraModel)1 CameraUniversalOmni (boofcv.struct.calib.CameraUniversalOmni)1