Tesseract running error

后端 未结 11 1179
情书的邮戳
情书的邮戳 2020-11-29 21:08

I have a problem with running tesseract-ocr engine on linux. I\'ve downloaded RUS language data and put it to tessdata directory (/usr/local/share/tessdata). When I\'m tryin

相关标签:
11条回答
  • 2020-11-29 21:32

    No previous solution worked for me.

    I've installed both by apt-get and manually downloading the tessdata, moved around /usr and so on and no one worked even if i exported the variable thousand times.

    Finally, on a last try before start to cry i've tried to pass the path directly to the instance of Tesseract().

    In Python: tr = Tesseract("/usr/local/share/tesseract-ocr/") and now it works. To clarify, im using tesserwrap module.

    0 讨论(0)
  • 2020-11-29 21:34

    I had this error too on the Windows machine.

    My solution.

    1) Download your language files from https://github.com/tesseract-ocr/tessdata/tree/3.04.00

    For example, for eng, I downloaded all files with eng prefix.

    2) Put them into tessdata directory inside of some folder. Add this folder into System Path variables as TESSDATA_PREFIX.

    Result will be System env var: TESSDATA_PREFIX=D:/Java/OCR And OCR folder has tessdata with languages files.

    This is a screenshot of the directory:

    0 讨论(0)
  • 2020-11-29 21:36
    tessdata_dir_config = r'--tessdata-dir "/usr/local/Cellar/tesseract/4.1.1/share/tessdata"'
    pytesseract.image_to_string(imgCrop,lang='eng',config=tessdata_dir_config)
    
    0 讨论(0)
  • 2020-11-29 21:37

    You can grab eng.traineddata Github:

    wget https://github.com/tesseract-ocr/tessdata/raw/master/eng.traineddata
    

    Check https://github.com/tesseract-ocr/tessdata for a full list of trained language data.

    When you grab the file(s), move them to the /usr/local/share/tessdata folder. Warning: some Linux distributions (such as openSUSE and Ubuntu) may be expecting it in /usr/share/tessdata instead.

    # If you got the data from Google, unzip it first!
    gunzip eng.traineddata.gz 
    # Move the data
    sudo mv -v eng.traineddata /usr/local/share/tessdata/
    
    0 讨论(0)
  • 2020-11-29 21:37

    For Windows Users:

    In Environment Variables, add a new variable in system variable with name "TESSDATA_PREFIX" and value is "C:\Program Files (x86)\Tesseract-OCR\tessdata"

    0 讨论(0)
提交回复
热议问题