前言
一般的图片直接进行 tesseract -OCR 成效较低、需要提前对图片进行处理
源码分享
from PIL import Image
img =Image.open(r'E:/img/zhiwang.png')
img.show() # 未处理下图一
gray = img.convert('L') #灰度化
gray.show() # 灰度化处理下图二
bw = gray.point(lambda x: 0 if x < 250 else 255,'1')
bw.show() # 二值化处理下图三
处理结果
图一

图二

图三

你这一堆回复让我直接炸锅
嘿嘿,你这源码少了。原理和源码应该深挖点
好帖,这个之前就想研究一下一直没时间,没想到现在标准答案都出来了 👍