could not read datamatrix code

34 views
Skip to first unread message

Sascha4j

unread,
May 13, 2015, 4:29:10 AM5/13/15
to zx...@googlegroups.com
hello,

i am new to zxing. i try to read a datamatrix code from a scanned Image (part4.jpg). i read, that the datamatrix code must be centered on the image to detect and decode it. so i try to cut it from the image in a nearly centered image. but none of the attached images worked. any hints what i could do ? may be zoomin or out ? blur?

this is the code i use for decoding

Map<DecodeHintType, Object> hints = new EnumMap<DecodeHintType, Object>(
DecodeHintType.class);
hints.put(DecodeHintType.POSSIBLE_FORMATS,
Arrays.asList(BarcodeFormat.DATA_MATRIX));
hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);



BufferedImage sourceimage = ImageIO.read(new FileInputStream(
filename));

BinaryBitmap binaryBitmap = new BinaryBitmap(new HybridBinarizer(
new BufferedImageLuminanceSource(sourceimage)));

Result result2 = new DataMatrixReader().decode(binaryBitmap, hints);
System.out.println(result2.getText());

part4.jpg
matrix.jpg
test.png
test50.png
datamatrix.jpg
datamatrix2.jpg
cut.jpg
Reply all
Reply to author
Forward
0 new messages