프로젝트

일반

사용자정보

개정판 ff956736

IDff956736eea239a5e2246589fc534be37e127b4c
상위 7d4104df
하위 ad3bc497

김정우 이(가) 6년 이상 전에 추가함

OCR이 같은 라인인지 판별하기 위한 Rect의 높이 수정

차이점 보기:

DTI_PID/DTI_PID/tesseract_ocr_module.py
28 28

  
29 29
'''
30 30
    @history    2018.04.26  Jeongwoo    Make TextInfo object with Calculated Coords (with BoundBox Coords)
31
                2018.04.30  Jeongwoo    Add QRect.setHeight() in if-statement [(lineRect is not None and currentRect is not None) and lineRect.intersects(currentRect)]
31 32
'''
32 33
def getTextInfo(img, startPoint, flag = FLAG_IMAGE_TO_BOXES, conf = """--psm 6 -c tessedit_char_whitelist=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-~.,/!@#$%&*(){}<>:;+=?\\"\\'"""):
33 34
    im = Image.fromarray(img)
......
70 71
                lastRT = (csx+cw, csy)
71 72
                lineSp = (csx, csy)
72 73
                lastCharHeight = charHeight
73
                lineRect = QRect(lineSp[0], lineSp[1], imgWidth - lineSp[0], ch)
74
                lineRect = QRect(lineSp[0], lineSp[1], imgWidth - lineSp[0], charHeight)
74 75
            elif (lineRect is not None and currentRect is not None) and lineRect.intersects(currentRect):
75 76
                tempText = tempText + char
76 77
                lastRT = (csx+cw, min(lineSp[1], csy))
77 78
                lineSp = (lineSp[0], min(lineSp[1], csy))
78 79
                lastCharHeight = charHeight
80
                lineRect.setHeight(charHeight)
79 81
            else:
80 82
                # Save previous line
81 83
                prevLineText = ti.TextInfo(splitText[textGroupIndex], startPoint[0]+lineSp[0], startPoint[1]+lineSp[1], lastRT[0] - lineSp[0], lastCharHeight, 0)

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)