Open G00fY2 opened 2 years ago
Specifying area is not supported currently, can you try to filter out the result instead that not located in your interested area?
@zhouyiself Hi ! Here's our use case - you might have 10 codes in close proximity (imagine a shelf full of boxes with QR codes on them). Flagship phones are so fast at scanning you get back say 5-6 codes very quickly if the phone has some of those QR codes visible. The user only wants the code in the center of the scan area, even though 5 other codes may be visible on the camera view.
There's no way of saying these other 5 codes we don't want, so we have to tell our users, on Android to make sure the phone is very close to the QR code then gradually move the phone back until the QR code scans.
I have an app with both iOS and Android versions, and the android version has a usability flaw as a result of this. I would greatly appreciate if this feature could be added. [ iOS there is the option, and we use it, to crop part of the camera view]
I'm sure there's dozens to hundreds of other developers out there that would love this...
Well i would like it, because it would reduce the calculation and therefore the energy usage, because we are required to process lots of codes every day.
Any update here, we would really appreciate this functionality, thank you!
Certainly the need is definitely present within our app, at this point I'm close to rewriting that part and looking for alternatives to MLKit..
@RowanH Dear Rowan, did you found any alternatives or a solution with MLKit? Have the same problem. Thank you very much!
any updates yall ?
What's your feature request? Please describe. We are using the ML Kit barcode-scanning library in conjunction with CameraX ImageAnalysis.Analyzer. There is currently no sufficient way to limit the area in which ML Kit should search for the barcode (basically making sure the barcode result is inside the preview bounds). E.g. even if [cropRect ](https://developer.android.com/reference/android/media/Image#getCropRect()) is set, ML Kit will scan the whole image for barcodes. This way the users can't point the camera at a specific barcode without scanning all barcodes which are visible to the camera.
Mobile environment Android 12 androidx.camera:camera-camera2 1.0.2 com.google.mlkit:barcode-scanning 17.0.2
Additional context
234 was closed without any updates for over 15 month.
There is no sample to achieve such a common usecase in the vision-quickstart sample project.
In the material-showcase sample project the logic about detecting if the result is inside the overlay starts here: https://github.com/googlesamples/mlkit/blob/5c35770350546244957e35f845e36c077bf21ffd/android/material-showcase/app/src/main/java/com/google/mlkit/md/barcodedetection/BarcodeProcessor.kt#L58
But this requires a custom GraphicOverlay class which on the other hand depends on a complex CameraSource class which are all build on top of the deprecated default Android Camera framework.
There are suggestions on SO which rely on complex and errorprone bitmap preprocessing.
So in the end there is no developer friendly and reliable way of checking the barcode bounds with the CameraX previous bounds.