aspose-free-consulting / projects

The starting point for Aspose free consulting projects
5 stars 5 forks source link

Scanning different types of barcodes in 12MP images with high performance #298

Closed ArnoHeliovision closed 8 months ago

ArnoHeliovision commented 1 year ago

I am looking for software to read barcodes and 2D codes from images. For the current use case the hardware is already in place which is a mono camera 12MP, which provides decent images on which the software should run. Response time is important so recognition accuracy and processing speed are two very important aspects.

The scanning software must be able to scan 18 different types of codes in all orientations: EAN8 EAN13 UPC-A UPC-E ITF14 ITF16 EAN128 Code128 GS1 DataBar Omnidirectional GS1 DataBar Stacked Omnidirectional GS1 DataBar Expanded GS1 DataBar Expanded Stacked GS1 DataBar Truncated GS1 DataBar Stacked Datamatrix default and Reverse GS1 Datamatrix ECC200 QR reverse GS1 QR code

I am working with a python program on a Linux PC. I have tested the Python via Java version of Aspose with the following code:

type_list = [ Recognition.DecodeType.EAN_8, Recognition.DecodeType.EAN_13, Recognition.DecodeType.UPCA, Recognition.DecodeType.UPCE, Recognition.DecodeType.ITF_14, Recognition.DecodeType.CODE_128, Recognition.DecodeType.DATABAR_EXPANDED, Recognition.DecodeType.DATABAR_EXPANDED_STACKED, Recognition.DecodeType.DATABAR_STACKED_OMNI_DIRECTIONAL, Recognition.DecodeType.DATABAR_TRUNCATED, Recognition.DecodeType.DATABAR_STACKED, Recognition.DecodeType.DATABAR_OMNI_DIRECTIONAL, Recognition.DecodeType.DATA_MATRIX, Recognition.DecodeType.GS_1_DATA_MATRIX, Recognition.DecodeType.QR, Recognition.DecodeType.GS_1_QR ]

def example(self): ta.set_license() full_path = ta.test_data_root + "26.jpg" results = [] for type in type_list: reader = Recognition.BarCodeReader(full_path, None, type) reader.setQualitySettings(Recognition.QualitySettings.getHighPerformance()) results0 = reader.readBarCodes() if results0 is not None: results.append(results0) j = 0 while (j < len(results)): i = 0 while (i < len(results[j])): print(i) print("code text: " + results[j][i].getCodeText()) print("code type: " + results[j][i].getCodeTypeName(), "\n\n") i += 1 j += 1

However with this code it takes over 50 seconds per image, while I am looking for under a second. Is that kind of performance possible in Aspose, and how should I speed it up? Also what would be the expected improvement if I used the c++ version instead? I have provided a test image via a WeTransfer link: https://we.tl/t-OXg4ApQJvo.

Thank you for your time and kind regards.

amjad-sahi commented 1 year ago

@ArnoHeliovision,

I did test your scenario/case a bit using your image file. I found it takes around 45-50 seconds to detect the barcode on the image. I guess this is due to quality of the barcode on the image. May be you could enhance the quality and capture better quality (with barcode focused) image and then try it again. By the way, your code cannot be compiled and is not executable, so could you please share a complete (runnable) sample code to evaluate your issue precisely.

In the meantime, we have logged an investigation ticket with an id "BARCODEJAVA-1613" for your issue. We will look into the details of the issue. Once we have an update on it, we will let you know.

PS. You may also post your queries and issue(s) in the dedicated forums.

amjad-sahi commented 1 year ago

@ArnoHeliovision,

We are pleased to inform you that your issue (logged earlier as “BARCODEJAVA-1613”) has been resolved. The fix will be included in an upcoming release (Aspose.BarCode v23.9) which is planned in the next month. You will be notified when the next version is released.

Stay tuned!

amjad-sahi commented 11 months ago

@ArnoHeliovision,

Please try Aspose.BarCode v23.9, your issue should be fixed in it.

Java (Releases | Maven) Python via Java (Releases | Pip).

Let us know your feedback.