Unable to recognize code39 barcode

I went through the documentation and ran with high/max quality, allow incorrect bar codes, etc., and it still cannot find any barcode that is of type code39.

Interesting that https://products.aspose.app/barcode/recognize was not able to find any until the quality was changed to excellent.

Why can’t aspose detect this barcode?

code39_aom.png (78.9 KB)

@an.do

It seems you are experiencing difficulties with recognizing Code39 barcodes using Aspose. Here are a few suggestions that might help you troubleshoot the issue:

  1. Image Quality: You mentioned that the recognition only worked when the quality was set to excellent. This indicates that the barcode image may need to be of high quality for successful recognition. Ensure that the barcode is clear, well-lit, and not distorted.

  2. Checksum Validation: If your Code39 barcode includes a checksum, you may want to adjust the checksum validation settings in your code. The Aspose library allows you to set the checksum validation to either default or on. This can be crucial for accurate recognition. For example, you can use the following code snippet to set the checksum validation:

    using (BarCodeReader read = new BarCodeReader("path_to_your_image.png", DecodeType.Code39Extended))
    {
        read.BarcodeSettings.ChecksumValidation = ChecksumValidation.Default; // or ChecksumValidation.On
        foreach (BarCodeResult result in read.ReadBarCodes())
        {
            Console.WriteLine($"CodeType: {result.CodeTypeName}");
            Console.WriteLine($"CodeText: {result.CodeText}");
        }
    }
    
  3. Testing with Different Settings: Experiment with different settings in the barcode reader, such as allowing incorrect barcodes or adjusting the recognition parameters. This can sometimes yield better results.

  4. Image Format: Ensure that the image format you are using is supported and that the barcode is not too small or too large in the image.

If you continue to face issues, consider sharing the specific parameters you are using for recognition, as well as any error messages or unexpected results you are encountering. This information can help in diagnosing the problem further.

If you need more detailed examples or further assistance, feel free to ask!

Yeah, I tried all of that. Also using the latest Aspose.BarCode v25.4.0.

Btw, the sample code of DecodeType.Code39Extended doesn’t exist for me. There are only Code39 and Code39FullASCII.

@an.do,

Thanks for the barcode image.

After initial testing, I am able to reproduce the issue as you mentioned by using your barcode image. If I use DecodeType.AllSupportedTypes, incorrect barcode was detected. If I use DecodeType.Code39,no barcode was recognized even I specify maximum quality settings.

We require thorough evaluation of the issue. We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): BARCODENET-39311

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

1 Like

@an.do,

We evaluated your issue in details. We think the problem is related to high binarized noise, which affect zebra detection algorithms. Light blur with image resizing to 0.5/0.5 or lower solves this problem. In this way images “code39_aom_cut_resized.png”, “code39_aom_resized.png” are recognized well with normal quality.

We think we can add resizing(decreasing) image with blur algorithms to “High Quality” or “BarcodeQuality.Low” for 1D barcodes. We hope to resolve the issue soon.

Once we resolve the issue or we have some other updates, we will let you know here.

You’re saying to lower the image quality?

@an.do,

When we suggest resizing the image down and applying a light blur to resolve the issue, these are actually not degrading the image (quality) for visual purposes but it will intentionally simplify the image to reduce noise that confuses the Aspose.BarCode detection engine. it’s actually optimizing the image for barcode detection (internally). Hope you understand now.

I was able to get it to work following your suggestion. Thank you!

@an.do,

We are glad to hear you have resolved your issue now. Please don’t hesitate to reach out to us again if you have any additional questions or feedback.