请教个问题:一张图片当中在不固定位置包含有条形码,怎么读取条形码出来呢?怎么读取一张图片中的多个条形码?用zxing读取图片当中的条形码,报错com.google.zxing.NotFoundException。有大神知道的吗?谢谢
2条回答 默认 最新
save4me 2015-01-22 05:48关注参考
zxing二维码扫描的流程简析(Android版)
Java Code Examples for com.google.zxing.DecodeHintType
Reading QRCode with Zxing in Java
设置一下TryHarder和PossibleFormats看一下public static List<string> ScanForBarcodes(string path) { return ScanForBarcodes(new Bitmap(path)); } public static List<string> ScanForBarcodes(Bitmap bitmap) { // initialize a new Barcode reader. BarcodeReader reader = new BarcodeReader { TryHarder = true, // TryHarder is slower but recognizes more Barcodes PossibleFormats = new List<BarcodeFormat> // in the ZXing There is an Enum where all supported barcodeFormats were contained { BarcodeFormat.CODE_128, BarcodeFormat.QR_CODE, //BarcodeFormat. ... ; } }; return reader.DecodeMultiple(bitmap).Select(result => result.Text).ToList(); // return only the barcode string. // If you want the full Result use: return reader.DecodeMultiple(bitmap); }本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报