Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Analyze partial or corrupted QR codes [closed]

Tags:

decode

qr-code

How can I analyze broken/partial QR codes? Normally a QR decoder will just tell you that the data can not be read. This is not very useful. Even though the code is not readable, some information can, presumably, be extracted!

  • Is the finder patterns found?
  • Is the timing pattern found?
  • What is the version?
  • What is the error level?
  • What is the mask?
  • Is the format intact?
  • What is the mode?
  • Is the stop pattern found after the correct length?
  • Is there any meaningful data?

How can I extract this information from broken/partial QR codes?

like image 289
hpekristiansen Avatar asked Nov 11 '12 07:11

hpekristiansen


People also ask

How do you read a damaged QR code?

They are designed as damage-resistant. QR code uses Reed–Solomon error correction so that even if a QR code is damaged, we can still read them. When users are generating QR codes, they can select which correction level to use. There are four error correction levels: Low, Medium, High and Quartile.

What happens if a QR code is damaged?

Known as error correction, QR Codes can sustain up to 30% of structural damage and still continue to function. The pixelated parts you see on a QR Code are doubled so that if some are damaged, then others make up for them and still convey the data to the scanner.

How do I recover a damaged QR code?

In case you need the QR code to work again there is an easy fix. All you have to do is recreate a new link with the same domain name and slashtag as the one that was deleted. To discover which link is associated with a specific QR code you can use an online tool such as https://zxing.org/w/decode.jspx.


2 Answers

This is a question that comes up in many ways; some easier than others.

To answer your direct question: The tool you need: Your brain.

Software can help but to decode partial or misprinted codes takes some work. It is like detective work. You need to take what you have and fill in what you know about the way they are created in the first place, then make educated guesses for the win.


Here is a tour of the concept. By looking at these articles most of the items on your bullet-point list will be answered.

This article explains the overall format in good detail:

Wounded QR Codes

For instance, here is the first image in the article about formatting:

enter image description here


Here is a real-world example of the process of decoding a partial image:

Decoding a partial QR code

It begins with the challenge image

enter image description here

Then shows you the order of bits that are encoded:

enter image description here

Then through the process of detective work to produce the final image:

enter image description here


Here is a different problem. You have a full image but it won't scan properly so you have to decode it by hand:

Decoding small QR codes by hand

It starts out with a tattoo:

enter image description here

Which is in the wrong orientation, and also won't scan properly.

So you work through the decoding process:

enter image description here

Yielding the final result: Maci Clare Peltz


Have fun detecting!

like image 198
SDsolar Avatar answered Oct 22 '22 13:10

SDsolar


You can simply hack some open source code like zxing to print out its progress on a command line during decoding and in that way see how far it got. Just sprinke in a few System.out.println() statements.

The problem is false positives. It will almost always find at least 3 regions that look like a QR code's finder patterns; it always takes the 3 most likely candidates. They usually are phantoms since you're usually not looking at a QR code. The next step would then fail, finding valid version info. (In a very unlikely case it would even find phantom version info.)

Some of these aspects you mention aren't necessarily detected by a library since they don't have to be, like timing pattern and stop pattern (which isn't required for short data).

Aside from those caveats, should be easy.

like image 28
Sean Owen Avatar answered Oct 22 '22 11:10

Sean Owen