我目前正在開發一個掃描器讀取一個圖像中發現多個QR碼一個圖像讀取多個QR碼。 我設法讀取圖像中的QR碼,但它給我不一致的結果。假設圖像中有4個QR碼,有時我可以讀取2個,有時可以讀取3個,也可以只讀1.與原始掃描儀(ZXing掃描儀)不同,它可以快速解碼。在我的情況下,我必須確保有足夠的光線,並且圖像沒有模糊來解碼。如何使用斑馬線庫
我使用的QRCodeMultiReader
對圖像進行解碼。目前使用ZXing
庫來創建應用程序。
下面是我的代碼片段:
public void onPictureTaken(byte[] data, Camera camera) {
BitmapFactory.Options opt = new BitmapFactory.Options();
opt.inMutable = true;
Bitmap bitmap = BitmapFactory
.decodeByteArray(data, 0, data.length, opt);
Hashtable<DecodeHintType, Object> hints = new Hashtable<DecodeHintType, Object>();
hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
LuminanceSource source = new RGBLuminanceSource(bitmap);
QRCodeMultiReader multiReader = new QRCodeMultiReader();
Result[] results = multiReader.decodeMultiple(new BinaryBitmap(
new HybridBinarizer(source)), hints);
}
有你發現任何完美的解決方案,以讀取多個條形碼?/ – 2014-06-23 08:16:30
不幸我不是因爲我們停止了該功能的開發。但將繼續尋找解決方案,尤其是我回到了android。 – 2014-06-24 00:37:17
好吧,你可以分享我代碼你以前試過的嗎? – 2014-06-24 04:57:57