/// <summary> /// 车牌识别 返回实体结果 /// </summary> /// <param name="tempImage"></param> /// <returns></returns> public static APIBaseModel <DrivingLicenseModel> GetPlateLicense(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.PlateLicense(image).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); }
public static void PlateLicense() { var client = new Ocr.Ocr(Config.clientId, Config.clientSecret); var image = File.ReadAllBytes("图片文件路径"); var result = client.PlateLicense(image); }
public static void PlateLicense() { var client = new Ocr.Ocr("Api Key", "Secret Key"); var image = File.ReadAllBytes("图片文件路径"); var result = client.PlateLicense(image); }
public void PlateLicense(string filePath) { var image = File.ReadAllBytes(filePath); var result = client.PlateLicense(image); }