Describe the bug
The barcode scanner fails to detect Data Matrix codes when they use inverted polarity — i.e., light/white modules on a dark/black background. Standard dark-on-light Data Matrix codes scan correctly, but inverted codes are not recognized at all, even under good lighting and focus conditions.
To Reproduce
- Generate a standard Data Matrix code (dark modules on light background) — confirm it scans successfully.
- Generate the same data as a Data Matrix code with inverted colors (light modules on dark background).
- Start scanning with no format restriction.
- Observe that the inverted code is never detected, while the normal-polarity version scans without issue.
Expected behavior
The scanner should detect and decode Data Matrix codes regardless of color polarity (dark-on-light or light-on-dark), consistent with the ISO/IEC 16022 spec, which explicitly supports both polarities.
SDK Info:
- SDK Name & Version: com.google.mlkit:barcode-scanning:17.3.0
Smartphone:
- Device/Simulator: Android physical devices
- Device/Simulator OS: Android 16 observed during testing
Describe the bug
The barcode scanner fails to detect Data Matrix codes when they use inverted polarity — i.e., light/white modules on a dark/black background. Standard dark-on-light Data Matrix codes scan correctly, but inverted codes are not recognized at all, even under good lighting and focus conditions.
To Reproduce
Expected behavior
The scanner should detect and decode Data Matrix codes regardless of color polarity (dark-on-light or light-on-dark), consistent with the ISO/IEC 16022 spec, which explicitly supports both polarities.
SDK Info:
Smartphone: