Redth / ZXing.Net.Maui

Barcode Scanning for MAUI?
MIT License
461 stars 151 forks source link

Iphone 14 Pro Max not detecting #95

Open cpalomares opened 1 year ago

cpalomares commented 1 year ago

Android and all other iPhones can scan fine but the iPhone 14 Pro Max the camera get blurry, does anyone knows if this is a know issue. Thanks

kleberrios commented 1 year ago

I noticed the same issue. Actually, Iphone 14 Pro Max works fine if you are scanning a qrCode with fewer dots (modules) quantity. However, when the QR code has many modules, it doesn't get detected. In my case I need a qrCode with a huge data storage capacity, so didn't work. Did you find a workaround? Cannot Read CannotRead

Can Read CanRead

cpalomares commented 1 year ago

No, in the end, we decided to build the App in Flutter, I wanted to use MAUI, but the barcode scan is too slow and has issues with detected barcodes from different angles. Using ML in FLutter greatly improved Barcode and QR code detection.

peter-bozovic commented 1 year ago

I'm having the same issue with my users having iPhone 14 Pro Max The camera is clearly not able to focus the QR code while it's on reasonable distance to be scanned ! Is there any fix or workaround for this ?

@Redth Maybe the module is not using the right camera ? There is option to switch between front and back cameras, but is there any way to switch between multipe back cameras ?

KieranMaclagan commented 1 year ago

This worked for me in MAUI https://github.com/Redth/ZXing.Net.Mobile/issues/1041#issuecomment-1473647244

christianrr commented 2 months ago

For me, the trick was to select Triple or Dual Camera in first place and then set the zoom factor to VirtualDeviceSwitchOverVideoZoomFactors.First(). This way we get good scanning results for all iPhones.

// first try to use triple camera
captureDevice = devices.FirstOrDefault(x => x.DeviceType == AVCaptureDeviceType.BuiltInTripleCamera);

// then try to use dual camera
if (captureDevice == null)
   captureDevice = devices.FirstOrDefault(x => x.DeviceType == AVCaptureDeviceType.BuiltInDualCamera);

if (captureDevice == null)
   captureDevice = devices.FirstOrDefault();

...

try
{
    // try to set correct zoom factor for macro mode
    if ((captureDevice.DeviceType == AVCaptureDeviceType.BuiltInTripleCamera ||
            captureDevice.DeviceType == AVCaptureDeviceType.BuiltInDualCamera) &&
        captureDevice.VirtualDeviceSwitchOverVideoZoomFactors.Any())
        captureDevice.VideoZoomFactor =
            (float)captureDevice.VirtualDeviceSwitchOverVideoZoomFactors.First();
}
catch (Exception)
{
    // ignored
}
nmg196 commented 2 months ago

For me, the trick was to select Triple or Dual Camera in first place and then set the zoom factor to VirtualDeviceSwitchOverVideoZoomFactors.First(). This way we get good scanning results for all iPhones.


// first try to use triple camera
captureDevice = devices.FirstOrDefault(x => x.DeviceType == AVCaptureDeviceType.BuiltInTripleCamera);

..but where is captureDevice? Where are you putting this code and how did you get a reference to captureDevice?