We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Incorrect Code128 Barcode even with checksum


We have an application which is reading a poorly printed Code128 barcode with the Aspose package in Java. The problem is that the barcode returned is 90% of the time incorrect which shouldn’t happen because the checksum should be stopping this. How is it managing to return so many bad reads. The code is as follows:

BarCodeReader reader = new BarCodeReader(OpenCVUtils.convertToBufferedImage(iplImage), typeLookup.get(OneDBarcodeFormat.CODE_128));
while (reader.read())
codeText = reader.getCodeText();

if (StringUtils.isBlank(codeText)) {
throw new BarcodeReadException(“No code read”, Reason.NOT_FOUND);

The basic issue here is that I can’t trust Aspose if it returns bad codes even with a checksum. Why doesn’t the checksum kick out the bad codes?

An example image is attached; note that we rotate it before it is read by aspose (using OpenCV) so that the code is horizontal.
bad code.png (528.8 KB)




Thank you for your query.

Code 128 barcode has too weak checksum because it was developed in 1981. Our engine can recognize blurred and distorted barcodes but sometimes it can recognize barcode incorrectly because we check correct recognition by checksum and the checksum can be right on wrong barcodes.

To avoid this you should use barcodes with strong checksum (Reed–Solomon error correction) like pdf417, datamatrix, Aztec or QR codes. In this case if this barcode type is recognized it is recognized correctly.