3

I'm trying to leverage ZXing in an Android app to scan data matrixes. So far I'm successful with printed data matrixes such as this:

enter image description here

But other data matrixes, which are either printed by laser or punched into the material, have circle-looking marks —instead of square-looking ones.

enter image description here

These present a problem. The only app I've found capable of scanning this is QRDroid. This article says that QRDroid uses ZXing so I'm thinking if they can, there must be a way. Unfortunately QRDroid is not an open source project so I don't know how.

There's the possibility of course that QRDroid is using an algorithm to somehow transform the circled marks in to squared ones before they attempt to read the data matrix. I don't know anything about image manipulation in Java, so I can't imagine how this is done.

My question is whether there's a way to tweak ZXing to read this type of data matrix, or if there's any library I can use to manipulate the image to make it readable by ZXing.

Edit:

If I use an image editor -e.g. I used https://www.befunky.com- to and apply a blur of 10, then it looks like a normal printed data matrix and my scan works. How should I go about doing this in my Android app?

enter image description here

Mig82
  • 4,856
  • 4
  • 40
  • 63

2 Answers2

6

After some research I found out that this type of marking is not really considered a standard data matrix but rather referred to by the manufacturing industry as a DPM, which stands for "Direct Part Marking", although I've read other sources call it "Dot Peen Marking" or "Dot Peen Matrix"

I posted this same question on an already existing issue in the Zxing repository and this was the reply I got:

The problem is the WhiteRectDetector. It finds a white rectangle inside the code, similar to this issue. If you rotate the image slightly (say 10°) or you blur it as you did or you did a suitably sized pixel dilation followed by an erosion, you'll get something that should (mostly) be detectable.

Modifying the WhiteRectDetector, to allow for dots rather than squares was not really an option for me due to deadlines, so I ended up switching from Zxing to Scandit, which is proven to be able to scan this.

Scandit is a proprietary library, but I haven't really found any other alternatives. You can get a trial license though. For those wanting to try it out to scan DPM's, the documentation is not very clear on how to enable scans for this symbology, so here's the trick.

In Android:

settings.getSymbologySettings(Barcode.SYMBOLOGY_DATA_MATRIX)
.setExtensionEnabled("direct_part_marking_mode", true);

In Objective-C:

[[settings settingsForSymbology:SBSSymbologyDatamatrix] 
setExtension:@"direct_part_marking_mode" enabled:YES];
Mig82
  • 4,856
  • 4
  • 40
  • 63
1

You're correct DPM is most often a laser etched or physical dot peen punched datamatrix code found on many materials, especially metal and PCB. It's often used to mark parts with serial numbers and other production data. Due to the lack of contrast they can be incredibly difficult to decode, and a hardware scanner purpose built for this is often as much as $3000. You won't find a free library to scan DPM reliably. Luckily our phone cameras work very well for reading these codes and there are professional SDK's available to solve this problem at a relatively low cost.

Another option to the SDK mentioned above is by Code Corp, called CortexDecoder, you can demo their technology with CortexScan app: https://apps.apple.com/us/app/cortexscan/id956868725 https://play.google.com/store/apps/details?id=com.codecorp.cortex_scan

You can get a Free SDK demo here: https://codecorp.com/products/cortexdecoder

Brian
  • 11
  • 1