public string deal(string filename, string dir, string s) { Bitmap pic = null; //图片 string results = ""; //识别结果 string deal_path = ""; //文件路径 //设置文件路径 try { deal_path = dir + "\\" + filename; Console.WriteLine(deal_path); //识别图片 pic = new Bitmap(deal_path); byte[] image = BitmapToByte(pic); var client = new Baidu.Aip.Ocr.Ocr("mw9MavWMGqrvzIGlU0g3BiV1", "jFYqSHf3pIUiFwKo3hFf0WRwGcw4LLVP"); var result = client.PlateLicense(image); results = result.ToString(); //输出数据 string num = print_out(results, s); // Add_Word_And_Save(pic, filename, results); return(num); } catch { return(""); } }
public static String PlateLicense(string imgpath) { var client = new Baidu.Aip.Ocr.Ocr(API_KEY, SECRET_KEY); var image = File.ReadAllBytes(imgpath); var result = client.PlateLicense(image); return(result.ToString()); }
public static void PlateLicense() { var client = new Baidu.Aip.Ocr.Ocr("Api Key", "Secret Key"); var image = File.ReadAllBytes("图片文件路径"); var result = client.PlateLicense(image); }