centos下安裝tessrect-ocr
centos下安裝tessrect-ocr
centos下安裝tessrect-ocr及訓練工具問題分析及解決辦法
最近要在服務器上搭建tessrect-ocr和訓練工具,搭建一個訓練網頁:
http://115.159.205.168/ocr_php/public/index.php
在搭建中遇到了以下問題:
1.找不到tessrect-ocr安裝包
2.訓練工具無法安裝
1.解決辦法:
[cpp]view plaincopy
- sudoyuminstalltesseract.i686
2.安裝centos庫時,沒有安裝訓練工具,所以要進行源碼安裝:
1.下載源碼:
[cpp]view plaincopy
- wgethttps://github.com/tesseract-ocr/tesseract/archive/master.zip
2.解壓:
unzip tesseract-master.zip
3.運行以下命令:
[cpp]view plaincopy
- ./autogen.sh
- ./configure
- make
- sudomakeinstall
- sudoldconfig
現在已經安裝好引擎了,現在安裝訓練工具:
[cpp]view plaincopy
- maketraining
- sudomaketraining-install
但是如果你的程序在./configure時顯示這個:
[cpp]view plaincopy
- Configurationisdone.
- Youcannowbuildandinstalltesseractbyrunning:
- $make
- $sudomakeinstall
- Youcannotbuildtrainingtoolsbecauseofmissingdependency.
- Checkconfigureoutputfordetails.
那訓練工具肯定安裝不成功,因為它沒有生產Makefile文件
[cpp]view plaincopy
- configure:creating./config.status
- config.status:creatingMakefile
- config.status:creatingtesseract.pc
- config.status:creatingapi/Makefile
- config.status:creatingccmain/Makefile
- config.status:creatingopencl/Makefile
- config.status:creatingccstruct/Makefile
- config.status:creatingccutil/Makefile
- config.status:creatingclassify/Makefile
- config.status:creatingcube/Makefile
- config.status:creatingcutil/Makefile
- config.status:creatingdict/Makefile
- config.status:creatingneural_networks/runtime/Makefile
- config.status:creatingtextord/Makefile
- config.status:creatingviewer/Makefile
- config.status:creatingwordrec/Makefile
- config.status:creatingtessdata/Makefile
- config.status:creatingtessdata/configs/Makefile
- config.status:creatingtessdata/tessconfigs/Makefile
- config.status:creatingtesting/Makefile
- config.status:creatingjava/Makefile
- config.status:creatingjava/com/Makefile
- config.status:creatingjava/com/google/Makefile
- config.status:creatingjava/com/google/scrollview/Makefile
- config.status:creatingjava/com/google/scrollview/events/Makefile
- config.status:creatingjava/com/google/scrollview/ui/Makefile
- config.status:creatingdoc/Makefile
- config.status:creatingconfig_auto.h
- config.status:config_auto.hisunchanged
- config.status:executingdepfilescommands
- config.status:executinglibtoolcommands
很明顯,沒有產生training的Makefile文件
下面解決辦法:
1.去看./configure產生的信息:
[cpp]view plaincopy
- checkinglimits.husability...yes
- checkinglimits.hpresence...yes
- checkingforlimits.h...yes
- checkingmalloc.husability...yes
- checkingmalloc.hpresence...yes
- checkingformalloc.h...yes
- checkingforstdbool.hthatconformstoC99...yes
- checkingfor_Bool...no
- checkingwhether#!worksinshellscripts...yes
- checkingforspecialCcompileroptionsneededforlargefiles...no
- checkingfor_FILE_OFFSET_BITSvalueneededforlargefiles...64
- checkingforgetline...yes
- checkingforwchar_t...yes
- checkingforlonglongint...yes
- checkingforoff_t...yes
- checkingformbstate_t...yes
- checkingforleptonica...yes
- checkingforl_generateCIDataForPdfin-llept...yes
- checkingleptonicaheadersversion>=1.71...yes
- checkingunicode/uchar.husability...yes
- checkingunicode/uchar.hpresence...yes
- checkingforunicode/uchar.h...yes
- checkingforpkg-config.../usr/bin/pkg-config
- checkingpkg-configisatleastversion0.9.0...yes
- checkingforpango...yes
- checkingforcairo...yes
如果有Warning:...............can't install training tools 按照其提示未安裝的進行按照:
如果找不到包,執行以下命令:
[cpp]view plaincopy
- yumlist|gerpname
找到對應包。
這裡有一個包ICU版本比較舊,要進行源碼安裝:
1.下載源碼:
[cpp]view plaincopy
- wgethttp://download.icu-project.org/files/icu4c/58.1/icu4c-58_1-src.tgz
2. 安裝
[cpp]view plaincopy
- ./configure
- make
- sudomakeinstall
然後重新運行./configure
如果沒有Warning但仍然顯示無法安裝:
修改config.status文件,325行添加 training/Makefile
然後進入training目錄,
執行
[cpp]view plaincopy
- make
- makeinstall
http://xxxxxx/Linuxjc/1184828.html TechArticle