带覆盖的字母识别

时间:2020-02-27 17:16:05

标签: tesseract cv2 python-tesseract

每个人。我编写代码来识别彼此相交的字母并以不同的颜色绘制(颜色可以针对不同的字符重复)。问题是如何将符号彼此分开,然后分别使用它们?

enter image description here

from PIL import Image
import pytesseract
import string

 pytesseract.pytesseract.tesseract_cmd = '...Tesseract-OCR/tesseract.exe'

image = '...\task_1_1.png'

 row_height = 86
 margin = 5
 img = Image.open(image)

 width, height = img.size
 lines = []

 for row in range(height // row_height):
  row_img = img.crop((0, row * row_height, width, (row + 1) * row_height))
  text = pytesseract.image_to_string(row_img, lang='eng')
 print (text)

0 个答案:

没有答案