无法解码QRCode
|
我已经尝试解码QR码很多天了,并且能够解码免费应用程序和东西产生的QR码。问题是当我尝试使用从相机拍摄的图像时,图像可能会模糊,多余的内容,以微小的角度捕获,我无法对其进行解码。
注意:我不想使用这种意图来调用现有的条形码阅读器。
Bitmap bmap=BitmapFactory.decodeResource(getResources(),R.drawable.qrImage);
LuminanceSource source = new RGBLuminanceSource(bmap);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
QRCodeReader reader = new QRCodeMultiReader();
try{
Hashtable<DecodeHintType, Object> hints = new Hashtable<DecodeHintType, Object>();
hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
Result result = reader.decode(bitmap, hints);
TextView tv= (TextView) findViewById(R.id.tv1);
tv.setText(result.getText());
}catch(Exception e)
{
e.printStackTrace();
}
没有找到相关结果
已邀请:
1 个回复
信藉乒