【发布时间】:2020-11-18 08:12:05
【问题描述】:
我正在尝试对来自英雄联盟大厅的文字进行图像识别,以便进行数据挖掘。
我猜它没有识别字体,因为程序的输出是:Doel seen aay
源代码:
import numpy as nm
import pytesseract
import cv2
from PIL import ImageGrab, Image
def imToString():
# Path of tesseract executable
pytesseract.pytesseract.tesseract_cmd ='C:\\Program Files\\Tesseract-OCR\\Tesseract.exe'
while(True):
cap = ImageGrab.grab(bbox =(242, 884, 561, 990))
cap.save('test.png')
tesstr = pytesseract.image_to_string(
cv2.cvtColor(nm.array(cap), cv2.COLOR_BGR2GRAY),
lang ='eng',config='--psm 7')
print(tesstr)
imToString()
【问题讨论】:
-
我应该注意到 newocr.com 能够检测到它,但其他 ocr 网站无法检测到“g”字符。很有趣,因为我的程序根本无法检测到任何东西。
标签: python python-3.x opencv python-imaging-library python-tesseract