public void WebImage(string filePath) { var image = File.ReadAllBytes(filePath); // 网图识别 var result = client.WebImage(image, null); }
public static void WebImage() { var client = new Ocr.Ocr(Config.clientId, Config.clientSecret); var image = File.ReadAllBytes("图片文件路径"); // 网图识别 var result = client.WebImage(image, null); }
public static void WebImage() { var client = new Ocr.Ocr("Api Key", "Secret Key"); var image = File.ReadAllBytes("图片文件路径"); // 网图识别 var result = client.WebImage(image, null); }
/// <summary> /// 网络图片识别,适合网络图片文字识别用于识别一些网络上背景复杂,特殊字体的文字。 /// </summary> /// <param name="tempImage"></param> /// <returns>返回 json 字符串</returns> public static string WebImage(Image tempImage) { var client = new Ocr.Ocr(Config.clientId, Config.clientSecret); var image = ImageHelper.ImageToBytes(tempImage, System.Drawing.Imaging.ImageFormat.Png); string result = client.WebImage(image, null).ToString(); return(result); }
public static void WebImage(string path) { var client = new Ocr.Ocr(api, key); var image = File.ReadAllBytes(path); // 网图识别 var result = client.WebImage(image, null); }
/// <summary> /// 网络图片识别,适合网络图片文字识别用于识别一些网络上背景复杂,特殊字体的文字。 /// </summary> /// <param name="tempImage"></param> public static APIBaseModel <DrivingLicenseModel> GetWebImage(Image tempImage) { APIBaseModel <DrivingLicenseModel> tempModel = new APIBaseModel <DrivingLicenseModel>(); tempModel.contextModel = new DrivingLicenseModel(); var client = new Ocr.Ocr(Config.clientId, Config.clientSecret); var image = ImageHelper.ImageToBytes(tempImage, System.Drawing.Imaging.ImageFormat.Png); string result = client.WebImage(image, null).ToString(); if (result.Contains("\"error_code\""))//说明异常 { tempModel.state = false; tempModel.contextModel.errorTypeModel = Json.ToObject <ErrorTypeModel>(result); tempModel.errorMsg = tempModel.contextModel.errorTypeModel.error_discription = OCR_CharacterRecognitionErrorType.GetErrorCodeToDescription(tempModel.contextModel.errorTypeModel.error_code); } else { tempModel.state = true; tempModel.contextModel.successModel = Json.ToObject <DrivingLicenseSuessResultModel>(result); } return(tempModel); }