I don't understand CheckSum Exception

1,641 views
Skip to first unread message

tlegrand

unread,
Jul 2, 2012, 4:01:16 AM7/2/12
to zx...@googlegroups.com
Hello,

Since the last topic (https://groups.google.com/forum/?fromgroups#!searchin/zxing/large$20file/zxing/5j47wBbPaJY/pHxiU3tZ3G8J), I extract manually the datamatrix from the scanned document. But, I always have that problem of CheckSum Exception. And I don't understand why.

I tried to scan the document to the PNG or JPG type. Then, I extracted the datamatrix (See the extracted2DDoc.png file to see the quality of the datamatrix). You can see that the datamatrix is ugly. So, I use Preview (from Mac OS) to make it "less" ugly (See testFlou.png). This last file is the file which contains the datamatrix from which I would like to get the datas but it sends me an exception.

Can you help me? Have you any idea? Is it too ugly to be scanned by zxing? Do you know a method in Java to make it less ugly to let zxing decode it?

Thank you :)

testFlou.png
extracted2DDoc.png

Sean Owen

unread,
Jul 2, 2012, 4:10:47 AM7/2/12
to zx...@googlegroups.com
It means what it says, that it didn't pass a checksum (here error correction found too many errors). Often that is because the corners of the barcode were not found correctly. I don't know why this image doesn't scan, but I don't think image quality is an issue. You can try TRY_HARDER mode but I don't think it will help. If this is an extract from a larger image, make sure the barcode is in the center.

tlegrand

unread,
Jul 2, 2012, 4:35:27 AM7/2/12
to zx...@googlegroups.com
Hello,

I already set the TRY_HARDER mode. And the files which I pass to ZXing are the attached ones in my previous post, so I think the datamatrix is in the center of the image. But I tried to extract manually the datamatrix from testFlou.png to another file (see testagain.png) to center the datamatrix and I have the same Exception :(
testagain.png

Sean Owen

unread,
Jul 2, 2012, 5:34:01 AM7/2/12
to zx...@googlegroups.com
Is the error correction computed correctly? Or there could be a problem in the decoding of EC. I don't know, myself.
Message has been deleted

tlegrand

unread,
Jul 2, 2012, 6:04:45 AM7/2/12
to zx...@googlegroups.com
I tried to scan the datamatrix with a smartphone using an application called quickmark and that works.

Is there a way to display the decoded content of the datamatrix, even if the CheckSum Exception is thrown?

Sean Owen

unread,
Jul 2, 2012, 6:56:34 AM7/2/12
to zx...@googlegroups.com
I can scan this barcode easily off the screen. The library decodes it fine; something is just funny about this image.

No, because it means the error correction failed. Without that step you have no data to decode.

tlegrand

unread,
Jul 2, 2012, 9:49:24 AM7/2/12
to zx...@googlegroups.com
I do not understand. I retried a process. Create a barcode with barcode4j, add it in a document. Print the document to scan it after into a PNG file. Extract manually the barcode to another PNG file. Pass this file to my software which use ZXing and ZXing have always this exception.

I even retried to scan the datamatrix directly from a smartphone (with flashcode and quickmark) and that works :s

I attached the created Barcode (extractedBarcode.png) and the extracted barcode (extractedDatamatrix.png)

Have you got any idea? Is my extracted barcode is a wild animal? :)
extractedDatamatrix.png
generatedDatamatrix.png

Sean Owen

unread,
Jul 2, 2012, 9:53:39 AM7/2/12
to zx...@googlegroups.com
I've already told you that these barcodes scan correctly with this library and app; this doesn't really prove anything either.

I'm not familiar with your process or what exactly you are feeding to the library. Maybe your PNG files are bad in some way, but I doubt it.

I've told you what the exception means. It likely means the corners have not been found correctly. I am not sure why; these images look fine and decode off screen fine. But that's your next step.

tlegrand

unread,
Jul 2, 2012, 10:35:38 AM7/2/12
to zx...@googlegroups.com
I just had a genius idea... I rotate the datamatrix and that works... But that seem working only when one of the black border is on the top.
extractedDatamatrixFirstRotation.png
extractedDatamatrixSecondRotation.png

Sean Owen

unread,
Jul 2, 2012, 10:44:33 AM7/2/12
to zx...@googlegroups.com
It's weird but I would not be surprised. The pure barcode itself decodes fine but something is funny about how the corners are found in this particular image. Presenting a slightly different image may well work fine.
Reply all
Reply to author
Forward
0 new messages