MaxiCode support?
ravilov opened this issue · 6 comments
ZXing lib claims to support MaxiCode (yes, the weird UPS thing), however I can't seem to get BinaryEye to scan any that I tried. Is that a limitation of BE or ZX or something else?
Using BinaryEye 1.15.0 from F-Droid.
Good question. All the samples are failing for me too. My first guess is there's something wrong with ZXing because Binary Eye just gives an image to ZXing. On the other hand, ZXing has tests for MaxiCode 🤔
Well, finally found out that ZXing (in version 3.3.3, the last version we can use for Android apps that should run below Android 7.0 Nougat, see here) can only read MaxiCodes if it's in PURE_BARCODE mode.
PURE_BARCODE
means the barcode is expected to be unrotated and not skewed in the input image. Of course, this isn't usually true for a camera frame.
From MaxiCodeReader.java:
@Override
public Result decode(BinaryBitmap image, Map<DecodeHintType,?> hints)
throws NotFoundException, ChecksumException, FormatException {
DecoderResult decoderResult;
if (hints != null && hints.containsKey(DecodeHintType.PURE_BARCODE)) {
BitMatrix bits = extractPureBits(image.getBlackMatrix());
decoderResult = decoder.decode(bits, hints);
} else {
throw NotFoundException.getNotFoundInstance();
}
....
Unfortunately, the docs are silent on this 😞
Now, I've did a couple of tests and indeed could read a couple of MaxiCodes when PURE_BARCODE
is set. Of course, setting PURE_BARCODE
makes reading other barcodes much worse (like QR Codes and DataMatrix and probably others as well) 😬
So the only solution I see would be to have a special MaxiCode Reader "mode", which would be rather ugly, of course.
Alternatively, it would also be possible to scan every other frame with PURE_BARCODE
set but that also would make performance for all other codes a bit worse 🤔
Thank you for the reply. At least now we know what's going on! I agree having an option to switch "modes" sounds ugly. What do you think about doing a second pass on the same image data with the said PURE_BARCODE
option set in case the first (normal) pass finds nothing? Or would that slow down the scanning too much?
Unfortunately, yes, doing an extra pass would slow down scanning. Especially on low end devices. So I rather wouldn't do it by default.
Not by default, but I feel here's where a checkbox setting would come in handy. Switch between faster but less broad and slower but with more codes supported.
Could the PURE_BARCODE
be auto-enabled when "Restrict format" is set to MAXICODE?