基於百度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 上的鏈接

 

讀后感覺不錯,有收獲可以微信請作者喝杯咖啡,讀后有疑問請加微信,拉群研討,注明來意

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM