juliansteenbakker / mobile_scanner

A universal scanner for Flutter based on MLKit. Uses CameraX on Android and AVFoundation on iOS.
BSD 3-Clause "New" or "Revised" License
756 stars 446 forks source link

Samsung Galaxy A23 wrong scan area #604

Open p3pp8 opened 1 year ago

p3pp8 commented 1 year ago

It seems that the detection area is located at the upper right screen edge and that it is very small, infact to detect codes i have to put the camera backward enough to reduce the framed code size and move it to the upper right screen edge.

InkedScreenshot_20230422_095609_DropPay Stage

p3pp8 commented 1 year ago

Just tested using the scanWindow attribute but seems to be ignored.

p3pp8 commented 1 year ago

Fixed uncommenting this line in MobileScanner.kt inside method start():

analysisBuilder.setTargetResolution(Size(1440, 1920))

I've tried out many resolutions and it always do the job, so i guess, for certain devices, target resolution for analysis builder must always be set.

p3pp8 commented 1 year ago

This one solves the problem without any aspect ratio issue, no need to set target resolution anymore:

       val camProfile = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH)
           analysisBuilder.setDefaultResolution(Size(camProfile.videoFrameWidth, camProfile.videoFrameHeight))

I don't know if this is the right solution but in my case i've tested many devices and everything seems working as aspected.

I've updated many times this comment, i finally discovered that just setting the default resolution solves the issue.

danielleung30 commented 1 year ago

Did you tested on ios device?

p3pp8 commented 1 year ago

@danielleung30 Yes, it works seamlessly. The issue affects only certain Android devices like Galaxy A22 and A23, but i think many others...

danielleung30 commented 1 year ago

Thank you bro, you save the day

rpelant commented 9 months ago

Hello, any news on this? When this issue will be resolved? Having the same symptoms reading QR code on A23.

juliansteenbakker commented 9 months ago

I am working on an updated version of #612 which should fix this issue

nirbar89 commented 7 months ago

Any one test version 3.5.1

p3pp8 commented 7 months ago

Just tested version 3.5.1, nothing to do, the issue is, unfortunately, still there !!!

WelliRigo commented 3 months ago

Tested on 4.0.0 and the issue is still there

rpelant commented 3 months ago

Issue is easily resolved setting cameraResolution in MobileScannerController to some reasonable value , for example 1024, 768

WelliRigo commented 3 months ago

Yes, but... still an issue. Also setting the resolution has other implications

burekas7 commented 1 month ago

Hi, Any update here?

p3pp8 commented 1 month ago

The author of this plugin already managed to solve this issue, just set a 4:3 cameraResolution when constructing MobileScannerController.

    final _scannerController = MobileScannerController(
      // 24MPix with an aspect of 4:3 
      cameraResolution: const Size(6080, 8096),
    );

Feel free to set a higher resolution, if not available it will be set using the nearest one.

Hope this will be useful!