The use case is a PDF page. We transform the pdf page into a binarized image (bradley) via Aspose Java and use this binarized image for different tasks. One of this tasks is to detect the barcode type Interleaved2of5. The binarized version did not detect a barcode but the color version somehow did?
BarCodeReader reader = new BarCodeReader(bufferedImage, decodeType);
for (BarCodeResult barCodeResult : reader.readBarCodes()) {
result.add(barCodeResult);
}
example.jpg (162.3 KB)
example_binarized.png (43.1 KB)
@martin.duerig,
Thanks for the barcode images.
I tested your scenario/case using your barcode images and found “example_binarized.png” has poor quality. That’s way, in normal mode, Aspose.BarCode could not detect barcode on it. You should enhance the quality of the image to be detected by Aspose.BarCode API. If you could not enhance it, you may set QualitySettings for the recognition API to try to extract maximum (possible) barcodes. For example, adding the following line to your code segment will work for the purpose.
BarCodeReader reader = new BarCodeReader(bufferedImage, decodeType);
reader.setQualitySettings(QualitySettings.getMaxBarCodes());
for (BarCodeResult barCodeResult : reader.readBarCodes()) {
result.add(barCodeResult);
}
Thank you for your quick reply.
The suggested quality settings solution works but doubles the time needed for a page from ~1.2 to ~2.4 sec which drops the performance.
As I said the colored version detected the barcode just fine taking ~1.2sec. Do you recommend NOT using the binarized image as a source in general?
Doesn’t the barcode reader internally use a binarized format of the images?
@martin.duerig,
Yes, when you use QualitySettings.MaxBarCodes enum member, you have to sacrifice the time cost.
In normal mode, Aspose.BarCode does not detect any barcode on it because of poor quality in your binarized image, you should improve the quality of the image to get scanned in normal mode by the API.