img1 = np.array(Image.open(filename))
text = pytesseract.image_to_string(img1,lang = "chi_sim")
print(text)
paddle-ocr
使用百度paddle框架訓(xùn)練的ocr識(shí)別模型
支持英文允蚣、中文于颖、韓語(yǔ)、法語(yǔ)等語(yǔ)言
安裝
## https://pypi.org/project/paddleocr/
pip install "paddleocr>=2.0.1" # Recommend to use version 2.0.1+
## 同時(shí)需要安裝paddle
pip install paddlepaddle
識(shí)別代碼
可以看到識(shí)別的結(jié)果及其概率
from paddleocr import PaddleOCR
import sys
# Paddleocr supports Chinese, English, French, German, Korean and Japanese.
# You can set the parameter `lang` as `ch`, `en`, `french`, `german`, `korean`, `japan`
# to switch the language model in order.
ocr = PaddleOCR(use_angle_cls=True, lang='ch') # need to run only once to download and load model into memory
img_path = sys.argv[1:]
result = ocr.ocr(img_path, cls=True)
for line in result:
print(line)