Getting Tesseract 5.0 To Work With Python On Windows

Recently I have been trying to create a tool that utilise Tkinter GUI to capture a certain part of the screen, then use OCR to convert the screen capture to a string and pass the string to another part of the python program.

 

I was originally thinking of using Keras or other ML framework to train my own LSTM network in order to achieve OCR. Then I came across this OCR engine by Google that is also utilising LSTM network to do text recognition, which is called Tesseract. Reading through the development docs for Tesseract, only Tesseract 4.0+ has LSTM text recognition. Unexpectedly, after I got everything working in Linux easily with Anaconda, I was having problem to deploy Tesseract 4.0+ onto my office computer (Windows 64 bit environment), and the only working version from Anaconda on Windows is 3.7.

 

This tutorial is to make the newest Tesseract 5.0 alpha to work on the windows environment with Python.

 

After a bit of research, I finally found the following method to make the whole thing work(without having to change PATH etc).

  1. Download the windows installer from https://github.com/UB-Mannheim/tesseract/wiki
  2. Manually install Tesseract to a preferred directory, in my case “C:\Program Files\Tesseract-OCR”
  3. After installation, check Tesseract version by changing into your directory in cmd

>>> cd C:\Program Files\Tesseract-OCR\

And

>>> tesseract -v

If you can see your tesseract version here, you are pretty much good to go.

    4. Install the tesseract python wrapper pytesseract by

>>>pip install pytesseract

    5. In the python application, do

>>> import pytesseract 

>>> pytesseract.pytesseract.tesseract_cmd = 'C:\\Program Files\\Tesseract-OCR\\tesseract.exe'

    6. Make use of the Tesseract python wrapper to do fun stuffs with OCR!

 

 

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值