1. 程式人生 > >python+pytesseract 中文識別

python+pytesseract 中文識別

#coding = utf -8
from PIL import Image
import pytesseract

im = Image.open("2.png")
text = pytesseract.image_to_string((im), lang='chi_sim')
print (text)

'gbk' codec can't decode byte 0xbf in position 2: illegal multibyte sequence

有大佬解決了告我下~

中文包我下好了放在百度雲了,自取密碼 v13f

我實驗過對圖片加強、增加對比度等等,識別率還不如沒修改過的原圖。。

 識別:


結果

 識別:


結果:

下面是我踩過的坑

不需要改太多東西基本照著這個大佬的改就行了

https://blog.csdn.net/hk_jh/article/details/8961449

但是要是找打不到pytesser.py

看看你是不是吧pytesser.py改成 __init__.py了,比如我就是難過

如過你想要更好的識別率,試試百度的

https://cloud.baidu.com/doc/OCR/OCR-Python-SDK.html#.E6.96.B0.E5.BB.BAAipOcr