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));
}
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);
}
}
}
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);
}
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);
}
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());
}
}
Aggregations