Search in sources :

Example 11 with QrCode

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);
}
Also used : QrCode(boofcv.alg.fiducial.qrcode.QrCode)

Example 12 with QrCode

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");
}
Also used : QrCode(boofcv.alg.fiducial.qrcode.QrCode) GrayF32(boofcv.struct.image.GrayF32) BufferedImage(java.awt.image.BufferedImage) ConvertBufferedImage(boofcv.io.image.ConvertBufferedImage) Test(org.junit.Test)

Example 13 with QrCode

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.
}
Also used : QrCode(boofcv.alg.fiducial.qrcode.QrCode) QrCodeEncoder(boofcv.alg.fiducial.qrcode.QrCodeEncoder) QrCodeGeneratorImage(boofcv.alg.fiducial.qrcode.QrCodeGeneratorImage) BufferedImage(java.awt.image.BufferedImage) ConvertBufferedImage(boofcv.io.image.ConvertBufferedImage)

Aggregations

QrCode (boofcv.alg.fiducial.qrcode.QrCode)13 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)5 BufferedImage (java.awt.image.BufferedImage)5 GrayF32 (boofcv.struct.image.GrayF32)4 Test (org.junit.Test)4 QrCodeEncoder (boofcv.alg.fiducial.qrcode.QrCodeEncoder)2 ConfigQrCode (boofcv.factory.fiducial.ConfigQrCode)2 QrCodeGenerator (boofcv.alg.fiducial.qrcode.QrCodeGenerator)1 QrCodeGeneratorImage (boofcv.alg.fiducial.qrcode.QrCodeGeneratorImage)1 CreateQrCodeDocumentImage (boofcv.app.qrcode.CreateQrCodeDocumentImage)1 CreateQrCodeDocumentPDF (boofcv.app.qrcode.CreateQrCodeDocumentPDF)1 SimulatePlanarWorld (boofcv.simulation.SimulatePlanarWorld)1 CameraPinholeRadial (boofcv.struct.calib.CameraPinholeRadial)1 GrayU8 (boofcv.struct.image.GrayU8)1 Point2D_F64 (georegression.struct.point.Point2D_F64)1 Se3_F64 (georegression.struct.se.Se3_F64)1 PrinterException (java.awt.print.PrinterException)1 ArrayList (java.util.ArrayList)1