Tesseract 部署到centos遇到的坑


1、java.lang.UnsatisfiedLinkError: Unable to load library 'tesseract': Native library (linux-x86-64/libtesseract.so) not found in resource path 

  和 at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:303) ~[jna-4.5.2.jar!/:4.5.2 (b0)]

解決方法:

你需要在centos 安裝一些圖像的包
yum -y install libjpeg* libpng* freetype* gd* giflib* libtiff* zlib*
然后安裝tesseract包
yum install tesseract
安裝之后,需要讓程序調用,所以要暴露出來
通過rpm -qal | grep tesseract 查找安裝的文件
命令打開這個文件,vim ~/.bash_profile
添加下面兩個

  LD_LIBRARY_PATH=/usr/lib64/
  export LD_LIBRARY_PATH

再運行source ~/.bash_profile 使文件生效

2、碰到這種錯誤,那就是你的內存不足了,換機器或者添加內存吧

Error opening data file /root/project/java/tesseract_model/tessdata/chi_sim.traineddata
Please make sure the TESSDATA_PREFIX environment variable is set to the parent directory of your "tessdata" directory.
Failed loading language 'chi_sim'
Tesseract couldn't load any languages!
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f23c034ea5f, pid=3476, tid=0x00007f23c22a4700
#
# JRE version: Java(TM) SE Runtime Environment (8.0_221-b11) (build 1.8.0_221-b11)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.221-b11 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [libtesseract.so.3.0.4+0xc3a5f]  tesseract::Tesseract::recog_all_words(PAGE_RES*, ETEXT_DESC*, TBOX const*, char const*, int)+0x
#
# Core dump written. Default location: /root/project/java/vue-exercise/core or core.3476

 


免責聲明!

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



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