Пример #1
0
        public static void Idcard()
        {
            var client = new Baidu.Aip.Ocr.Ocr("Api Key", "Secret Key");
            var image  = File.ReadAllBytes("图片文件路径");

            // 身份证正面识别
            var result = client.IdCardFront(image);

            // 身份证背面识别
            result = client.IdCardBack(image);
        }
Пример #2
0
        public static String Idcard(string imgpath)
        {
            var client = new Baidu.Aip.Ocr.Ocr(API_KEY, SECRET_KEY);
            var image  = File.ReadAllBytes(imgpath);

            // 身份证正面识别
            var result = client.IdCardFront(image);

            // 身份证背面识别
            result = client.IdCardBack(image);
            return(result.ToString());
        }
Пример #3
0
        /// <summary>
        /// 百度证件识别接口
        /// </summary>
        /// <param name="imgPath"></param>
        /// <returns></returns>
        public static string Idcard(string imgPath)
        {
            var client = new Baidu.Aip.Ocr.Ocr(clientId, clientSecret);
            var image  = System.IO.File.ReadAllBytes(imgPath);

            // 身份证正面识别
            Dictionary <string, object> myDictionary = new Dictionary <string, object>();

            myDictionary.Add("detect_direction", "true"); //是否检测图像朝向
            myDictionary.Add("accuracy", "high");         //精准度,精度越高,速度越慢
            var result = client.IdCardFront(image, myDictionary);

            return(result.ToString());
        }
        public static void Idcard()
        {
            var client = new Baidu.Aip.Ocr.Ocr("Api Key", "Secret Key");
            var image  = File.ReadAllBytes("图片文件路径");

            var options = new Dictionary <string, object>()
            {
                { "detect_direction", "true" } // 检测方向
            };
            // 身份证正面识别
            var result = client.IdCardFront(image, options);

            // 身份证背面识别
            result = client.IdCardBack(image);
        }
Пример #5
0
        public ActionResult IDFront(string smrz_front)
        {
            string idcardStr = Idcard(Request.MapPath(smrz_front));

            var client = new Baidu.Aip.Ocr.Ocr(clientId, clientSecret);
            var image  = System.IO.File.ReadAllBytes(Request.MapPath(smrz_front));

            // 身份证正面识别
            Dictionary <string, object> myDictionary = new Dictionary <string, object>();

            myDictionary.Add("detect_direction", "true"); //是否检测图像朝向
            myDictionary.Add("accuracy", "high");         //精准度,精度越高,速度越慢
            var result = client.IdCardFront(image, myDictionary);

            return(Content(result.ToString()));
        }