图像到python中的文本

时间:2018-03-14 17:48:34

标签: python-3.x pytesser

from PIL import Image
import pytesseract
import cv2
import cv2
img= cv2.imread('D:/ss.png')
pytesseract.pytesseract.tesseract_cmd="C:\Program Files (x86)\Tesseract- 
OCR\tesseract.exe'
tex = pytesseract.image_to_string(Image.open('D:/ss.png'),lang='eng')
print(pytesseract.image_to_string(Image.open('D:/ss.png'),lang='eng'))
cv2.namedWindow("input image")
cv2.imshow("Input image",img)
cv2.waitKey(0)
cv2.destroyWindow('Test')
cv2.destroyWindow('Main')

执行时显示" EOF,同时扫描弦乐立场"

有什么问题????

1 个答案:

答案 0 :(得分:0)

可能发布:

pytesseract.pytesseract.tesseract_cmd="C:\Program Files (x86)\Tesseract- 
OCR\tesseract.exe'

=>

pytesseract.pytesseract.tesseract_cmd="C:\Program Files (x86)\Tesseract- 
OCR\tesseract.exe"