
sudo apt-get install tesseract-ocr sudo apt-get install python-imaging pip install PyTesseract 中文库 sudo apt-get install tesseract-ocr-chi-sim
import PyTesseractfrom PIL import Imageim=Image.open('/home/chenyang/PycharmProjects/python_ocr/1.png')print(PyTesseract.image_to_string(im,lang='chi_sim'))如果图片有噪点
可以进行二值化处理
import PyTesseractimport cv2from PIL import Imageimage_text=cv2.imread("/home/chenyang/PycharmProjects/python_ocr/1.png")image_text1=image_text>180image_text[image_text1]=255image_text1=image_text<130image_text[image_text1]=0im=Image.fromarray(image_text)print(PyTesseract.image_to_string(im,lang='chi_sim')) 总结 以上是内存溢出为你收集整理的python进行ocr识别图片上的中文全部内容,希望文章能够帮你解决python进行ocr识别图片上的中文所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)