-
Notifications
You must be signed in to change notification settings - Fork 67
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
Comments
@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. |
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). |
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.
The text was updated successfully, but these errors were encountered: