我使用zxing來解碼QR碼圖像,但它總是返回一個NotFoundException。在http://zxing.org/w/decode.jspx在線解碼器掃描這些圖像非常好,所以它應該能夠在我的應用程序中這樣做。 我使用此代碼:Android zxing NotFoundException
String path = Environment.getExternalStorageDirectory().getPath()+"/QRPictures/QRTest.bmp";
Bitmap bmp = BitmapFactory.decodeFile(path);
int[] pixels = new int[bmp.getWidth()*bmp.getHeight()];
bmp.getPixels(pixels, 0, bmp.getWidth(), 0, 0, bmp.getWidth(), bmp.getHeight());
LuminanceSource source = new RGBLuminanceSource(bmp.getWidth(), bmp.getHeight(), pixels);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
Reader reader = new MultiFormatReader();
try {
Result result = reader.decode(bitmap);
String contents = result.getText();
Log.d(TAG, content);
} catch (NotFoundException e) {
Log.d(TAG, "NFE");
} catch (ChecksumException e) {
Log.d(TAG, "CSE");
} catch (FormatException e) {
Log.d(TAG, "FE");
}
你能幫忙嗎?
我還是得到了NotFoundException,即使TRY_HARDER – user2093946 2013-02-21 12:08:09