glassechidna / zxing-cpp

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

search-multi: "This luminance source does not support cropping." #52

Open logidelic opened 7 years ago

logidelic commented 7 years ago

I've been using zxing-cpp for a while now and it seems to work just fine when trying to read a single code that is pre-cropped (in my case, a data-matrix). However, if I have an image that potentially contains multiple codes, I cannot figure out how to get zxing to decode these. If I execute:

./zxing --search-multi --try-harder --more -v myimage.png

I get the output:

Hybrid binarizer failed: zxing::IllegalArgumentException: This luminance source does not support cropping.
Global binarizer failed: zxing::IllegalArgumentException: This luminance source does not support cropping.

What exactly does this mean and is there any way of working around it?

Interestingly, if I process the exact same image (which contains one data-matrix and one bar-code) without the search-multi argument, it works (./zxing myimage.png)! (I assume that in this case it extracts the first code that it finds and ignores the rest?).

Any help would be appreciated.

lubo commented 7 years ago

Hello, came across the same problem. Any update ?

Benjamin-Dobell commented 7 years ago

The following was merged last November:

https://github.com/glassechidna/zxing-cpp/pull/30

I'm not sure what needs to be done beyond that. This project is in maintenance mode only, however, pull requests are welcome.

lubo commented 7 years ago

Thank you for reply. I cannot find GreyscaleLuminanceSource being used anywhere. The CLI utility uses LuminanceSource, not GreyscaleLuminanceSource.

jose1711 commented 4 years ago

To me the multisearch appears completely broken. Here's a test case:

$ echo foo | qrencode -v 1 -o qr_foo.png
$ echo bar | qrencode -v 1 -o qr_bar.png
$ zxing qr_foo.png
foo

$ zxing qr_bar.png
bar

$ montage qr_foo.png qr_bar.png combined.png
$ zxing combined.png
decoding failed

$ zxing -v --search-multi combined.png
Hybrid binarizer failed: zxing::ReaderException: No code detected
Global binarizer failed: zxing::ReaderException: No code detected

$ zxing -v --search-multi --try-harder combined.png
Hybrid binarizer failed: zxing::ReaderException: No code detected
Global binarizer failed: zxing::ReaderException: No code detected

$ zxing -v --try-harder combined.png
Hybrid binarizer failed: zxing::ReaderException: No code detected
Global binarizer failed: zxing::ReaderException: No code detected

zbarimg manages to find and decode both codes

$ zbarimg combined.png
QR-Code:bar

QR-Code:foo

scanned 2 barcode symbols from 1 images in 0.01 seconds