Exemple #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);
        }
Exemple #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());
        }
Exemple #3
0
        public ActionResult IDBack(string smrz_back)
        {
            var client = new Baidu.Aip.Ocr.Ocr(clientId, clientSecret);
            var image  = System.IO.File.ReadAllBytes(Request.MapPath(smrz_back));
            // 身份证背面识别
            Dictionary <string, object> myDictionary = new Dictionary <string, object>();

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

            return(Content(resultBei.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);
        }