Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MaxiCode support? #77

Open
ravilov opened this issue Oct 21, 2019 · 6 comments
Open

MaxiCode support? #77

ravilov opened this issue Oct 21, 2019 · 6 comments

Comments

@ravilov
Copy link

ravilov commented Oct 21, 2019

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.

@markusfisch
Copy link
Owner

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 🤔

@markusfisch
Copy link
Owner

markusfisch commented Mar 29, 2020

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 🤔

@ravilov
Copy link
Author

ravilov commented Mar 29, 2020

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?

@markusfisch
Copy link
Owner

Unfortunately, yes, doing an extra pass would slow down scanning. Especially on low end devices. So I rather wouldn't do it by default.

@ravilov
Copy link
Author

ravilov commented Apr 2, 2020

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.

@aleksandrs-ledovskis
Copy link

Could the PURE_BARCODE be auto-enabled when "Restrict format" is set to MAXICODE?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants