mebjas / html5-qrcode

A cross platform HTML5 QR code reader. See end to end implementation at: https://scanapp.org
https://qrcode.minhazav.dev
Apache License 2.0
4.92k stars 959 forks source link

Cannot Scan DataMatrix codes that are between 5mm - 10mm (CANNOT ZOOM VIDEO) #243

Open phoenixfire425 opened 3 years ago

phoenixfire425 commented 3 years ago

Describe the bug When scanning Data Matrix codes that are < 10mm it will not read.

Ideally it would be great if we could zoom in on the canvas to have it render or read the barcode.

Using something like Scandit https://websdk.scandit.com/ works flawlessly on these sizes.

I am wondering what they are doing different that would help this scan better

So i have two issues

1) Cannot scan < 10mm DataMatrix codes 2) Cannot Zoom the image or canvas to attempt to make this work

zibranyiszgabor commented 3 years ago

Yes this is a problem. I can't scan a little QR codes. :(

denguyen-tvit commented 3 years ago

I hope @mebjas can give some advises to fix this problem. Not sure how scandit can make the scanner too fast.

mebjas commented 3 years ago

Can you share a sample of the code you are trying to use?

denguyen-tvit commented 3 years ago

Hi @mebjas

I got the same problem with https://github.com/mebjas/html5-qrcode/issues/264 But I think issue is same with this one, it took time to move camera around the barcode to get scanned. Here is code I used:

_requestCamera: function() {
            var self = this;
            // This method will trigger user permissions
            Html5Qrcode.getCameras().then(devices => {
                var backCamera = devices[devices.length -1 ];
                self.cameraId = backCamera.id;
                self._initCamera();
            }).catch(err => {
                alert(err);
                //alert('Please allow camera permission to use barcode scanner');
                self.popupSearch.modal('closeModal');
            });
        },
        _initCamera: function() {
            if (!this.html5QrCode) {
                this.html5QrCode = new Html5Qrcode("quick-order-barcode-reader");
            }
            const config = { fps: 24, qrbox: 250 };
            $('#quick-order-barcode-search').trigger('processStart');
            // If you want to prefer back camera
            this.html5QrCode.start({ facingMode: "environment" }, config, this.qrCodeSuccessCallback.bind(this)).then(foo => {
                $('#quick-order-barcode-search').trigger('processStop');
            });
            //this.html5QrCode.start({ deviceId: { exact: self.cameraId} }, config, this.qrCodeSuccessCallback.bind(this));
        },

It scan ok for large image. And take time on real product such as https://github.com/mebjas/html5-qrcode/issues/264 And this EAN_8 big image barcode, but still take time to scan, need to move camera (iphone 7plus) around for > 10 seconds. I tried update fps to 2,10,24 but not help.

ean-8-1png
mebjas commented 2 years ago

Feature request for zoom feature: https://github.com/mebjas/html5-qrcode/issues/330

fbenedetti06 commented 2 years ago
  1. Cannot scan < 10mm DataMatrix codes
  2. Cannot Zoom the image or canvas to attempt to make this work

Same issue here and same need It would be a very desirated improvement

adityaKlalith commented 2 years ago

Hi @mebjas

When the qr code is close to the camera or is not an image of high quality, the scanner doesn't read the code. The native scanners or google lens present in the mobile devices scans the above mentioned types of codes with ease; this is because of the focus option(manual-finger touch or auto) that they have when the image of the code is placed infront of the device camera(My assumption). If the above feature (auto or manual focus) can be included in our library(if not already included), then we might be able to solve the issues we are facing.

In simpler words, can we make the scanner function similar to native scanner in mobile devices?

Kind Regards Lalith Aditya