基于百度AI实现 车牌识别

总目录地址:AI 系列 总目录 

需要最新源码,或技术提问,请加QQ群:538327407

我的各种github 开源项目和代码:https://github.com/linbin524

 

 

前言

   目前百度的AI接口相对完善,对于文字识别类的操作还需要开发者一一去尝试,去评估这效果到底是怎么的。

文字识别的接口相对简单,官方提供的SDK也集成很好,笔者只是在这上面做了一些前期性的功能数据校验和过滤,以及返回结果的处理。

 

实验效果

先来看一下识别效果:

 1、精细化车牌(识别准确)

 

2、实际场景车牌 (识别准确)

 

 

3、多车牌(只识别到一个车牌)

 

 

 

实际拓展思路

鉴于上述结果,目前百度车牌识别可以做到 实际应用场景的处理,但要真正结合、融合,需要开发者们自己做些前期处理,比如说,你需要在摄像头捕捉车牌时候,自己去动态抓取行驶车牌的车牌,

在使用单个请求将车牌发送给百度,从而实现在真实环境中的车牌识别。

ps:有关相关的技术 可以参考我另外一篇博客,动态视频中的人脸捕捉与人脸识别。 博客地址:http://www.cnblogs.com/linbin524/p/linbin524.html

 

代码解析:

1、接口方法

复制代码
   /// <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;
        }
复制代码

 

源码地址:github 上的链接

 

读后感觉不错,有收获可以微信请作者喝杯咖啡,读后有疑问请加微信,拉群研讨,注明来意

 

 

posted @   linbin524  阅读(6895)  评论(1编辑  收藏  举报
编辑推荐:
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
阅读排行:
· 周边上新:园子的第一款马克杯温暖上架
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· Ollama——大语言模型本地部署的极速利器
· 使用C#创建一个MCP客户端
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
点击右上角即可分享
微信分享提示