Guidance for creating scannable docs with QR codes

49 views
Skip to first unread message

Logan Hope

unread,
Mar 27, 2017, 9:08:38 PM3/27/17
to zxing
Hi,

I am trying to create documents with embedded QR codes that can be scanned back. So far, the decode rate for the scanned QR codes has been hit-or-miss. Perhaps around 80%.

The documents are printed with a 0.88 inch by 0.88 inch version 3 QR code in the bottom-right with plenty of margin. The processing software crops the region where the QR code is expected and runs it through ZXing, using BufferedImageLuminanceSource/HybridBinarizer with TRY_HARDER hint turned on.

I've attached a couple that failed to decode.

Given that I can modify both the producing and consuming ends, what could I do to ensure the codes scan and decode correctly?

Thanks in advance

last_fail_2.png
last_fail.png

Lachezar Dobrev

unread,
Mar 28, 2017, 5:53:56 AM3/28/17
to Logan Hope, zxing
Hello Logan,

D: This is a personal opinion and may not represent the collective
views of the community or the development and support team.

I've had this exact problem. ZXing is built around the shotgun
approach working with a video stream: large number of slightly
different images, no image is 100% scanned, but the amount makes up
for the low(ish) success rate on a single attempt. A mid-class phone
can handle 10, 15 or more attempts per second, and the user can barely
sense the delay. This however can make processing stand-alone still
images a bit of a challenge.

With the community's help and a few pointers I came up with this: in
order to achieve a higher success rate perform secondary scans on the
still image, but apply distortions to it. The main distortions that I
ended up using are:
* rotation (±90°, 180°)
* scale down (a few steps)
* blur (a few different kernels)

Contrary to the common sense down-scaling images (and reducing the
density that way) seems to increase the success rate to a point. The
blur seems to help with artefacts occurring due to
printing-and-scanning procedure.

For instance the last_fail.png scans fine with 50% downscaling and
blur 1 pixel.
The last_fail_2.png scans scans with 50% downscaling, blur 1 pixel
and 180° rotation.

Basically this process provides the slightly-different images that
would otherwise be a video input feed.
> --
> You received this message because you are subscribed to the Google Groups "zxing" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to zxing+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Logan Hope

unread,
Mar 31, 2017, 11:56:10 AM3/31/17
to zxing, loganh...@gmail.com
Hi Lachezar,

Thank you. This is very helpful! I will try these methods.
Reply all
Reply to author
Forward
0 new messages