fast_barcode_scanner icon indicating copy to clipboard operation
fast_barcode_scanner copied to clipboard

Specifies a rectangle of interest for limiting the search area for visual metadata

Open git2321231 opened this issue 4 years ago • 11 comments

Can we add this function?Now it's full screen available.

git2321231 avatar Jul 05 '21 05:07 git2321231

I know that AVFoundation supports a rect of interest, but what would that look like with ML Kit?

jhoogstraat avatar Jul 05 '21 09:07 jhoogstraat

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.

jhoogstraat avatar Jul 09 '21 08:07 jhoogstraat

Sounds good. Anyway, I think it's strange to show a rectangle but full screen available ,right?

git2321231 avatar Jul 09 '21 08:07 git2321231

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.

jhoogstraat avatar Jul 21 '21 19:07 jhoogstraat

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!

rsi2m avatar Sep 27 '21 19:09 rsi2m

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.

jhoogstraat avatar Sep 28 '21 07:09 jhoogstraat

How would the api on the dart side look like? How is a RectOfInterest defined?

We could

  1. Use an enum with value along the lines of square / landscape
  2. Use a Rect with values between 0.0 and 1.0 for fine control, just like Apple does

jhoogstraat avatar Oct 20 '21 20:10 jhoogstraat

I'd vote for the second option. It seems more flexible

rsi2m avatar Oct 21 '21 06:10 rsi2m

If on iOS it is relatively easy, can you maybe, as quick fix, push this option only for one platform?

rtokun avatar Oct 31 '21 08:10 rtokun

Yeah, implementing it for iOS is good for now on v2. Android can come later.

jhoogstraat avatar Oct 31 '21 09:10 jhoogstraat

If #55 by @dustin-graham is merged then, this could be done at Flutter side, no need to worry on the Native Part

toufeeqahamedns avatar Jan 09 '22 15:01 toufeeqahamedns