有关用zxing二维码解析问题,异常com.google.zxing.NotFoundException

qq_35942223 2018-10-25 12:37:47
二维码地址为https://hello-1251822332.cosgz.myqcloud.com/42b0b8a4db194e8cbc048dd7c1b86f0e.png,网上例子只有部分能解析出来,但是在https://zxing.org/w/decode.jspx是可以解析的
...全文
2658 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
没事玩起凡 2019-06-25
  • 打赏
  • 举报
回复
引用 6 楼 向鹏 的回复:
建议提高精度和复杂模式开启 //精度 hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE); //复杂模式 hints.put(DecodeHintType.PURE_BARCODE, Boolean.TRUE);
niubility,这样改了之后就可以了
向鹏 2019-03-05
  • 打赏
  • 举报
回复
建议提高精度和复杂模式开启
//精度
hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
//复杂模式
hints.put(DecodeHintType.PURE_BARCODE, Boolean.TRUE);
qq_35942223 2018-10-25
  • 打赏
  • 举报
回复
引用 4 楼 qq_40224672 的回复:
[quote=引用 3 楼 qq_35942223 的回复:] [quote=引用 1 楼 qq_40224672 的回复:] https://www.cnblogs.com/zhangzhen894095789/p/6623041.html 这个试过了 可以解析出你发的二维码

        String filePath = "D://42b0b8a4db194e8cbc048dd7c1b86f0e.png";  
        BufferedImage image;  
        try {  
            image = ImageIO.read(new File(filePath));  
            LuminanceSource source = new BufferedImageLuminanceSource(image);  
            Binarizer binarizer = new HybridBinarizer(source);  
            BinaryBitmap binaryBitmap = new BinaryBitmap(binarizer);  
            Map<DecodeHintType, Object> hints = new HashMap<DecodeHintType, Object>();  
            hints.put(DecodeHintType.CHARACTER_SET, "UTF-8");  
            Result result = new MultiFormatReader().decode(binaryBitmap, hints);// 对图像进行解码  
            System.out.println("图片中内容:  "+ result.getText());  
            System.out.println("图片中格式:   " + result.getBarcodeFormat()); 
        } catch (Exception e) {
        	e.printStackTrace();  
		} 
不行报异常com.google.zxing.NotFoundException[/quote] 我读取出结果为 图片中内容: https://mp.weixin.qq.com/a/~~gCVgnnd4E5w~q_TnEgzUbKnwYldWESuoAA~~ 图片中格式: QR_CODE 使用的jar :core-3.3.3.jar javase-3.3.3.jar[/quote] 可以了,是我包版本低
枫舞蝶刺 2018-10-25
  • 打赏
  • 举报
回复
引用 3 楼 qq_35942223 的回复:
[quote=引用 1 楼 qq_40224672 的回复:]
https://www.cnblogs.com/zhangzhen894095789/p/6623041.html

这个试过了 可以解析出你发的二维码

String filePath = "D://42b0b8a4db194e8cbc048dd7c1b86f0e.png";
BufferedImage image;
try {
image = ImageIO.read(new File(filePath));
LuminanceSource source = new BufferedImageLuminanceSource(image);
Binarizer binarizer = new HybridBinarizer(source);
BinaryBitmap binaryBitmap = new BinaryBitmap(binarizer);
Map<DecodeHintType, Object> hints = new HashMap<DecodeHintType, Object>();
hints.put(DecodeHintType.CHARACTER_SET, "UTF-8");
Result result = new MultiFormatReader().decode(binaryBitmap, hints);// 对图像进行解码
System.out.println("图片中内容: "+ result.getText());
System.out.println("图片中格式: " + result.getBarcodeFormat());
} catch (Exception e) {
e.printStackTrace();
}

不行报异常com.google.zxing.NotFoundException[/quote]
我读取出结果为
图片中内容: https://mp.weixin.qq.com/a/~~gCVgnnd4E5w~q_TnEgzUbKnwYldWESuoAA~~
图片中格式: QR_CODE

使用的jar :core-3.3.3.jar javase-3.3.3.jar
qq_35942223 2018-10-25
  • 打赏
  • 举报
回复
引用 1 楼 qq_40224672 的回复:
https://www.cnblogs.com/zhangzhen894095789/p/6623041.html 这个试过了 可以解析出你发的二维码

        String filePath = "D://42b0b8a4db194e8cbc048dd7c1b86f0e.png";  
        BufferedImage image;  
        try {  
            image = ImageIO.read(new File(filePath));  
            LuminanceSource source = new BufferedImageLuminanceSource(image);  
            Binarizer binarizer = new HybridBinarizer(source);  
            BinaryBitmap binaryBitmap = new BinaryBitmap(binarizer);  
            Map<DecodeHintType, Object> hints = new HashMap<DecodeHintType, Object>();  
            hints.put(DecodeHintType.CHARACTER_SET, "UTF-8");  
            Result result = new MultiFormatReader().decode(binaryBitmap, hints);// 对图像进行解码  
            System.out.println("图片中内容:  "+ result.getText());  
            System.out.println("图片中格式:   " + result.getBarcodeFormat()); 
        } catch (Exception e) {
        	e.printStackTrace();  
		} 
不行报异常com.google.zxing.NotFoundException
qq_35942223 2018-10-25
  • 打赏
  • 举报
回复
引用 1 楼 qq_40224672 的回复:
https://www.cnblogs.com/zhangzhen894095789/p/6623041.html 这个试过了 可以解析出你发的二维码

        String filePath = "D://42b0b8a4db194e8cbc048dd7c1b86f0e.png";  
        BufferedImage image;  
        try {  
            image = ImageIO.read(new File(filePath));  
            LuminanceSource source = new BufferedImageLuminanceSource(image);  
            Binarizer binarizer = new HybridBinarizer(source);  
            BinaryBitmap binaryBitmap = new BinaryBitmap(binarizer);  
            Map<DecodeHintType, Object> hints = new HashMap<DecodeHintType, Object>();  
            hints.put(DecodeHintType.CHARACTER_SET, "UTF-8");  
            Result result = new MultiFormatReader().decode(binaryBitmap, hints);// 对图像进行解码  
            System.out.println("图片中内容:  "+ result.getText());  
            System.out.println("图片中格式:   " + result.getBarcodeFormat()); 
        } catch (Exception e) {
        	e.printStackTrace();  
		} 
不行啊
枫舞蝶刺 2018-10-25
  • 打赏
  • 举报
回复
https://www.cnblogs.com/zhangzhen894095789/p/6623041.html

这个试过了 可以解析出你发的二维码

String filePath = "D://42b0b8a4db194e8cbc048dd7c1b86f0e.png";
BufferedImage image;
try {
image = ImageIO.read(new File(filePath));
LuminanceSource source = new BufferedImageLuminanceSource(image);
Binarizer binarizer = new HybridBinarizer(source);
BinaryBitmap binaryBitmap = new BinaryBitmap(binarizer);
Map<DecodeHintType, Object> hints = new HashMap<DecodeHintType, Object>();
hints.put(DecodeHintType.CHARACTER_SET, "UTF-8");
Result result = new MultiFormatReader().decode(binaryBitmap, hints);// 对图像进行解码
System.out.println("图片中内容: "+ result.getText());
System.out.println("图片中格式: " + result.getBarcodeFormat());
} catch (Exception e) {
e.printStackTrace();
}

67,550

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧