public static void Run()
{
try
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();
// Initialize the BarCodeReader object and Call read method
BarCodeReader reader = new BarCodeReader(dataDir + "Barcode2.png", DecodeType.AllSupportedTypes);
reader.Read();
// Now get all possible barcodes
BarCodeReader.PossibleBarCode[] barcodes = reader.GetAllPossibleBarCodes();
foreach (BarCodeReader.PossibleBarCode barcode in barcodes)
{
// Display code text, symbology, detected angle, recognition percentage of the barcode
Console.WriteLine("Code Text: " + barcode.Codetext + " Symbology: " + barcode.BarCodeReadType + " Recognition percentage: " + barcode.Angle);
// Display x and y coordinates of barcode detected
Point[] point = barcode.Region.Points;
Console.WriteLine("Top left coordinates: X = " + point[0].X + ", Y = " + point[0].Y);
Console.WriteLine("Bottom left coordinates: X = " + point[1].X + ", Y = " + point[1].Y);
Console.WriteLine("Bottom right coordinates: X = " + point[2].X + ", Y = " + point[2].Y);
Console.WriteLine("Top right coordinates: X = " + point[3].X + ", Y = " + point[3].Y);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose BarCode License. You can purchase full license or get 30 day temporary license from http://wwww.aspose.com/purchase/default.aspx.");
}
}
}