use of boofcv.alg.fiducial.microqr.MicroQrCode in project BoofCV by lessthanoptimal.
the class TestCreateMicroQrDocument method two.
@Test
void two() throws IOException {
createDocument("-t 1234567 -t second -p LETTER -w 5 -o target.pdf");
BufferedImage image = loadPDF();
var gray = new GrayF32(image.getWidth(), image.getHeight());
ConvertBufferedImage.convertFrom(image, gray);
// ShowImages.showWindow(image,"Rendered", true);
// BoofMiscOps.sleep(10000);
MicroQrCodeDetector<GrayF32> detector = FactoryFiducial.microqr(null, GrayF32.class);
detector.process(gray);
List<MicroQrCode> found = detector.getDetections();
assertEquals(2, found.size());
checkFound(found, "1234567", "second");
}
use of boofcv.alg.fiducial.microqr.MicroQrCode in project BoofCV by lessthanoptimal.
the class TestMicroQrCodeDetectorPnP method renderFiducial.
@Override
public GrayF32 renderFiducial() {
MicroQrCode qr = new MicroQrCodeEncoder().addAutomatic("THE MESSAGE").fixate();
int width = MicroQrCode.totalModules(qr.version) * 6;
var engine = new FiducialImageEngine();
// interpolation gets messed up if it touches the border. plus scale is relative
engine.configure(1, width);
var generator = new MicroQrCodeGenerator();
generator.markerWidth = width;
generator.setRender(engine);
generator.render(qr);
return engine.getGrayF32();
}
use of boofcv.alg.fiducial.microqr.MicroQrCode in project BoofCV by lessthanoptimal.
the class GenericMicroQrCodeDetectorChecks method renderAndCheck.
private void renderAndCheck(MicroQrCodeDetector<GrayF32> detector, SimulatePlanarWorld simulator) {
simulator.render();
detector.process(simulator.getOutput());
if (display) {
ShowImages.showWindow(simulator.getOutput(), ShowImages.Colorization.MAGNITUDE, "Foo", true);
BoofMiscOps.sleep(200);
UtilImageIO.saveImage(simulator.getOutput(), "microqr_rendered.png");
}
List<MicroQrCode> detections = detector.getDetections();
assertEquals(1, detections.size());
MicroQrCode qr = detections.get(0);
assertEquals(message, qr.message);
}
use of boofcv.alg.fiducial.microqr.MicroQrCode 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());
}
Aggregations