python ocr使用(python培训)

网友投稿 277 2022-08-27


python ocr使用(python培训)

pip install pillowpip install pytesseractpip install tesseract-ocr## 若安装失败去下载 import Imageexcept ImportError: from PIL import Imageimport pytesseractpytesseract.pytesseract.tesseract_cmd = ''# Include the above line, if you don't have tesseract executable in your PATH# Example tesseract_cmd: 'C:\\Program Files (x86)\\Tesseract-OCR\\tesseract'print(pytesseract.image_to_string(Image.open('test.png')))print(pytesseract.image_to_string(Image.open('test-european.jpg'), lang='fra'))Add the following config, if you have tessdata error like: “Error opening data file…”tessdata_dir_config = '--tessdata-dir ""'# Example config: '--tessdata-dir "C:\\Program Files (x86)\\Tesseract-OCR\\tessdata"'# It's important to add double quotes around the dir path.若该目录下没有chi_sim.traineddata则去lang='chi_sim', config=tessdata_dir_config)


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:python内置函数 dir(__builtins__)
下一篇:SpringBoot发送短信验证码的实例
相关文章

 发表评论

暂时没有评论,来抢沙发吧~