FAQ: How to detect barcodes

27 views
Skip to first unread message

Vankir

unread,
Apr 20, 2007, 8:46:23 AM4/20/07
to PixTools (scanning & imaging SDK)
The sample demonstrates how to detect barcodes. The results are
printed on Console.

public void DetectBarcodes(string fileName)
{
//Create image from file
PixImage img = new PixImage(fileName);
//Show image
pixImgView.Image = img;
//Use BarcodeDetection filter
BarcodeDetection filter = new BarcodeDetection();
//Use PixIpFilterProcessor to apply filter to image
PixIpFilterProcessor processor = new
PixIpFilterProcessor();
processor.FilterList.Add(filter);
//Apply filter
processor.Run(img);
IPixIpResult res = filter.Result;
BarcodeList barList = (BarcodeList)res["BarcodeList"];
//Print all barcodes
foreach (Barcode bar in barList)
{
Console.WriteLine(bar.Height.ToString());
Console.WriteLine(bar.Orientation.ToString());
Console.WriteLine(bar.PosX.ToString());
Console.WriteLine(bar.PosY.ToString());
Console.WriteLine(bar.Text);
Console.WriteLine(bar.Type.ToString());
Console.WriteLine(bar.Width.ToString());

}
}

Reply all
Reply to author
Forward
0 new messages