I am using OpenCV and Zxing, and I\'d like to add 2d code scanning. I have a few types of images that I could send. Probably the best is Bitmat (the other option is OpenCV
public static String readQRImage(Bitmap bMap) {
String contents = null;
int[] intArray = new int[bMap.getWidth()*bMap.getHeight()];
//copy pixel data from the Bitmap into the 'intArray' array
bMap.getPixels(intArray, 0, bMap.getWidth(), 0, 0, bMap.getWidth(), bMap.getHeight());
LuminanceSource source = new RGBLuminanceSource(bMap.getWidth(), bMap.getHeight(), intArray);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
Reader reader = new MultiFormatReader();// use this otherwise ChecksumException
try {
Result result = reader.decode(bitmap);
contents = result.getText();
//byte[] rawBytes = result.getRawBytes();
//BarcodeFormat format = result.getBarcodeFormat();
//ResultPoint[] points = result.getResultPoints();
} catch (NotFoundException e) { e.printStackTrace(); }
catch (ChecksumException e) { e.printStackTrace(); }
catch (FormatException e) { e.printStackTrace(); }
return contents;
}