Open sabiinlaw opened 2 years ago
ZXing.Net uses a very simple algorithm to find more than one barcode inside an image. Because of that, it can happen that not all codes will be found. Feel free to provide a PR with some enhancements.
Maybe as a workaround you can draw something (e.g. a rectangle) over the detected barcores, using the ResultPoints in the result, and trigger another decode?
Works only for 2D codes. For 1D codes you are getting only a line as the result points, not the whole rectangle.
As a workaround I tried some solutions from this article (https://localcoder.org/zxing-finding-the-bounding-rectangle-of-barcode), but it's not always possible to find correct coordinates. For now it is not that critical for me if some barcodes are missed and looks like a rare case when 2 barcodes placed exactly on same line. Thank you for your support 👍
Not directly on topic, but some background information:
@micjahn I actually had a bit of an similar challenge, I added ZWing to Greenshot so it was able to provide the user with a way to use bar/QR codes on the screen. I noticed that it failed to find all when there are multiple. Back then I did the workaround which I mentioned, but I never released the functionality so there wasn't a lot of testing, I probably missed the use-case with a 1D code 🤷♂️ .
I might come back to that use-case, I also have similar stuff with text in the most recent versions, where one can select text (for the clipboard) directly from the screenshot. I was hoping to be able have the QR code positions too.
Example:
The green rectangle shows the result points for QR decoding. In that case, it would work.
PDF417 should also work
And this is a sample for 1D decoding
ZXing saves the additional CPU cycles which are needed to find the whole rectangle.
Thanks a lot for the thorough feedback, your examples is what I saw when I got the ResultPoints. But I never tested a 1D variant, that makes total sense for the recognition. 👍
For whom it may concern: https://github.com/zxing-cpp/zxing-cpp/ uses a completely different approach to detect multiple symbols in one image and detects all of the 9 symbols in the first image above just fine.
As a followup to my comment from last year: zxing-cpp now comes with a .NET wrapper.
I tried to use different barcode readers (BarcodeReader, GenericMultipleBarcodeReader) to decode single page file with multiple barcodes, but it can't find both UPC-E and EAN-8 barcodes together.