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