Hi,
Is anybody able to help me understand why (or resolve) why abarcode is detected in "test_clean" but not "large_clean_3"?
Large_clean_3 is essentially a utility bill with all noise removed around the barcode, however no barcode is detected. What I don't understand is if you crop the image (which is what "test_clean" is) - the detection and decode does work.
If I can't get this working for "large_clean_3" - then I have no hope of it finding it when the utility bill is not manually cleaned up.
Thanks for any help,
Alex.
Code used:
BarCodeReader reader;
reader = new BarCodeReader(filePath, BarCodeReadType.AllSupportedTypes);
List<string> barcodesFound = new List<string>();
int counter = 0;
// read all the barcodes from the images
while (reader.Read())
{
// display the symbology type
//MessageBox.Show("BarCode Type: " + reader.GetReadType());
// display the codetext
//MessageBox.Show("BarCode CodeText: " + reader.GetCodeText());
// get the barcode region
barcodesFound.Add(reader.GetCodeText() + " (" + reader.GetReadType() + ")");
Aspose.BarCodeRecognition.BarCodeRegion region = reader.GetRegion();
if (region != null)
{
// Initialize an object of type Image to get the Graphics object
System.Drawing.Image img = System.Drawing.Image.FromFile(filePath);
// initialize graphics object from the image
System.Drawing.Graphics g = Graphics.FromImage(img);
// draw the barcode edges
region.DrawBarCodeEdges(g, new System.Drawing.Pen(System.Drawing.Color.Red, 1f));
// save the image
img.Save(string.Format(filePath + @"edge_{0}.png", counter++));
// fill the barcode area with some color
region.FillBarCodeRegion(g, System.Drawing.Brushes.Green);
img.Save(string.Format(filePath + @"fill_{0}.png", counter++));
}
}