fast_barcode_scanner
fast_barcode_scanner copied to clipboard
Specifies a rectangle of interest for limiting the search area for visual metadata
Can we add this function?Now it's full screen available.
I know that AVFoundation supports a rect of interest, but what would that look like with ML Kit?
What do you think about a per-type rect of interest? The aspect ratio of the code dictates the aspect ratio of the rect of interest.
Sounds good. Anyway, I think it's strange to show a rectangle but full screen available ,right?
Yes, but implementing this is not trivial. Especially if we take rotation into consideration. On Android we may need to crop the image before scanning. iOS provides a rectOfInterest parameter at least.
Hey! I was also looking into way of implementing this. @jhoogstraat Do you have any ideas for a workaround?
Android lib has this method available: com.google.mlkit.vision.barcode.Barcode.getBoundingBox. So, in theory, rectOfInterest can be defined and then once barcode gets scanned, we can check if it's inside the rectOfInterest and drop it if it's not.
But that it's too much trouble to do on Android... can you think of other workarounds? Thanks!
I thought about cropping the image before feeding it into the detector. Maybe this could also improve performance, but I am not sure on that.
How would the api on the dart side look like? How is a RectOfInterest defined?
We could
- Use an enum with value along the lines of square / landscape
- Use a
Rectwith values between 0.0 and 1.0 for fine control, just like Apple does
I'd vote for the second option. It seems more flexible
If on iOS it is relatively easy, can you maybe, as quick fix, push this option only for one platform?
Yeah, implementing it for iOS is good for now on v2. Android can come later.
If #55 by @dustin-graham is merged then, this could be done at Flutter side, no need to worry on the Native Part