ZXing.Net.Mobile: Unable to read large QR Codes with Xamarin
Hello All,
I’ve implemented the Zxing library into a Xamarin Forms application. And most devices struggle to decode large QR Codes (see first comment for example size). This also seems to be the case for other APIs such as Google’s Vison API. So, I can’t figure out if it is due to the library or the Xamarin framework…
However, here is my implementation:
Library versions:
- Zxing.net.Mobile: 2.2.9
- Xamarin-forms: 2.3.4.270 and Xamarin-forms: 2.4.0.18342
Here are the different methods I’ve implemented:
var options = new ZXing.Mobile.MobileBarcodeScanningOptions
{
PossibleFormats = new List<ZXing.BarcodeFormat>
{
ZXing.BarcodeFormat.QR_CODE
},
TryHarder = false,
AutoRotate = false,
TryInverted = false
};
var scanner = new ZXing.Mobile.MobileBarcodeScanner
{
TopText = "Up",
BottomText = "Down"
};
var data = await scanner.Scan(options);
// The await never finishes
TaskCompletionSource<string> scanCompletion = new TaskCompletionSource<string>();
var options = new ZXing.Mobile.MobileBarcodeScanningOptions
{
PossibleFormats = new List<ZXing.BarcodeFormat>
{
ZXing.BarcodeFormat.QR_CODE
},
TryHarder = false,
AutoRotate = false,
TryInverted = false,
};
var scanPage = new ZXingScannerPage(options);
scanPage.AutoFocus();
scanPage.Title = "QR Code";
scanPage.OnScanResult += (result) =>
{
try
{
Android.Util.Log.Error("ZXING", "Barcode!!!!");
scanCompletion.SetResult(result.Text);
}
catch(Exception excep)
{
Android.Util.Log.Error("ZXING", excep.Message);
Android.Util.Log.Error("ZXING", excep.StackTrace);
}
}; // This is never called
await App.Navigation.PushAsync(scanPage);
var resultQr = await scanCompletion.Task;
await DisplayAlert("QR Code", resultQr, "OK");
await App.Navigation.PopAsync();
I’m aware of #278 and the application isn’t crashing, only not scanning. The app is built without arm64-v8a.
I’ve attached the logs of when the application is running. (The NullReferenceException at the end is not important. I don’t catch anything if the user force quits the scanner with the back key. Only a test app at the moment)
Thanks.
Peter.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 16 (6 by maintainers)
Commits related to this issue
- Backend: serialized caches put on a diet as well This makes the cache of transactions be smaller in size. List of things done to achieve this: - Only include balances of read only accounts (we don'... — committed to nblockchain/geewallet by knocte 6 years ago
- Backend: serialized caches put on a diet as well This makes the cache of transactions be smaller in size. List of things done to achieve this: - Only include balances of read only accounts (we don'... — committed to nblockchain/geewallet by knocte 6 years ago
- Backend: serialized caches put on a diet as well This makes the cache of transactions be smaller in size. List of things done to achieve this: - Only include balances of read only accounts (we don'... — committed to nblockchain/geewallet by knocte 6 years ago
- Frontend.XF(.*): set of paranoid measures to try to fix big QRcode scan I'm having a lot of problems when testing the recently committed feature (previous commit) of scanning a QR code of a transacti... — committed to nblockchain/geewallet by knocte 6 years ago
If this helps out:
This is how I crop to the middle 512x512 image of the raw NV21 image in Android. This is in the CameraAnalyzer class.