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

Inverted EAN-13 barcode not recognized in dark theme #1201

Open
ProstoCesar opened this issue Oct 4, 2024 · 5 comments
Open

Inverted EAN-13 barcode not recognized in dark theme #1201

ProstoCesar opened this issue Oct 4, 2024 · 5 comments
Assignees
Labels
bug Something isn't working MLKit

Comments

@ProstoCesar
Copy link

Hello, guys. I've encountered an issue where inverted (dark theme) EAN-13 barcodes are not recognized by mobile_scanner. When using a standard barcode (black bars on white background), the barcode is scanned correctly. However, when I invert the colors (white bars on black background), the scanner fails to detect the barcode.
Steps:

  • Display an EAN-13 barcode in the standard color scheme (black bars on white background).
    – Attempt to scan it using mobile_scanner. This barcode is scanned successfully.
    – Invert the colors (white bars on black background) to simulate a dark theme.
    – Attempt to scan the inverted barcode. The scanner fails to detect the barcode.

Screenshots:
Correctly recognized barcode in light theme:
image
Barcode not recognized in dark theme:
image

Environment:
mobile_scanner version: 5.2.3
Flutter version: 3.24.3
Dart version: 3.5.3
Devices: Honor 30, Pixel 8, Honor 10x Lite

@alexandrim0
Copy link

Same trouble for me with QRcode.

@alexandrim0
Copy link

@navaronbracke
Copy link
Collaborator

As reported above, this seems like an issue in MLKit that does not detect inverted barcodes.

I'll test this on MacOS, to see if the Vision API has the same issue. If MacOS does not have that issue, then this will be fixed in the next major release, that will use the Vision API on iOS as well. For Android we will look into adding support for inverted barcodes, like with the PR mentioned above.

@navaronbracke navaronbracke self-assigned this Oct 5, 2024
@navaronbracke navaronbracke added bug Something isn't working MLKit labels Oct 5, 2024
@navaronbracke
Copy link
Collaborator

According to the docs, the Vision API reports whether a barcode was inverted, so it should support this.

https://developer.apple.com/documentation/vision/vnbarcodeobservation/iscolorinverted

This flag is only available on iOS 17 and higher, so I'm not sure if detecting inverted barcodes will work on iOS 16 and below.

@yeras-is
Copy link

@ProstoCesar We had the same issue and forked library to invert image before proceeding to ML Kit, feel free to check https://github.com/injil-kz/mobile_scanner_clone

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

No branches or pull requests

4 participants