0
我一直試圖解碼QR碼多天,並已能夠解碼由免費應用程序和東西生成的QR碼。問題是,當我嘗試使用從相機可以模糊,有額外的內容,捕捉在一個小角度,我無法解碼他們。無法解碼QRCode
注意:我不想使用意圖調用現有的條形碼閱讀器。
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();
}
這應該是coment – PedroAGSantos 2011-05-26 09:23:34
嗨,非常感謝您的幫助..它爲我工作 – scofield 2011-06-06 07:22:38