zxing-js / library

Multi-format 1D/2D barcode image processing library, usable in JavaScript ecosystem.

Home Page:https://zxing-js.github.io/library/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to scan image with large black backgrounds

ioripalm opened this issue · comments

I replaced the image src in the example(barcode-image/index.html) to test whether the barcode can be scanned from the my high-definition camera.
微信图片_20240330112045
The resolution of the photo by my high-definition camera is 3264*2448.
1
In Picture 1, you can see that the barcode area only occupies a small area in the middle of the photo.This depends on the size of the shooting paper. Sometimes it is A4, sometimes it is A5, and sometimes it is just a small tip.After testing, it always fails.
If I crop out the black background of the original photo, it's work well.
2
Next I tried replacing the black background with white. Miraculously, it worked.
For pictures with a black background, is the black background recognized as part of the barcode?
3
I try to use this to crop the image and then scan the barcode is worked. Is there a way to directly identify the barcode?