Z
Z
zoo2012-12-06 18:05:17
Java
zoo, 2012-12-06 18:05:17

Decoding oned code barcode with zxing from file?

Actually, it is interested in the possibility of decoding not with the help of a camera, but directly with a bitmap. For this I use the code

PlanarYUVLuminanceSource source = new PlanarYUVLuminanceSource(byte[] yuvData,
                                  int dataWidth,
                                  int dataHeight,
                                  int left,
                                  int top,
                                  int width,
                                  int height,
                                  boolean reverseHorizontal)
 BinaryBitmap bitmapBinary = new BinaryBitmap(new HybridBinarizer(source));
 result = reader.decode(bitmapBinary);
 ...

Problems with the parameters passed to the PlanarYUVLuminanceSource constructor, if I understand correctly,
yuvData is our bitmap in byte[], dataWidth and dataHeight are the dimensions of the bitmap, and left, top, width, height are
the Rect parameters, into which the barcode is supposed to fall in the photo (as I understand it, the class is sharpened for use with
a camera). I googled, but there are mostly examples that use either old versions of the zxing library, or
java features that are not available in android. Does anyone have a positive experience with zxing guts?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zoo, 2012-12-06
@zoo

found the solution in zxing-2.1\androidtest\....\BenchmarkThread!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question