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
807 stars 471 forks source link

Feature request: Customize analysis/preview camera resolution #674

Closed nblum37 closed 10 months ago

nblum37 commented 1 year ago

Hi,

for especially bigger QR-Codes the package struggles to detect them. Currently, the internal analysis and preview resolution are not bound to any constraints or suggestions. At most of the testest smartphones, this can lead to an internal camera resolution of 640 x 480, being too small to detect the high-density QR-Codes. It would be nice to have a way to suggest a resolution like the ones recommended in the MLKit documentation. I would really appreciate it if someone would consider this feature request. Own attempts to create a PR failed due to strange aspect ratio behavior of the preview.

EArminjon commented 11 months ago

This feature could fix https://github.com/juliansteenbakker/mobile_scanner/issues/749 Could also be a real fix for this ticket which got closed without real fix : https://github.com/juliansteenbakker/mobile_scanner/issues/313

gigafunk commented 11 months ago

i can see it being the a possible fix for (https://github.com/juliansteenbakker/mobile_scanner/issues/645)

Theory is (you should skip this if you value your time) the difference in aspect ratio from ios camera (16:9 for my test device) to the aspect ratio of 640 x 480 (4:3) interface in a way to cause the perceived barcode image ratios to be way out of the limits (far to long for the height, making the low height codes way too long) for the barcodes the ml kit was trained on. Turning the phone 90 degrees will shift the ratio warp the other direction , making the low height barcode taller and more in line with the mlkit training data.

okok dumb theory, supposedly my 6s native cam resolution is 640X480. I dunno , thats the stills, maybe its using the video camera and its 16:9?

I am making this all up, but I have myself convinced. I don't even need a preview, it would be nice just to have it default to 1280x720 or even a lower one, 640x360, or 960x540, anything 16:9 would probably improve all these little weird issues.