2

In my android app, I'm using an USB camera as image capturing method. For that I'm using UVCCamera library. Idea behind this is to read barcodes with this cameta, hence from this input, Bitmap is created and it will be decoded with ZBar library

But the problem i'm having now is, ZBar can read only "GRAY" and "Y800" image formats. So my question is how to read the Bitmap with ZBar.

I've tried the following method but it failed:

int[] intArray = new int[bMap.getWidth() * bMap.getHeight()];
bMap.getPixels( intArray, 0, bMap.getWidth(), 0, 0, bMap.getWidth(), bMap.getHeight() );

Image barcode = new Image(bMap.getWidth(), bMap.getWidth(), "RGB4");
barcode.setData(intArray);

imageScanner.scanImage(barcode2.convert("Y800"));

But as I do this, program crashes with "Fatal signal 11 (SIGSEGV)" message.

What would be the best way to scan this type of image, concerning the processing power and memory of the android device.

Thanks.

KTB
  • 1,499
  • 6
  • 27
  • 43
  • The code does work for me except that the variable barcode2 should be barcode, but that wont lead to your exception.. Compared to the source of the code https://sourceforge.net/p/zbar/discussion/2308158/thread/ce0d36f8/ it looks alright and i didnt found a better way to convert the android bitmap into an y800 format. – Hatzen Dec 18 '19 at 19:21

0 Answers0