Hi there!
I want to only recognize UPC barcodes, but ReadBarCodes() also returns EAN barcodes.
To demonstrate this, I’ve included the following simple test app for .NET Framework (using Aspose.Barcode 22.9.0). Use it in combination with the attached BarcodeExamples_p2.jpg (400.3 KB) and make sure to change the path in the code to the image location.
using Aspose.BarCode.BarCodeRecognition;
using System;
using System.Collections.Generic;
using System.Drawing;
namespace TestBarcodeUpcEan
{
class Program
{
static void Main(string[] args)
{
List<SingleDecodeType> BarcodeTypes = new List<SingleDecodeType> {
DecodeType.UPCA,
DecodeType.UPCE
};
var bmp1 = new Bitmap("BarcodeExamples\\BarcodeExamples_p2.jpg");
BarCodeReader reader = new BarCodeReader();
using (reader)
{
reader.SetBarCodeImage(bmp1);
reader.SetBarCodeReadType(BarcodeTypes.ToArray());
reader.QualitySettings = QualitySettings.NormalQuality;
var result = reader.ReadBarCodes();
Console.WriteLine("Found {0} barcode(s)", result.Length);
Console.WriteLine("");
foreach (BarCodeResult barcode in result)
{
Console.WriteLine("CodeType: " + barcode.CodeType);
Console.WriteLine("CodeText: " + barcode.CodeText);
Console.WriteLine("");
}
}
Console.WriteLine("That's all!");
Console.ReadKey();
}
}
}
Found 7 barcode(s)
CodeType: EAN13
CodeText: 451234567***Recognized by Aspose Barcode Reader evaluation version. Only Code39Standard can be recognized without restrictions. Please buy license to use Aspose Barcode Reader without watermarks.
CodeType: EAN13
CodeText: 993456789***Recognized by Aspose Barcode Reader evaluation version. Only Code39Standard can be recognized without restrictions. Please buy license to use Aspose Barcode Reader without watermarks.
CodeType: EAN13
CodeText: 979123456***Recognized by Aspose Barcode Reader evaluation version. Only Code39Standard can be recognized without restrictions. Please buy license to use Aspose Barcode Reader without watermarks.
CodeType: EAN13
CodeText: 978123456***Recognized by Aspose Barcode Reader evaluation version. Only Code39Standard can be recognized without restrictions. Please buy license to use Aspose Barcode Reader without watermarks.
CodeType: EAN13
CodeText: 978123456***Recognized by Aspose Barcode Reader evaluation version. Only Code39Standard can be recognized without restrictions. Please buy license to use Aspose Barcode Reader without watermarks.
CodeType: EAN13
CodeText: 977114487***Recognized by Aspose Barcode Reader evaluation version. Only Code39Standard can be recognized without restrictions. Please buy license to use Aspose Barcode Reader without watermarks.
CodeType: EAN13
CodeText: 979034524***Recognized by Aspose Barcode Reader evaluation version. Only Code39Standard can be recognized without restrictions. Please buy license to use Aspose Barcode Reader without watermarks.
That's all!
Why the EAN13s? I’ve set SetBarCodeReadType to UPCA and UPCE only, right?
Is this a regression of https://forum.aspose.com/t/incorrect-recognition-of-upc-vs-ean-barcodes/8528?