Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hello, may I ask if the QR code with lighter color can not be recognized? (请问是不能识别颜色较浅的二维码吗?) #226

Open
fivefog opened this issue Aug 9, 2022 · 3 comments

Comments

@fivefog
Copy link

fivefog commented Aug 9, 2022

浅色+
黄码
红码

The first two light-colored codes cannot be recognized. Is there a solution? (前两个颜色浅的码识别不了,有办法解决吗?)

@fengdh
Copy link

fengdh commented Aug 24, 2022

With ZBar.wasm(https://github.com/undecaf/zbar-wasm, https://github.com/samsam2310/zbar.wasm), I create an online live sample which outperforming jsQR with ability to detect multiple codes in one frame supporting multiple code types:
https://output.jsbin.com/nidonin

Open the link above and point to your colorful QR codes :-)

Here is also a sample based on jsQR for comparision:
https://output.jsbin.com/zevavin

@fengdh
Copy link

fengdh commented Aug 24, 2022

You can apply darken filter to your original image data, try both orginal and altered one with jsQR.

@ReginaLiang
Copy link

We can even make it pure black and white by using the following calculations:

black = 0 - 382
white = 383 - 765

I used follows code, these qr code can be decode.

for (i = 0; i < imgData.data.length; i += 4) {
    let count = imgData.data[i] + imgData.data[i + 1] + imgData.data[i + 2];
    let colour = 0;
    if (count > 383) colour = 255;

    imgData.data[i] = colour;
    imgData.data[i + 1] = colour;
    imgData.data[i + 2] = colour;
    imgData.data[i + 3] = 255;
}

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants