use of boofcv.alg.fiducial.qrcode.QrCode in project BoofCV by lessthanoptimal.
the class DetectQrCodeMessagePanel method updateList.
public void updateList(List<QrCode> detected, List<QrCode> failures) {
BoofSwingUtil.checkGuiThread();
this.listDetected.removeListSelectionListener(this);
DefaultListModel<String> model = (DefaultListModel) listDetected.getModel();
model.clear();
this.detected.clear();
for (int i = 0; i < detected.size(); i++) {
QrCode qr = detected.get(i);
model.addElement(String.format("v%2d Mode %.5s %.10s", qr.version, qr.mode.toString(), qr.message.toString()));
this.detected.add(qr.clone());
}
this.failures.clear();
for (int i = 0; i < failures.size(); i++) {
QrCode qr = failures.get(i);
model.addElement(String.format("v%2d Mode %.6s FAILED", qr.version, qr.mode.toString()));
this.failures.add(qr.clone());
}
listDetected.invalidate();
listDetected.repaint();
textArea.setText("");
this.listDetected.addListSelectionListener(this);
}
use of boofcv.alg.fiducial.qrcode.QrCode in project BoofCV by lessthanoptimal.
the class TestCreateQrCodeDocument method single.
@Test
public void single() throws IOException, InterruptedException {
createDocument("-t http://boofcv.org -p LETTER -w 5 -o target.pdf");
BufferedImage image = loadImage();
GrayF32 gray = new GrayF32(image.getWidth(), image.getHeight());
ConvertBufferedImage.convertFrom(image, gray);
// ShowImages.showWindow(image,"Rendered", true);
// BoofMiscOps.sleep(10000);
UtilImageIO.saveImage(image, "test.png");
QrCodeDetector<GrayF32> detector = FactoryFiducial.qrcode(null, GrayF32.class);
detector.process(gray);
List<QrCode> found = detector.getDetections();
checkFound(found, "http://boofcv.org");
}
use of boofcv.alg.fiducial.qrcode.QrCode in project BoofCV by lessthanoptimal.
the class ExampleRenderQrCode method main.
public static void main(String[] args) {
// Uses a flow pattern to specify the QR Code. You can control all aspects of the QR
// like specifying the version, mask, and message types or let it select all of that for you.
QrCode qr = new QrCodeEncoder().setError(QrCode.ErrorLevel.M).addAutomatic("This is a Test ん鞠").fixate();
// NOTE: The final function you call must be fixate() that's how it knows its done
// QrCodeGenerator is the base class with all the logic and the children tell it how to
// write in a specific format. QrCodeGeneratorImage is included with BoofCV and is used
// to creates images
QrCodeGeneratorImage render = new QrCodeGeneratorImage(20);
render.render(qr);
// Convert it to a BufferedImage for display purposes
BufferedImage image = ConvertBufferedImage.convertTo(render.getGray(), null);
ShowImages.showWindow(image, "Rendered QR Code", true);
// You can also save it to disk by uncommenting the line below
// UtilImageIO.saveImage(image,"qrcode.png");
// WARNING! This rendered image lacks the white border which is required to be a compliant
// QR Code. As of this writing BoofCV's implementation might not be able to handle
// this image unless you add a white border.
}
Aggregations