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

[BUG] White QRCode with other Background Color cannot be scanned. #403

Closed
derjohng opened this issue Aug 22, 2021 · 8 comments · Fixed by #459
Closed

[BUG] White QRCode with other Background Color cannot be scanned. #403

derjohng opened this issue Aug 22, 2021 · 8 comments · Fixed by #459
Labels
bug Something isn't working

Comments

@derjohng
Copy link

derjohng commented Aug 22, 2021

Describe the bug
White QRCode with other Background Color cannot be scanned.

Flutter information
[✓] Flutter (Channel master, 2.5.0-7.0.pre.185, on macOS 11.5.2 20G95 darwin-x64, locale en-GB)
• Flutter version 2.5.0-7.0.pre.185
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 2526cb07cb (11 hours ago), 2021-08-21 23:42:01 -0400
• Engine revision 4783663ee4
• Dart version 2.15.0 (build 2.15.0-41.0.dev)

Device (please complete the following information):

  • Device: Google Pixel 3a
  • OS: Android11
    PS: iPhone/iOS will not have this issue.

Screenshots
Left part of below image CANNOT be scanned with qr_code_scanner v0.5.2.
In my case, white QRCode with blue background cannot be scanned also.
Right part is ok.
0822_001

Additional context
...

@derjohng derjohng added the bug Something isn't working label Aug 22, 2021
@goshander
Copy link

same issue

@UsamaKarim
Copy link

Confirming. Scanner problems on different colors

@deepak-0811
Copy link

In my case qr code has blue background.

And not scanning only in Androd in iOS working fine.

Any solution for this?

@jodafm
Copy link

jodafm commented Sep 14, 2021

same issue

@gokhancvs
Copy link

I have the exact same issue. Any solution?

@vikneshgopinathan
Copy link

i have the same issue, any solutions?

@goshander
Copy link

i have the same issue, any solutions?

For now, I found only one solution. I use other lib: qrscan, which use input image buffer for recognize. I use camera package to get image buffer, then apply grayscale and invert filter before send to qrscan lib. It worked, but it slow, and I had to come simply tricky frame skip code

recognize snippet

    Timer.periodic(new Duration(seconds: 2), (timer) {
      timerP = timer;
      if (image == null) return;
      scanner
          .scanBytes(Uint8List.fromList(jpgOut.encodeImage(
              invert(grayscale(jpg.decodeImage(image!.planes[0].bytes))))))
          .then((barcode) {
        barcode = barcode.trim();
        if (barcode != '') {
         // do something
        }
      }).catchError((err) {});
    });

get image snippet

availableCameras().then((cameras) {
      controller = CameraController(cameras[0], ResolutionPreset.medium,
          imageFormatGroup: ImageFormatGroup.jpeg);
      controller!.initialize().then((cam) {
        if (!mounted) {
          return;
        }
        controller!.startImageStream((image) {
          this.image = image;
        });
        setState(() {});
      });
    });

I wait, when this library can recognize qr automatically, it will awesome, for now this trick)

@UsamaKarim
Copy link

i have the same issue, any solutions?

For now, I found only one solution. I use other lib: qrscan, which use input image buffer for recognize. I use camera package to get image buffer, then apply grayscale and invert filter before send to qrscan lib. It worked, but it slow, and I had to come simply tricky frame skip code

It does only support Android 😐

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants