cozmo / jsQR

A pure javascript QR code reading library. This library takes in raw images and will locate, extract and parse any QR code found within.
https://cozmo.github.io/jsQR/
Apache License 2.0
3.64k stars 602 forks source link

Add fallback locator point recenter #166

Closed jefff closed 4 years ago

jefff commented 4 years ago

We normally use the center of the quads as the location of the tracking points, which is optimal for most cases and will account for a skew in the image. However, In some cases, a slight skew might not be real and instead be caused by image compression errors and/or low resolution. For those cases, we'd be better off centering the point exactly in the middle of the black area. This change computes the location data for the naively centered points as it is little additional work and allows for multiple attempts at decoding harder images.

An example of this bug: buggycenter

This change fixes 5 of the 47 currently failing tests, with no regressions.