0

I am trying to scan barcodes after taking a picture of them using the Camera Activity. However the byte[] data from onPictureTaken() is different from onPreviewFrame() (the one used in the examples). Is there any way to convert the byte[] data from onPictureTaken() so that the imagescanner can pick up the barcode?

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

The main problem is that in the above code if I use the byte[] data from onPictureTaken then result is 0, but it should be 1.

Thanks in advance.

jaesanx
  • 195
  • 1
  • 13

1 Answers1

2

Here you have example convert. Try it and tell me if works:

 Image barcode = new Image(size.width, size.height, "NV21");
 barcode.setData(data);   
 barcode = barcode.convert("Y800");

Here is more info

Dariusz Mazur
  • 587
  • 5
  • 21
  • Hi thanks this helps. Unfortunately it is not robust. 1 out of maybe 6 times it will return a 1 rest is 0 still. Do you think this has to do with the camera focus? – jaesanx Sep 11 '13 at 18:20
  • It maybe has something with it or camera resolution is too small - it is hard to say – Dariusz Mazur Sep 11 '13 at 18:22