基於百度AI實現 車牌識別

總目錄地址:AI 系列 總目錄 html

須要最新源碼,或技術提問,請加QQ羣:538327407git

個人各類github 開源項目和代碼:https://github.com/linbin524github

 

 

前言post

   目前百度的AI接口相對完善,對於文字識別類的操做還須要開發者一一去嘗試,去評估這效果究竟是怎麼的。spa

文字識別的接口相對簡單,官方提供的SDK也集成很好,筆者只是在這上面作了一些前期性的功能數據校驗和過濾,以及返回結果的處理。code

 

實驗效果orm

先來看一下識別效果:視頻

 一、精細化車牌(識別準確)htm

 

二、實際場景車牌 (識別準確)blog

 

 

三、多車牌(只識別到一個車牌)

 

 

 

實際拓展思路

鑑於上述結果,目前百度車牌識別能夠作到 實際應用場景的處理,但要真正結合、融合,須要開發者們本身作些前期處理,好比說,你須要在攝像頭捕捉車牌時候,本身去動態抓取行駛車牌的車牌,

在使用單個請求將車牌發送給百度,從而實如今真實環境中的車牌識別。

ps:有關相關的技術 能夠參考我另一篇博客,動態視頻中的人臉捕捉與人臉識別。 博客地址:http://www.cnblogs.com/linbin524/p/linbin524.html

 

代碼解析:

一、接口方法

   /// <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 上的連接

相關文章
相關標籤/搜索