基本信息
源码名称:通过百度云进行车辆牌照识别
源码大小:1.05M
文件格式:.rar
开发语言:C#
更新时间:2019-05-14
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍

比较简陋的车辆牌照识别,起个抛砖引玉的作用

需要引用百度AipSdk,Newtonsoft.Json,自行在网上下载

API_KEY和SECRET_KEY 自行申请



richTextBox6.Text = "";
            var client = new Baidu.Aip.Ocr.Ocr(API_KEY, SECRET_KEY);
            filePath = FileDialogHelper.OpenImage();
            if (!string.IsNullOrEmpty(filePath))
            {
                
                pictureBox1.Image = Image.FromFile(filePath);
                var image = File.ReadAllBytes(filePath);
                pictureBox1.Refresh();

                // 如果有可选参数
                var options = new Dictionary<string, object>
                {
                {"multi_detect", "true"}
            };
                var result = client.LicensePlate(image, options);

                LicensePlate.RootObject rb = JsonConvert.DeserializeObject<LicensePlate.RootObject>(result.ToString());
                List<LicensePlate.Words_result> Result_info = rb.words_result;

                string value = "";
                richTextBox6.Text = "";

                List<LicensePlate.Vertexes_location> mylocation = new List<LicensePlate.Vertexes_location>();
                if (Result_info == null)
                {
                    richTextBox6.Text = "无法识别车辆牌照";
                    return;
                }
                value = "共识别到" Result_info.Count.ToString() "个车牌" "\r\n";
                for (int i = 0; i < Result_info.Count; i )
                {
                    mylocation = Result_info[i].vertexes_location;
                    DrawLine(mylocation[0].x, mylocation[0].y, mylocation[1].x, mylocation[1].y, pictureBox1);
                    pictureBox1.Refresh();
                    DrawLine(mylocation[1].x, mylocation[1].y, mylocation[2].x, mylocation[2].y, pictureBox1);
                    pictureBox1.Refresh();
                    DrawLine(mylocation[2].x, mylocation[2].y, mylocation[3].x, mylocation[3].y, pictureBox1);
                    pictureBox1.Refresh();
                    DrawLine(mylocation[3].x, mylocation[3].y, mylocation[0].x, mylocation[0].y, pictureBox1);
                    pictureBox1.Refresh();

                    value = "第" (i 1).ToString() "个" Result_info[i].color "  " Result_info[i].number "\r\n";
                    richTextBox6.Text = richTextBox6.Text "\r\n"  value;
                }
                pictureBox1.Refresh();