qrazybox icon indicating copy to clipboard operation
qrazybox copied to clipboard

Is decoder correct?

Open PSLLSP opened this issue 1 year ago • 1 comments
trafficstars

I recovered QR code from an image, QRazyBox was able to decode the QR code. After close inspection, I see difference in one "dot", I cannot find any other difference but I can miss some other detail... The question is why source QR code differs from recovered QR code. Was source QR code generated with a defect? Is there a bug in QRazyBox decoder?

QR-demaged1

Recovered QR code:

#######__###_#__#_#######
#_____#___###__#__#_____#
#_###_#_#_###_#_#_#_###_#
#_###_#_##__###___#_###_#
#_###_#_#_#_##__#_#_###_#
#_____#_#_#_#####_#_____#
#######_#_#_#_#_#_#######
________##_##__#_________
#_#####___##_##___#####__
_#_#_#_####_____#__#___#_
___#_##_#__######___##_##
___##____###__#####_#___#
#___#_#______#___##_#_###
##__##__##__##__#__#_#_#_
#_###_#___#__#####_###_##
#_#____#_#__#__##__##___#
#_#_###_#___#########_#__
________##_____##___##___
#######__#_###__#_#_#_###
#_____#_#_##__#_#___##__#
#_###_#_#__##########_#__
#_###_#_#___##_#_##_#####
#_###_#_#_#__##_#____####
#_____#__#____########__#
#######_##_####__#_######

QR code that was manually modified to match source image, notice "?" in the bottom right corner...

#######__###_#__#_#######
#_____#___###__#__#_____#
#_###_#_#_###_#_#_#_###_#
#_###_#_##__###___#_###_#
#_###_#_#_#_##__#_#_###_#
#_____#_#_#_#####_#_____#
#######_#_#_#_#_#_#######
________##_##__#_________
#_#####___##_##___#####__
_#_#_#_####_____#__#___#_
___#_##_#__######___##_##
___##____###__#####_#___#
#___#_#______#___##_#_###
##__##__##__##__#__#_#_#_
#_###_#___#__#####_###_##
#_#____#_#__#__##__##___#
#_#_###_#___#########_#__
________##_____##___##___
#######__#_###__#_#_#_###
#_____#_#_##__#_#___##__#
#_###_#_#__##########_#__
#_###_#_#___##_#_##_#####
#_###_#_#_#__##_#____##?#
#_____#__#____########__#
#######_##_####__#_######

Online QR-generator that generates this QR code (one dot difference from QRazyBox) Other online QR-generator QR-qrserver1


Other interesting point about this QR code is that when I scan it with Android barcode scanner Binary Eye, it claims that QR code has ECC recovery at level M and it "restores" QR code but the patterns is very different; I do not understand these low-level details so I cannot explain why the pattern is so different.... UPDATE: a bug in Binary Eye, it generates QR with ECC L...

Other interesting point is when I load this new pattern (created by Binary Eye) to QRazyBox and then I click to blue area in the top left corner, QRazyBox shows "ECC L, mask pattern 2"; Binary Eye shows "ECC M", so there is a bug somewhere, ~~I assume bug in QRazyBox...~~ UPDATE: Binary Eye restores QR code with "ECC L"...

QR-defect2

PSLLSP avatar Jan 21 '24 00:01 PSLLSP

Yes, quite weird. The default decoder that qrazybox used is depend from jsqrcode. I think it is the time to update jsqrcode (or possibly replace it if there is better alternative because the library itself is not updated for long time).

If you try to decode it via "extract qr info" or "reed-solomon decoder", it return correct result.

Xnip2024-01-27_17-38-05 Xnip2024-01-27_17-41-26

In the meantime, I suggest to decode any (complete) QR code using reed-solomon decoder because the correctness of the reed-solomon calculation can be easily verified and debugged.

Merricx avatar Jan 27 '24 10:01 Merricx