Last active
September 12, 2020 05:45
-
-
Save parkkk123/45d89b3c58e3be4c596ec9b80d8329df to your computer and use it in GitHub Desktop.
Getting start tesseract with python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tesserocr import PyTessBaseAPI | |
from PIL import Image | |
#ใส่ Path ที่เก็บไฟล์ภาษา .traineddata | |
with PyTessBaseAPI(path='/home/..../tessdata/' ,lang="tha") as api: | |
#ลบช่องว่างแต่ละตัวอักษร | |
api.SetVariable('preserve_interword_spaces', '1') | |
#Path ของรูปภาพ | |
api.SetImageFile("Image.jpeg") | |
print(api.GetUTF8Text()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment