GdPicture.NET如何在图片上进行一维条形码识别

作者:控件中国网   出处:控件中国网   2016-08-04 10:36:52   阅读:8

GdPicture.NET是目前市场上最完整的一款图片处理类SDK,该控件包含了成千上万个功能,可以浏览处理图片,也可以对文档类图片进行浏览处理,还可以进行条码的识别、图片的扫描、PDF文档处理,OCR以及OMR等多种常用功能,并且可以用于ActiveX、WInform,asp.net以及WPF等平台下,下面的代码主要讲述了如何利用该控件进行一维条形码的识别,具体如下:
 
GdPictureImaging oGdPictureImaging = new GdPictureImaging();
int imageId = oGdPictureImaging.CreateGdPictureImageFromFile("input.jpg");
if (imageId == 0)
{
   MessageBox.Show("Image Could Not Be Loaded! " + oGdPictureImaging.GetStat().ToString());
}
else
{
   //Specifying 1D barcode search types to be Code39 and Code128
   Barcode1DReaderType barcodeType = Barcode1DReaderType.Barcode1DReaderCode39 | Barcode1DReaderType.Barcode1DReaderCode128;
   //Start barcode scanning process
   if (oGdPictureImaging.Barcode1DReaderDoScan(imageId, Barcode1DReaderScanMode.BestQuality, barcodeType, false, 1) == GdPictureStatus.OK)
   {
      //obtaining the number of barcodes found
      int barcodeCount = oGdPictureImaging.Barcode1DReaderGetBarcodeCount();
      //if barcodes were found
      if (barcodeCount > 0)
      {
         //for each barcode display number, value and angle it is drawn at
         for (int i = 1; i <= barcodeCount; i++)
         {
            MessageBox.Show("Barcode No: " + i.ToString());
            MessageBox.Show("Value: " + oGdPictureImaging.Barcode1DReaderGetBarcodeValue(i).ToString());
            MessageBox.Show("Angle: " + oGdPictureImaging.Barcode1DReaderGetBarcodeSkewAngle(i).ToString());
         }
      }
      else
      {
         MessageBox.Show("No barcode detected !");
      }
      //Release detection info from memory
      oGdPictureImaging.Barcode1DReaderClear();
   }
   //Release the image
   oGdPictureImaging.ReleaseGdPictureImage(imageId);
}
Copyright© 2006-2015 ComponentCN.com all rights reserved.重庆磐岩科技有限公司(控件中国网) 版权所有 渝ICP备12000264号 法律顾问:元炳律师事务所
客服软件
live chat