Android ZXing条形码阅读器不解码某些条形码
我正在用Xamarin.Forms开发条形码阅读器。我正试图在Android设备上扫描图像 首先,我使用Xamarin.Essentials MediaPicker从图库中选择图像,并从该图像的路径中获得一个带有依赖类的RGBLuminance 然后我尝试用ZXing BarcodeReaderGeneric类的解码方法来解码这个RGBLuminance 该应用程序成功地解码了一些图像中的条形码。但是,有时在解码时返回null。我可能在将图像转换为位图或创建RGBLuminanceSource时出错 我想了解一个可以解码彩色、黑白和灰度图像的类应该是怎样的 公共RGBLuminanceSource GetRGBLuminanceSourcestring图像路径 { 如果File.ExistsimagePath { Android.Graphics.Bitmap Bitmap=BitmapFactory.DecodeFileimagePath; List rgbBytesList=新列表; 对于int y=0;yAndroid ZXing条形码阅读器不解码某些条形码,android,xamarin,zxing,android-bitmap,zxing.net,Android,Xamarin,Zxing,Android Bitmap,Zxing.net,我正在用Xamarin.Forms开发条形码阅读器。我正试图在Android设备上扫描图像 首先,我使用Xamarin.Essentials MediaPicker从图库中选择图像,并从该图像的路径中获得一个带有依赖类的RGBLuminance 然后我尝试用ZXing BarcodeReaderGeneric类的解码方法来解码这个RGBLuminance 该应用程序成功地解码了一些图像中的条形码。但是,有时在解码时返回null。我可能在将图像转换为位图或创建RGBLuminanceSource时
我在xamarin.android中使用此代码,我从未遇到过问题:
var scanner = new MobileBarcodeScanner();
var result = await scanner.Scan(_context, MobileBarcodeScanningOptions.Default);
它打开相机,用户拍摄条形码图片和结果。文本包含扫描的条形码。我想解码我从图库中选择的图像。不是从相机上看的。我没有彩色条形码。但此回复中的示例适用于空白条形码。请检查我以前做过的类似线程。