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

Issue with Zxing Embedded Continuous QR Code Scanning #746

Open
gauravk1 opened this issue Jan 31, 2024 · 2 comments
Open

Issue with Zxing Embedded Continuous QR Code Scanning #746

gauravk1 opened this issue Jan 31, 2024 · 2 comments

Comments

@gauravk1
Copy link

I'm currently using Zxing Embedded for QR code scanning in continuous mode. However, I'm encountering an issue where it scans randomly from various patterns, including clothes and other non-QR code elements. Has anyone else experienced this problem, and if so, could you please share any solutions or suggestions to fix this issue?

barcodeScannerView = findViewById(R.id.scanner_view);
        Collection<BarcodeFormat> formats = Arrays.asList(BarcodeFormat.QR_CODE, BarcodeFormat.CODE_39);
        barcodeScannerView.getBarcodeView().setDecoderFactory(new DefaultDecoderFactory(formats));
        barcodeScannerView.initializeFromIntent(getIntent());
        barcodeScannerView.setStatusText("");
        beepManager = new BeepManager(this);
        barcodeScannerView.setBackgroundColor(ContextCompat.getColor(this, R.color.white));
        barcodeScannerView.decodeContinuous(callback);
        CameraSettings cameraSettings = new CameraSettings();
        cameraSettings.setFocusMode(CameraSettings.FocusMode.AUTO);
        cameraSettings.setAutoTorchEnabled(false);
        if (mSession.getIs_top_camera_enabled().equals("1")) {
            cameraSettings.setRequestedCameraId(1); // or CAMERA_FRONT or specific camera id
        } else {
            cameraSettings.setRequestedCameraId(0); // or CAMERA_BACK or specific camera id
        }
        barcodeScannerView.setCameraSettings(cameraSettings);

Thank you in advance for your help! Gaurav Kapoor

@rkistner
Copy link
Member

That's the CODE_39 format that unfortunately has many false detections with the current zxing:core algorithm.

The only workarounds I have right now:

  1. Disable CODE_39 completely if you don't need it.
  2. If you do need it but only scan specific barcodes, see if you can validate the barcode before proceeding, e.g. checking that the length matches.

@gauravk1
Copy link
Author

Thanks, @rkistner, but we need to scan both QR Codes and Barcodes, and the length is not specific.

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

2 participants