ZXing.Net: Scanned QR Code is not recognized

Hi,

I am having trouble with decoding the following QR code. The Code has been printed and then scanned again and can then no be read anymore by the ZXing library. I mostly tried with the CommandLineDecoder and the WindowsFormsDemo from the Clients folder. I tried with all kinds of different settings but none seem to work. rechnung3

What do I need to do to make this work?

Thanks for your help.

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 44 (1 by maintainers)

Most upvoted comments

Hello, As I try to find an issue to trouble decoding Swiss QRCode (since days…)

–> I scan approx 50 Swiss Invoice to 300 dpi, color per day –> Mostly, the botom left pattern of the QR Code cause the problem (if you just make some manual colorisation of the botom left pattern, everytings become ok)

My solution (95% of my QR invoices are well decoded) –> first attemp --> crop (botom part of the page) + reduce image by 0.5 + TRY_HARDER + TRY_INVERSE (works almost always and fast) –> seconde attemp --> full page + no reduction + TRY_HARDER + TRY_INVERSE –> last attemp --> crop (botom part of the page) + enlarge image by 2 + TRY_HARDER + TRY_INVERSE

Not realy “nice” solution, but it works pretty well.

@n-exo I just now got to the point where I can fully decode a QR Code. I tried with your image. The problem seems to be that has a very low resolution. This makes it very sensitive to a not perfect detection of the alignment pattern. I might be able to improve upon it but I am not sure. What helps a lot though, is just scaling the image up (I tried with 500%):

The following images are debug output generated by my decoder. You can see that it detected the alignment marks fine, but because the calculated center is off a little, it doesn’t get the modules to the lower right correctly (and possibly others).

Original

The scaled up version is perfect though (I did nothing special, just used paint.net and scaled it):

ScaledUpBy5

So the question is, why are your images of such a low resolution and can you do something about it? Maybe just scale it up before processing it?

@kltye I can confirm the suspicion about the alignment mark. My Decoder uses the lowest right mark and can decode your sample fine.

Can Anyone help me with this?

You could give the zxing-cpp project a try (spoiler: it decodes this sample, just fine). There is a .NET wrapper available (among others).

@Chris21x I forgot to mention that we lowered the framework dependency from netstandard2.1 to netstandard2.0 which is compatible with .NET Framework 4.6 upwards. So maybe this fixes your mentioned compatibility issues with .NET core that made you give up last year.

I am using zxing(3.5.3) library to decode the QRCODE from the different type of Image’s in java, but I am getting only 52% accuracy. I have also tried cropping the QRCode region from the Image and then passing cropped image to zxing still not able to decode it . What could be the possible solution for this ?? Can Anyone help me with this? . I am using the (binaryBitmap = new BinaryBitmap(new HybridBinarizer(new BufferedImageLuminanceSource(image)))😉 this

Image

Dear @husam-ebish (and dear @axxel)

Thank you for your question. At the moment I didn’t follow up on this topic, as I simply CAN’T introduce any .net Core into my project - it’s in some core libraries incompatible. Would it be important and helpfull for you? Then I’ll rethink. I implemented above described procedure which ist “good enough” for our customers (but - to be honest - not for me as a developer) - see: https://github.com/micjahn/ZXing.Net/issues/408#issuecomment-2029651489

Please let me know, Husam. “The more people asking, the more likely…”, blah-blah. I think, you know what I mean.

Sorry, @axxel for having given up for the time beeing. If it’s incompatible to used libraries, it creates a huge amount of work.

Kind regards from Switzerland - Chris

@Chris21x interesting results with your 112% comparison. May I ask which commercial library you are referring to?

Also, I would be very curious to learn how your solution fares compared to https://www.nuget.org/packages/ZXingCpp/0.2.1-alpha. maybe that would be a relatively simple addition to your testing setup? See also https://github.com/axxel/zxing-bench.

@kltye I just noticed that your last comment was potentially intended to be addressed to me. My answer is: I can’t / won’t. I’m not a .NET developer and busy improving the c++ port. Said improvements will result in the ability to scan the OPs Swiss code example with zxing-cpp.