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.7k stars 607 forks source link

I cannot decode this image #97

Closed wladston closed 5 years ago

wladston commented 6 years ago

test

Other QR code decoders seem to handle it just fine.

cozmo commented 6 years ago

Thanks for the report! This is probably a bug in our decoding, we'll fix it and add a test case.

cozmo commented 5 years ago

Hmm @wladston I actually can't reproduce this issue.

The following code seems to work just fine

import jsQR from "../src";
import * as helpers from "./helpers";

(async () => {
  const imageData = await helpers.loadPng(`issue-97.png`);
  const code = jsQR(imageData.data, imageData.width, imageData.height);
  if (code) {
    console.log("FOUND", code);
  }
})().then(() => process.exit(0)).catch((e) => { throw e; });

Logging

FOUND
{ binaryData: [ ... ],
  data: 'bbbbb515293bbbbbbbbbbbbbbb13904599bbbbbbbbbbbbbbbbbbbbbb1bbbbbbb',
  chunks: 
   [ { type: 'byte', bytes: [Array], text: 'bbbbb' },
     { type: 'numeric', text: '515293' },
     { type: 'byte', bytes: [Array], text: 'bbbbbbbbbbbbbbb' },
     { type: 'numeric', text: '13904599' },
     { type: 'byte',
       bytes: [Array],
       text: 'bbbbbbbbbbbbbbbbbbbbbb1bbbbbbb' } ],
  location: 
   { topRightCorner: { x: 147.99999999999997, y: 16.000000000000004 },
     topLeftCorner: { x: 16.000000000000004, y: 16.000000000000004 },
     bottomRightCorner: { x: 147.99999999999994, y: 147.99999999999994 },
     bottomLeftCorner: { x: 16.000000000000004, y: 147.99999999999997 },
     topRightFinderPattern: { x: 134, y: 30 },
     topLeftFinderPattern: { x: 30, y: 30 },
     bottomLeftFinderPattern: { x: 30, y: 134 },
     bottomRightAlignmentPattern: { x: 122, y: 122 } } }

I'm going to close this issue since it seems we're able to scan just fine. That said I'd love understand what was causing you to not be able to decode, and if you believe there's still an issue please re-open.

gidbrn commented 5 years ago

I cannot recognize the above QR code. I use https://cozmo.github.io/jsQR/ and the code is not recognized.

wladston commented 5 years ago

@cozmo at a first glance, I couldn't discover why, but passing the image as a file works, whereas trying to scan it with the camera (as described by @gidbrn) doesn't. Maybe you have better ideas on how to make this report more reproducible?

@cozmo, did you try scanning it with the camera?