Java Can';不要让zxing识别QR码

Java Can';不要让zxing识别QR码,java,zxing,qr-code,Java,Zxing,Qr Code,我正在开发用于解码QR码的Java应用程序,如下所示: 在下面的代码中调用reader的decode方法时,我总是得到com.google.zxing.NotFoundException public String decode(File img) throws QRCodeException { Result result; BinaryBitmap binaryBitmap; try (FileInputStream fis = new FileInputStream

我正在开发用于解码QR码的Java应用程序,如下所示: 在下面的代码中调用reader的decode方法时,我总是得到com.google.zxing.NotFoundException

public String decode(File img) throws QRCodeException {
    Result result;
    BinaryBitmap binaryBitmap;
    try (FileInputStream fis = new FileInputStream(img)) {

        Map<DecodeHintType, Object> decodeHints = new HashMap<>();
        decodeHints.put(DecodeHintType.TRY_HARDER, TRUE);
        decodeHints.put(DecodeHintType.ASSUME_GS1, TRUE);

        binaryBitmap = new BinaryBitmap(new HybridBinarizer(new BufferedImageLuminanceSource(ImageIO.read(fis))));

        MultiFormatReader reader = new MultiFormatReader();
        result = reader.decode(binaryBitmap, decodeHints);
        BarcodeFormat barcodeFormat = result.getBarcodeFormat();
        System.out.println("QR Code : " + result.getText());
        return result.getText();
    } catch (Exception ex) {
        ex.printStackTrace();
        throw new QRCodeException();
    }
}
公共字符串解码(文件img)引发QRCodeException{
结果;
二进制位图;
try(FileInputStream fis=newfileinputstream(img)){
Map decodeHits=新HashMap();
DecodeHintType.TRY_,TRUE);
DecodeHintType.Aspect_GS1,TRUE);
binaryBitmap=新的binaryBitmap(新的混合二进制程序(新的BufferedImageLuminanceSource(ImageIO.read(fis)));
MultiFormatReader=新的MultiFormatReader();
结果=reader.decode(二进制位图、解码提示);
BarcodeFormat BarcodeFormat=result.getBarcodeFormat();
System.out.println(“二维码:+result.getText());
返回result.getText();
}捕获(例外情况除外){
例如printStackTrace();
抛出新的QRCodeException();
}
}
我还尝试用Android应用程序检查这些代码。他们中的大多数人都不认识这些QR码。只有一个应用程序能给出正确的结果


你知道如何让zxing使用这些QR码吗?

这不是一个有效的QR码,至少不是根据现代规范。它是25x25,应该是版本2,但右下角没有对齐模式

我同意,这段代码很可能是过时的版本。我要读一些产品上的QR码。是否有可能强迫zxing解码与当前标准不完全兼容的代码,或者我应该寻找其他库?正如我所说的,NeoReader可以正确解码这个qr,但我需要用java PC应用程序来实现。不,它是一种不同的格式,只是看起来很相似。过去十年制造的二维码应该是新的格式,所以如果你遇到这样的码,我会感到惊讶。