请教个问题:一张图片当中在不固定位置包含有条形码,怎么读取条形码出来呢?怎么读取一张图片中的多个条形码?用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); }
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥50 有数据,怎么建立模型求影响全要素生产率的因素
- ¥50 有数据,怎么用matlab求全要素生产率
- ¥15 TI的insta-spin例程
- ¥15 完成下列问题完成下列问题
- ¥15 C#算法问题, 不知道怎么处理这个数据的转换
- ¥15 YoloV5 第三方库的版本对照问题
- ¥15 请完成下列相关问题!
- ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
- ¥15 求daily translation(DT)偏差订正方法的代码
- ¥15 js调用html页面需要隐藏某个按钮