glassechidna / zxing-cpp

ZXing C++ Library
Apache License 2.0
598 stars 435 forks source link

Bad detection of DataMatrix #33

Closed pke closed 4 years ago

pke commented 8 years ago

I know this project is in maintenance mode. However I found that the detection rate of QR codes is fairly robust but detecting DataMatrix codes is almost impossible. Anyone know the reason for this? Has the Java part a better detector?

TimZaman commented 8 years ago

The detector is made for when the code is dead center and fairly large in view. You could try making your own pre-localisation.

axxel commented 6 years ago

In case that is still relevant: I had the same issue and found the c++ port from @huycn (https://github.com/nu-book/zxing-cpp. It is a completely new port based on the current Java code with the goal of having an idiomatic c++ library instead of a 1:1 mapping of Java classes.

That said, the DMDetector had the same limitations: it only works with sufficient resolution and an unrealistic requirement on the amount of whitespace surrounding the code and the orientation of the code. I reimplemented the detector from scratch and now it can detect all the samples from the test directory and more challenging examples like https://www.deutsche-apotheker-zeitung.de/_Resources/Persistent/55c53726b5bbcc918ec7800229cf2e9d27794c21/k4_931_258080_258181-800x343-660x283-482x271.jpg

I'd be happy to get feedback.

pke commented 6 years ago

You implementation can be tested where?

axxel commented 6 years ago

If you have a Linux/macOS machine, you can use the test runner project https://github.com/nu-book/zxing-cpp/tree/master/test/runners/generic to build a binary that can be called with an image path and it will try to decode that. You'll need the imagemagic convert tool in the path for internal jpg/png->pgm conversion.