프로젝트

일반

사용자정보

개정판 3716d1a5

ID3716d1a575f25685a5ef5d92743087204509cb31
상위 cb9003a4
하위 a5e06467

김정우 이(가) 약 7년 전에 추가함

Azure OCR 이용하여 텍스트 검출 시 Word 단위가 아닌 Line 단위로 검출하도록 변경

차이점 보기:

DTI_PID/DTI_PID/azure_ocr_module.py
169 169
        print(str(parsed['textAngle']))
170 170
        for cs in parsed['regions']:
171 171
            for re in cs['lines']:
172
                strArr = re['boundingBox'].split(',')
173
                width = int(strArr[2]) if orientation == "Up" or orientation == "Down" else int(strArr[3])
174
                height = int(strArr[3]) if orientation == "Up" or orientation == "Down" else int(strArr[2])
175
                pt = getCoordOnRotatedImage(orientation, int(strArr[0]), int(strArr[1]), w, h, int(strArr[2]), int(strArr[3]))
176
                text = ""
172 177
                for words in re['words']:
173 178
                    print(words)
174
                    strArr = words['boundingBox'].split(',')
175
                    text = words['text']
176
                    width = int(strArr[2]) if orientation == "Up" or orientation == "Down" else int(strArr[3])
177
                    height = int(strArr[3]) if orientation == "Up" or orientation == "Down" else int(strArr[2])
178
                    pt = getCoordOnRotatedImage(orientation, int(strArr[0]), int(strArr[1]), w, h, int(strArr[2]), int(strArr[3]))
179
                    text = text + " " + words['text']
180
                    #strArr = words['boundingBox'].split(',')
181
                    #width = int(strArr[2]) if orientation == "Up" or orientation == "Down" else int(strArr[3])
182
                    #height = int(strArr[3]) if orientation == "Up" or orientation == "Down" else int(strArr[2])
183
                    #pt = getCoordOnRotatedImage(orientation, int(strArr[0]), int(strArr[1]), w, h, int(strArr[2]), int(strArr[3]))
179 184
                    #pt = (int(strArr[0]), int(strArr[1]))
180 185
                    #width = int(strArr[2])
181 186
                    #height = int(strArr[3])
......
186 191
                    #roi = cv2.bitwise_xor(roi, tempBin, roi)
187 192
                    #tInfo.append(ti.TextInfo(text, strArr[0], strArr[1], strArr[2], strArr[3]))
188 193

  
189
                    if not(text in EXCEPTION_LIST and height < STANDARD_SIZE):
190
                        tInfo.append(ti.TextInfo(text, pt[0] + offsetX, pt[1] + offsetY, width, height, getRotatedAngleByOrientation(orientation)))
191
                        count = count + 1
194
                if not(text in EXCEPTION_LIST and height < STANDARD_SIZE):
195
                    tInfo.append(ti.TextInfo(text.strip(), pt[0] + offsetX, pt[1] + offsetY, width, height, getRotatedAngleByOrientation(orientation)))
196
                    count = count + 1
192 197

  
193 198
        print("OCR Result count : " + str(count))
194 199
            

내보내기 Unified diff

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