EasyPR的基本使用


 

1、easypr下載運行

第一步可以去下載easypr的zip的包,然后解壓,我用的是碼雲新建項目,從git導入,這樣子下載比較快一點 git:https://github.com/liuruoze/EasyPR

# cd EasyPR

進入工程文件 我們可以看到很多的文件,現在應該注意 build.sh 與 cmakelists.txt這兩個文件就ok了。

#vim CMakeLists.txt

加入set( OpenCV_DIR "/home/andy/opencv-3.2.0/build") 注意,這里的opencv路徑是自己安裝時候的路徑

如果現在運行 #./build.sh 會編譯到一半報錯、

對於上面這個問題需要按照提示的錯誤去找 在github上看到一個答案解決了這個問題 : Opencv3.2版本的支持,編譯前僅需要將config.h中將#define CV_VERSION_THREE_ZERO改為#define CV_VERSION_THREE_TWO即可。

 

 

2、在Linux下安裝EasyPr遇到的問題:

easypr/src/util/kv.cpp:11: void easypr::Kv::load(const string&): Assertion `reader' failed.

解決方案:

在include/easypn/config.h中將相對地址全部修改為絕對地址

static const char* kDefaultSvmPath = "/home/mxy/qt_code/easypr5/model/svm_hist.xml";

static const char* kLBPSvmPath = "/home/mxy/qt_code/easypr5/model/svm_lbp.xml";

static const char* kHistSvmPath = "/home/mxy/qt_code/easypr5/model/svm_hist.xml";

 

static const char* kDefaultAnnPath = "/home/mxy/qt_code/easypr5/model/ann.xml";

static const char* kChineseAnnPath = "/home/mxy/qt_code/easypr5/model/ann_chinese.xml";

static const char* kGrayAnnPath = "/home/mxy/qt_code/easypr5/model/annCh.xml";

 

//This is important to for key transform to chinese

static const char* kChineseMappingPath = "/home/mxy/qt_code/easypr5/model/province_mapping";

 

若還是不行,則在linux下面的用cmake編譯的后來把編譯好的demo放進EasyPR文件里面再運行就好了

 

3、測試:

 

./demo recognize -p resources/image/chars_identify.jpg

./demo recognize -p *****

//*****是你要解析的圖片(絕對地址,或者能夠找到他的地方)

 

4、怎么調用easyPR庫

我們利用的是原來EasyPR的demo包的使用方法:./demo recognize -p file;這條指令是對指定的文件直接進行車牌識別,使用的是command_line_handler(argc, argv);函數

故而:

    const char *a_test[4] = {"./demo","recognize","-p","./chars_recognise.jpg"};

command_line_handler(4, a_test);

只需要定義一個const char的數組,然后將數組傳進去即可以調用到EasyPR的功能,即實現對指定文件的解析

 

若是遇到: Assertion `!img.empty()' failed.這個錯誤,

原因及解決方案

請一定好好檢查圖片讀取路徑有沒有寫對!!!

可能錯誤:

1.圖片路徑寫成了如下形式:C:\Users\Desktop\test\

正確的應該為:C:/Users/Desktop/test/

(在程序中斜杠'\'有轉義字符含義)

 

2.圖片路徑少寫了一個斜杠(圖片存放在test文件夾中)

錯誤:C:/Users/Desktop/test

正確:C:/Users/Desktop/test/

(千千萬萬不要忘了最后一個斜杠,不然讀取的就變成了test這個文件夾)

 

3.圖片的格式不對!

 

4.圖片的數量不一致!

 

5.路徑中、文件夾名稱都不要包含中文!.(編程中各種命名都盡量使用易懂的英文)


免責聲明!

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



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