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

[Feature Request]: Limit area of scanning #54

Open
Xazin opened this issue Dec 23, 2021 · 3 comments
Open

[Feature Request]: Limit area of scanning #54

Xazin opened this issue Dec 23, 2021 · 3 comments

Comments

@Xazin
Copy link

Xazin commented Dec 23, 2021

Description:
The use case for this is to narrow down the area of focus, so blur out the top and bottom of the preview, and have an area in the middle (horizontally) where the barcode scanning can happen. This makes it easier to not scan barcodes that are in the immediate area. Blurring out the top and the bottom of the preview is not an issue, the issue is how to make the scanner only read within a set of pixels, etc.

Maybe onScan can return the coordinates of the scan or similar, and based on this we can implement the check ourselves. This should be possible for both iOS and Android.

I'm not sure what else to add here haha, please let me know if you want more information.

@dustin-graham
Copy link
Collaborator

I think this is a duplicate of #20 . I have a PR open for the develop branch that could probably be used to accomplish this request. See #55

@dustin-graham
Copy link
Collaborator

@jhoogstraat , while working on #57 , I discovered an unexpected behavior of AVFoundation. see: https://developer.apple.com/library/archive/technotes/tn2325/_index.html

I noticed that when I combined 2D and 1D barcode types, AVFoundation had trouble recognizing the 1D barcodes. This document explains that when AVFoundation is configured to look for both 2D and 1D barcodes simultaneously it will only recognize them if they are in the center of the scan area. This document is rather old, but after extensive testing I can confirm the behavior still exists on an iPhone 12.

The result of this is confusing behavior, especially for my specific use cases. I think it will be necessary for me to have an "area of interest" defined in the scan area so that my users understand what they need to do. Because of this, I will be implementing this feature in the next day or two and I'll submit a PR for it.

@jhoogstraat
Copy link
Owner

jhoogstraat commented Jan 12, 2022

AVFoundation is just as old as the document, so this might very well be still true. You can, however, try to use Vision instead of AVFoundation to scan barcodes (right here).

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