python文字识别
2019-09-30 python 1514
import pytesseract as pyt from PIL import Image # 配置tesseract.exe的安装路径 CHANGE THIS IF TESSERACT IS NOT IN YOUR PATH, OR IS NAMED DIFFERENTLY pyt.pytesseract.tesseract_cmd = "D:\\Program Files (x86)\\Tesseract-OCR\\tesseract.exe" #将数据配置到相应的文件夹, 默认的会报错 # please make sure the TESSDATA_PREFIX environment variable is set to the parent directory of your "tessdata" directory. tessdata_dir_config = '--tessdata-dir "D:\\Program Files (x86)\\Tesseract-OCR\\tessdata"' img = Image.open("./1.png") ret = pyt.image_to_string(img,config=tessdata_dir_config) print(ret) #效率还是很快的,但是对复杂的识别率着实不高,只能识别比较规整的简单的文字
很赞哦! (0)
相关文章
文章评论
-
-
-
0条评论