为了账号安全,请及时绑定邮箱和手机立即绑定

如果解析带有logo的总报错

com.google.zxing.NotFoundException
	try {			MultiFormatReader multiFormatReader = new MultiFormatReader();						File file = new File("D:/jar/jk.jpg");						BufferedImage image =  ImageIO.read(file);			Map<DecodeHintType, Object> tmpHintsMap = new EnumMap<DecodeHintType, Object>(			        DecodeHintType.class);			// 解码设置编码方式为:utf-8,			tmpHintsMap.put(DecodeHintType.CHARACTER_SET, "utf-8");			//优化精度			tmpHintsMap.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);			//复杂模式,开启PURE_BARCODE模式			tmpHintsMap.put(DecodeHintType.PURE_BARCODE, Boolean.TRUE);						BinaryBitmap binaryBitmap = new BinaryBitmap(new HybridBinarizer(new BufferedImageLuminanceSource(image)));			Result result = multiFormatReader.decode(binaryBitmap, tmpHintsMap);			System.out.println("二维码内容 : " +result.toString());			System.out.println("二维码格式 : " +result.getBarcodeFormat());			System.out.println("二维码文本 : " +result.getText());		} catch (NotFoundException e) {			// TODO Auto-generated catch block			e.printStackTrace();		} catch (IOException e) {			// TODO Auto-generated catch block			e.printStackTrace();		}

网上搜了 说是设置那几个属性  设置了还是报错   图片是我手机拍的 然后进行截图解析

https://img1.sycdn.imooc.com//5c2193660001c05910801104.jpg

正在回答

1 回答

图片不清楚可能会导致解析时将logo也看成二维码的黑条一起解析。

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

如果解析带有logo的总报错

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号