使用Leadtools;使用Leadtools.Codecs;使用Leadtools.Forms.Common;使用Leadtools.Ocr;使用Leadtools.Forms.Commands;使用Leadtools.Barcode;公共无效TestBusinessCardReader (){/ /初始化RasterCodecs类RasterCodecs编解码器=新RasterCodecs ();/ /名片图像字符串chequePath = Path.Combine (LEAD_VARS.ImagesDir,“original.jpg”);RasterImage图像= codecs.Load (chequePath);/ /启动条形码BarcodeEngine BarcodeEngine =新BarcodeEngine ();/ /启动Ocr引擎IOcrEngine ocrEngine = OcrEngineManager.CreateEngine (OcrEngineType.LEAD);ocrEngine.Startup(编解码器,零,零,LEAD_VARS.OcrLEADRuntimeDir);/ /初始化BusinessCardReader类BusinessCardReader BCReader =新BusinessCardReader (ocrEngine barcodeEngine);BCProcessStatus状态= BCReader.Process(图片);如果(状态= = BCProcessStatus.BlurDetected)Console.WriteLine (模糊图像中发现:“+这);其他的如果(状态= = BCProcessStatus.GlareDetected)Console.WriteLine (“眩光图像中发现:“+这);其他的如果(状态= = BCProcessStatus.Failed)Console.WriteLine (“未能识别的形象:“+这);其他的如果(状态= = BCProcessStatus.Success){如果(BCReader。结果! =零){foreach(varres在BCReader.Results){LeadRect边界= res.Value.Bounds;Console.WriteLine (字符串.Format (“字段名:{0}”res.Key));Console.WriteLine (字符串.Format (“字段值:{0}”res.Value.Value));Console.WriteLine (字符串.Format (”字段的信心:{0}”res.Value.Confidence));Console.WriteLine (字符串.Format (”字段范围:{0},{0},{0},{0}”、bounds.X.ToString () bounds.Y.ToString (), bounds.Width.ToString (), bounds.Height.ToString ()));Console.WriteLine (“* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *”);}}}ocrEngine.Shutdown ();}静态类LEAD_VARS{公共常量字符串ImagesDir =@“C: \ LEADTOOLS21 \ Resources \图片”;公共常量字符串OcrLEADRuntimeDir =@“C: \ LEADTOOLS21 \ Bin \常见\ OcrLEADRuntime”;}