安装库
pip install winocr
测试代码:
from PIL import Image
from winocr import recognize_pil_sync
def ocr(imgPath, lang="zh-CN"):
with Image.open(imgPath) as f:
s = recognize_pil_sync(f, "zh-CN")['text']
return s
if __name__ == "__main__":
img_path = r"C:\Users\44413\Desktop\2.png"
print(ocr(img_path))
效果一般般。
补充一些ocr库:
ddddocr
paddleocr
EasyOCR
Chineseocr、Chineseocr_lite
muggleocr
还有一个开源的打包成exe的库,死活找不到了
网友评论