I am currently developing a scanner that reads multiple QR codes found in one image. I manage to read the QR codes in the image but it's giving me inconsistent results. Assuming there are 4 QR codes in the image, sometimes I can read 2 and sometimes 3 or just 1. Unlike in the original scanner (ZXing Scanner) it decodes fast. While in my case, I have to make sure there is enough light and the image is not blurred to decode it.
I am using the QRCodeMultiReader
to decode the image. Currently using ZXing
Library to create the application.
Below is the snippet of my code:
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);
}
Hello please check in the Zxing Barcode Scanner app it has option in Settings to Scan Bulk Barcodes so u enable it and check it u can read Multiple QR codes at a time from one or more Images and also check the Source code of Zxing library to Known the detailed Information .
Yes, it is possible to create one QR Code for multiple links. You can deploy a multi URL QR Code that directs to a landing page with multiple links for users to click on.
Even if two QR Codes store identical data, the pattern might or might not be different depending on the QR Code generator used. The primary reason for the change is due to the internal expression of the QR Code (numeric code, alphanumeric code, and so on). If this expression varies, then the data pattern also varies.
i have created one app for camera i have used intent
as the default Camera app is there with every Andriod OS and generally they are better optimized for that device than writing a generic Camera app which would be optimized for your phone only...so for camera better use intent
.
For Extracting multiple QR from a Single image i tried the code below.
But results are not consistent some time I get 1 or 2 or 3 out of 4 some time none....its not perfect solution
if(photo == null)
return;
Bitmap ScaledQr = null;
ScaledQr = Bitmap.createScaledBitmap(photo, 640,480, false);
BinaryBitmap Qr = BitMap2BinayBitmap(ScaledQr);
Result [] kpResultMulti = null;
Result kpResultSingle = null;
Hashtable<DecodeHintType, Object> hints = new Hashtable<DecodeHintType, Object>();
hints.put(DecodeHintType.TRY_HARDER, true);
//hints.put(DecodeHintType.PURE_BARCODE, true);
try {
kpResultMulti = kpReaderArr.decodeMultiple(Qr,hints);
} catch (NotFoundException e) {
// TODO Auto-generated catch block
msbox("Exception","NotFoundException");
e.printStackTrace();
}
if(kpResultMulti != null){
msbox("Total Result" ,kpResultMulti.length +"");// + photo.getWidth() + "Height=" + photo.getHeight());
for(Result kp : kpResultMulti)
{
msbox("Results",kp.getText());
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With