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