How to read multiple qr codes from one image using zxing library

瘦欲@ 提交于 2019-11-30 05:04:54

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 .

https://code.google.com/p/zxing/

user2801456

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());
        }
    }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!