0

I am using ZBar SDK for Android.

It is decoding and returning me QRCode.

But it is not returning captured image.

I want to show captured QR Image from Camera to my screen.

Thanks in Advance..

1 Answers1

0

Assuming you're camera class is implementing Camera.PreviewCallback, you can override the onPreviewFrame method

    @Override
    public void onPreviewFrame(byte[] data, Camera camera) {

        Parameters parameters = camera.getParameters();
        Size size = parameters.getPreviewSize();

        Image barcode = new Image(size.width, size.height, "Y800");
        barcode.setData(data);
        int result = scanner.scanImage(barcode);

        if (result != 0) {
            camera.setPreviewCallback(null);
            camera.stopPreview();

            SymbolSet syms = scanner.getResults();
            for (Symbol sym : syms) {
                    // the barcode string
                System.out.println(sym.getData());
            }

    }

and then call the method by:

yourCamera.setPreviewCallback(YourCameraActivity.this);
jaesanx
  • 195
  • 1
  • 13