Java 尽管qr可扫描,但MultiFormatReader无法读取qr

Java 尽管qr可扫描,但MultiFormatReader无法读取qr,java,android,image-processing,qr-code,zxing,Java,Android,Image Processing,Qr Code,Zxing,我附加的qr图像是可扫描的(使用ZXingScannerView(android的github库)或其他qr代码扫描应用程序),但当我从存储器中选择该图像进行扫描时,MultiFormatReader会给出NotFoundException。我只想从存储器中扫描二维码。二维码图像的质量几乎与我所附的图像相同 我尝试了下面的代码,它给出了NotFoundException public static String scanQRImage(Bitmap bMap) { String content

我附加的qr图像是可扫描的(使用ZXingScannerView(android的github库)或其他qr代码扫描应用程序),但当我从存储器中选择该图像进行扫描时,MultiFormatReader会给出NotFoundException。我只想从存储器中扫描二维码。二维码图像的质量几乎与我所附的图像相同

我尝试了下面的代码,它给出了NotFoundException

public static String scanQRImage(Bitmap bMap) {
String contents = null;

 if (bMap.getHeight() > 500 && bMap.getWidth() > 500)
     bMap = Bitmap.createScaledBitmap(bMap, bMap.getWidth() - 300, bMap.getHeight() - 300, false);

 int[] intArray = new int[bMap.getWidth() * bMap.getHeight()];

 //copy pixel data from the Bitmap into the 'intArray' array
 bMap.getPixels(intArray, 0, bMap.getWidth(), 0, 0, bMap.getWidth(), bMap.getHeight());

 LuminanceSource source = new RGBLuminanceSource(bMap.getWidth(), bMap.getHeight(), intArray);
 BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));

 Reader reader = new MultiFormatReader();
 Map<DecodeHintType, Object> tmpHintsMap = new EnumMap<>(
         DecodeHintType.class);
 tmpHintsMap.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
 tmpHintsMap.put(DecodeHintType.POSSIBLE_FORMATS,
         EnumSet.allOf(BarcodeFormat.class));
 tmpHintsMap.put(DecodeHintType.PURE_BARCODE, Boolean.TRUE);
 try {
     Result result = reader.decode(bitmap, tmpHintsMap);
     contents = result.getText();
 } catch (Exception e) {
     Log.e("QrTest", "Error decoding barcode", e);
 }
 return contents;
} 

公共静态字符串scanQRImage(位图bMap){
字符串内容=null;
如果(bMap.getHeight()>500&&bMap.getWidth()>500)
bMap=Bitmap.createScaledBitmap(bMap,bMap.getWidth()-300,bMap.getHeight()-300,false);
int[]intArray=new int[bMap.getWidth()*bMap.getHeight()];
//将位图中的像素数据复制到“intArray”数组中
bMap.getPixels(intArray,0,bMap.getWidth(),0,0,bMap.getWidth(),bMap.getHeight());
亮度源=新的RGBLuminanceSource(bMap.getWidth(),bMap.getHeight(),intArray);
BinaryBitmap位图=新的BinaryBitmap(新的混合二进制程序(源));
Reader=新的多格式处理程序();
Map tmpHintsMap=新枚举映射(
DecodeHintType.class);
tmpHintsMap.put(DecodeHintType.TRY_,Boolean.TRUE);
tmpHintsMap.put(DecodeHintType.mable_格式,
allOf(BarcodeFormat.class));
tmpHintsMap.put(DecodeHintType.PURE_条形码,布尔值.TRUE);
试一试{
结果=reader.decode(位图、tmpHintsMap);
contents=result.getText();
}捕获(例外e){
Log.e(“QrTest”,“错误解码条形码”,e);
}
返回内容;
} 
再一次用简单的话来说。我想扫描存储中存在的有点扭曲的二维码图像。 请帮忙