Skip to content

[Bug report] DPM Data Matrix marks are not detected by ML Kit Barcode Scanning #1053

@adarsh-dhakad

Description

@adarsh-dhakad

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

  1. Use ML Kit Barcode Scanning on Android with com.google.mlkit:barcode-scanning:17.3.0.
  2. Configure scanner for Data Matrix or all barcode formats.
  3. Open CameraX preview and scan a DPM-style Data Matrix ECC 200 mark.
  4. Use a mark that is light-on-dark / inverted, low-contrast, or printed/marked on a non-ideal surface.
  5. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions