개정판 1c955c14
issue #501: tile bug fixed
DTI_PID/DTI_PID/tesseract_ocr_module.py | ||
---|---|---|
71 | 71 |
""" |
72 | 72 |
def getTextInfo(img, startPoint, angle, language, flag = FLAG_IMAGE_TO_BOXES, conf = None): |
73 | 73 |
try: |
74 |
if img.shape == (0,0): |
|
75 |
return |
|
76 | 74 |
os.environ['TESSDATA_PREFIX'] = os.path.join(tesseract_path, 'tessdata') |
77 | 75 |
textInfoList = [] |
78 | 76 |
|
... | ... | |
132 | 130 |
#height = rect.height() + 4 if rect.height() + 4 <= im.size[1] else rect.height() |
133 | 131 |
#text_rect = QRect(left, top, width, height) |
134 | 132 |
cropped = im.crop((rect.left(), imgHeight - rect.bottom(), rect.right(), imgHeight - rect.top())) |
133 |
if cropped.width == 0 or cropped.height == 0: |
|
134 |
continue |
|
135 | 135 |
text = pytesseract.image_to_string(cropped, config=conf, lang=oCRLang) |
136 | 136 |
|
137 | 137 |
if rect.height() >= minSize and rect.height() <= maxSize: |
내보내기 Unified diff