Difference between revisions of "Tutorial QRCodes"

From BoofCV
Jump to navigationJump to search
m
m
Line 14: Line 14:


== Generating QR Codes ==
== Generating QR Codes ==
[[File:Qrcode_creator_app.png|border|500px|Screenshot of QR Code Creator application.]]
Both command line and GUI tools are provided. QR Code creation tool included with BoofCV is very flexible and lets you customize almost everything about a standards compliant QR code. Here is a summary of some of the their features:
* Select output document type
* Select prebuilt paper sizes or specify a custom one
* Specify the QR Code size under various units
* Force different encoding and other low level QR code settings
* Advanced options for batch printing on a single document
A screenshot of the GUI tool is shown above. As you type it will generate the results live and same codes for when you modify different settings. Both GUI and command line tools allow you to generate a grid of markers for when you need to mass produce them.
To launch the GUI type the following:
<syntaxhighlight lang="bash">
java -jar applications.jar --GUI
</syntaxhighlight>
Then select "QR Code" under "Create / Print".
To run the command line tools type what is shown below and it will print out detailed help.
<syntaxhighlight lang="bash">
java -jar applications.jar CreateQrCodeDocument
</syntaxhighlight>





Revision as of 07:48, 20 July 2021

Example qrcode detection.jpg

BoofCV provides methods for decoding and creating QR Codes. QR Codes is short for Quick Response Codes and you can find more out about them on wikipedia. QR Codes are widely used in factories, consumer products, computer applications as a way to transmit text, such as a website's address or a part number, reliably using a camera.

The detector provided in BoofCV was designed to be able to process large images and yet still detect small qr codes reliably under a variety of conditions. It's of to a good start but needs more work to handle blurred images and QR codes with damaged position patterns. It has several nice features. The current code base was adopted from camera calibration code and will provide very precise estimate of the corners on a qr code. This can be used estimate the marker's 3D pose relative to the camera more accurately than with other libraries. Failures can also be accessed. It's not unusual to detect a qr code but to have there be too many read errors to correctly decode it.

Tools for processing and generating QR Codes are included with BoofCV. You can download the pre-build application from the Applications Website.

Generating QR Codes

Screenshot of QR Code Creator application.

Both command line and GUI tools are provided. QR Code creation tool included with BoofCV is very flexible and lets you customize almost everything about a standards compliant QR code. Here is a summary of some of the their features:

  • Select output document type
  • Select prebuilt paper sizes or specify a custom one
  • Specify the QR Code size under various units
  • Force different encoding and other low level QR code settings
  • Advanced options for batch printing on a single document

A screenshot of the GUI tool is shown above. As you type it will generate the results live and same codes for when you modify different settings. Both GUI and command line tools allow you to generate a grid of markers for when you need to mass produce them.

To launch the GUI type the following:

java -jar applications.jar --GUI

Then select "QR Code" under "Create / Print".

To run the command line tools type what is shown below and it will print out detailed help.

java -jar applications.jar CreateQrCodeDocument


Batch Scanning

Batch scanning can be accomplished using a command line interface or GUI. Paths can be specified directly, or using glob/regex patterns. Directories will be recursively searched. After you have downloaded or built the applications jar you can run it with the following command:

java -jar applications/applications.jar BatchScanQrCodes

This will print out the latest and most up to date usage information. Next you will need to add arguments that specify what it should process, and a few examples are listed below:

-i /path/to/directory -o myresults.txt
   Finds all images in 'path/to' directory
-i "regex:path/to/\w+\.jpg" -o myresults.txt
   Finds all files ending with .jpg in 'path/to' directory
-i "glob:path/to/*.jpg" -o myresults.txt
   Finds all files ending with .jpg in 'path/to' directory
-i "glob:path/**/*" -o myresults.txt
   Recursively search all directories starting at 'path' for images

Just to be clear, to run one of those commands you need to pass it into the BatchScanQrCodes application as follows:

java -jar applications/applications.jar BatchScanQrCodes -i "glob:data/example/fiducial/**/*" -o myresults.txt
<syntaxhighlight lang="bash">
That example will scan all the fiducials example images for QR codes and dump the results to "myresults.txt". On my computer it takes about 2 seconds to run.

=== GUI ===

The GUI is really just a light weight wrapper on top of the command line interface. To launch that type:
<syntaxhighlight lang="bash">
java -jar applications/applications.jar --GUI

Then press the "Batch QR Code" button.

Programming