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

Free Support Forum - aspose.com

com.aspose.barcode.barcoderecognition.BarCodeResult.getCodeText is taking long time

BarcodeResult.getCodeText() is taking around 6secods for one barcode. Is there anyway to improve the performance ?? Please suggest if any of you have already come across this and got a solution.

@manjularani,

Could you please specify high performance quality settings via BarCodeReader.setQualitySettings method if it makes any difference.
e.g.

reader.setQualitySettings(QualitySettings.getHighPerformance()); 

If you still find performance issue, kindly do share your barcode image and paste sample code, we will check it soon.

I dont see the time difference without using reader.setQualitySettings(QualitySettings.getHighPerformance());
and with using this reader.setQualitySettings(QualitySettings.getHighPerformance()); . Its the same time. Attached the png file for reference. Pls suggest.

COD.jpg (2.8 KB)

@manjularani,

It looks like you are scanning/detecting code using DecodeType.ALL_SUPPORTED_TYPES. That’s why it will take extra time (in seconds) to search the underlying barcode type, this is normal. Please specify proper barcode type and it will detect efficiently. See the following sample code which I tested using your barcode image and it works fine and it takes 1 second to retrieve the barcode text and symbology type.
e.g.
Sample code:

long previousTime1  = System.currentTimeMillis();
String dataDir = "f:\\files\\COD.jpg";
                 
// Initialize barcode reader                 
BarCodeReader reader1 = new BarCodeReader(dataDir, DecodeType.CODE_39_STANDARD);

BarCodeResult []result = reader1.readBarCodes();                 
for (int j = 0; j < result.length; j++) 
{
      System.out.println("CodeText: " + result[j].getCodeText());
      System.out.println("Symbology type: " + result[j].getCodeType());
}

long currentTime1 = System.currentTimeMillis();
double elapsedTime1 = (currentTime1 - previousTime1) / 1000.0;                 
System.out.println("Time in seconds   : " + elapsedTime1);

Thanks Amjad.

One more thing, I need to scan only one barcode from the page. If one page is having 10 barcodes, reader.getBarCodes() is taking long time. Is there anyway to scan particular barcode in that ??

For eg: there is a text Customer Order Number and i want to read barcode below that text.
Is there any way to read that particular barcode ??

@manjularani,

If there are several different barcodes on the image, you may specify your desired barcode type and it will detect it only.

You may set target region(s) to detect barcodes from the location(s), see the document for your reference.

Document u shared is for c# dot net. Can you please share java related.

@manjularani,

There is similar Java document but we have not included examples, so I shared the .NET document for reference.