Describe the bug
ML Kit Barcode Scanning does not detect some Direct Part Marking (DPM) Data Matrix / Data Matrix ECC 200 codes from Android camera frames.
In our Android app, regular printed barcodes scan correctly, but this DPM-style Data Matrix mark is not detected by ML Kit from the normal camera frame. The mark is low-contrast / inverted style, for example light modules on a dark surface. The device camera scanner can recognize this type of mark, but ML Kit does not return a barcode result for the same camera frame.
We tried preprocessing the camera frame by cropping the scan area, inverting colors, cleaning contrast, and generating multiple scaled variants. With this workaround, ML Kit can sometimes decode the barcode, but the original frame and a single inverted/cleaned frame are not enough.
To Reproduce
- Use ML Kit Barcode Scanning on Android with
com.google.mlkit:barcode-scanning:17.3.0.
- Configure scanner for Data Matrix or all barcode formats.
- Open CameraX preview and scan a DPM-style Data Matrix ECC 200 mark.
- Use a mark that is light-on-dark / inverted, low-contrast, or printed/marked on a non-ideal surface.
- Observe that ML Kit does not return a decoded barcode from the normal camera frame.
Expected behavior
ML Kit should detect and decode DPM Data Matrix marks from camera frames, or expose a DPM-specific mode / configuration similar to other scanning SDKs, including better support for inverted color Data Matrix and marks on difficult surfaces.
Actual behavior
ML Kit does not detect/decode this DPM Data Matrix mark from normal camera frames.
SDK Info:
- SDK Name & Version:
com.google.mlkit:barcode-scanning:17.3.0
- Barcode format:
Barcode.FORMAT_DATA_MATRIX
- Android camera pipeline: CameraX
ImageAnalysis
Smartphone:
- Device/Simulator: Android physical devices
- Device/Simulator OS: Android 15 observed during testing
Additional context
A dedicated DPM mode or official guidance for DPM Data Matrix scanning would help. We found that simply inverting a single frame is not enough; distance/angle/scale changes also affect whether ML Kit decodes the mark.
Describe the bug
ML Kit Barcode Scanning does not detect some Direct Part Marking (DPM) Data Matrix / Data Matrix ECC 200 codes from Android camera frames.
In our Android app, regular printed barcodes scan correctly, but this DPM-style Data Matrix mark is not detected by ML Kit from the normal camera frame. The mark is low-contrast / inverted style, for example light modules on a dark surface. The device camera scanner can recognize this type of mark, but ML Kit does not return a barcode result for the same camera frame.
We tried preprocessing the camera frame by cropping the scan area, inverting colors, cleaning contrast, and generating multiple scaled variants. With this workaround, ML Kit can sometimes decode the barcode, but the original frame and a single inverted/cleaned frame are not enough.
To Reproduce
com.google.mlkit:barcode-scanning:17.3.0.Expected behavior
ML Kit should detect and decode DPM Data Matrix marks from camera frames, or expose a DPM-specific mode / configuration similar to other scanning SDKs, including better support for inverted color Data Matrix and marks on difficult surfaces.
Actual behavior
ML Kit does not detect/decode this DPM Data Matrix mark from normal camera frames.
SDK Info:
com.google.mlkit:barcode-scanning:17.3.0Barcode.FORMAT_DATA_MATRIXImageAnalysisSmartphone:
Additional context
A dedicated DPM mode or official guidance for DPM Data Matrix scanning would help. We found that simply inverting a single frame is not enough; distance/angle/scale changes also affect whether ML Kit decodes the mark.