I am developing an application that needs to read Data Matrix bar codes. Using the ZXing library I am having trouble reliably getting a reading. The system that I am using has an internal CMOS camera with 400 lines of resolution. Using a robotic arm, I am navigating to the bar code and then using the ZXing library to read it from an image. The problem I am having is a high failure rate ~20%. What is really puzzling to me is that when I use the "Barcode Scanner by ZXing Team" app I can read Data Matrix barcodes that my code will not. From this it would seem to me that my implementation is not correct. Attached I have included on of the images that is read on my phone but gets a "Checksum Exception" when read via Eclipse.
Hashtable<DecodeHintType, Object> hint = new Hashtable<DecodeHintType, Object>();hint.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);LuminanceSource source = new BufferedImageLuminanceSource(img1);BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));Reader reader = new DataMatrixReader();Result result = reader.decode(bitmap, hint);return result.getText();