【问题标题】:decode qrcode using zxing使用 zxing 解码 qrcode
【发布时间】:2013-11-01 22:31:54
【问题描述】:

我正在尝试从图像中解码二维码,但 zxing 返回未找到异常 用我的手机从屏幕上扫描的同一张图像成功解码:如何提高此文件的质量以允许通过 zxing(或其他 java 库)对其进行解码 我没有声誉,所以我无法上传图片:示例图片在地址 上一个链接已编辑

我正在尝试使用以下代码对其进行解码

Reader xReader = new QRCodeReader();

BufferedImage dest = ImageIO.read(imgFile);
LuminanceSource source = new BufferedImageLuminanceSource(dest);

BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
Vector<BarcodeFormat> barcodeFormats = new Vector<>();
barcodeFormats.add(BarcodeFormat.QR_CODE);

HashMap<DecodeHintType, Object> decodeHints = new HashMap<>(3);
decodeHints.put(DecodeHintType.POSSIBLE_FORMATS, barcodeFormats);

decodeHints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);

Result result = null;
result = xReader.decode(bitmap, decodeHints);

【问题讨论】:

    标签: java zxing


    【解决方案1】:

    是噪音。不要抖动到 1 位单色,或者应用光模糊滤镜。

    【讨论】:

    • 我在哪里抖动到单色?我不知道该怎么做:我以前从未在 java 下管理过图像。你能帮我举个例子吗?
    • 我已经研究并搜索了一些关于模糊图像的内容,它确实有效!谢谢
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-22
    • 2014-06-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多