프로젝트

일반

사용자정보

개정판 141ec96a

ID141ec96a5d993b0fbc33c730f4b5a01cb3125f67
상위 9424bdca
하위 3442f8e9

함의성이(가) 약 5년 전에 추가함

issue #506: fix text data list sort and text item area

Change-Id: Ic3528c60eb52145e28d360393b0b9a984127a07f

차이점 보기:

DTI_PID/DTI_PID/LineNoTracer.py
896 896
                    for connector in spec[0].connectors:
897 897
                        if connector.connectedItem is spec[1]:
898 898
                            spec_break = SymbolSvgItem.createItem(symbol.getType(), None, svgFilePath)
899
                            pt = [60 + connector.center()[0] - float(symbol.getOriginalPoint().split(',')[0]),
900
                                  90 + connector.center()[1] - float(symbol.getOriginalPoint().split(',')[1])]
899
                            pt = [40 + connector.center()[0] - float(symbol.getOriginalPoint().split(',')[0]),
900
                                  60 + connector.center()[1] - float(symbol.getOriginalPoint().split(',')[1])]
901 901
                            origin = [0, 0]
902 902
                            if 2 == len(symbol.getOriginalPoint().split(',')):
903 903
                                tokens = symbol.getOriginalPoint().split(',')
DTI_PID/DTI_PID/TextDataListDialog.py
96 96
                newTextItem = textItem.edit_text()
97 97
                if newTextItem is not None:
98 98
                    self.ui.tableWidget.item(row, col).tag = newTextItem
99
                    self.ui.tableWidget.item(row, col).setText(newTextItem.text())
100 99
                    self.ui.tableWidget.cellWidget(row, col).setPlainText(newTextItem.text())
100
                    self.ui.tableWidget.item(row, col).setText(newTextItem.text())
101 101

  
102 102
        except Exception as ex:
103 103
            from App import App
DTI_PID/DTI_PID/tesseract_ocr_module.py
69 69
                2018.11.08  euisung     add config for OCR white char list
70 70
                2018.11.21  euisung     fix area moving bug
71 71
"""
72

  
73

  
74 72
def getTextInfo(img, startPoint, angle, language, flag=FLAG_IMAGE_TO_BOXES, conf=None):
75 73
    from PIL import ImageOps
76 74

  
......
138 136
            fit_width = maxX - minX
139 137
            fit_length = maxY - minY
140 138
            if fit_length < maxSize:
141
                long_img = Image.new('RGB', (maxX * 3, maxY), (255, 255, 255))
139
                long_img = Image.new('RGB', ((maxX - minX)* 3, maxY - minY), (255, 255, 255))
142 140
                fit_im = im.crop((minX + thickness, minY + thickness, minX + thickness + fit_width, minY + thickness + fit_length))
143 141
                long_img.paste(fit_im, (0, 0))
144 142
                long_img.paste(fit_im, (fit_width, 0))
......
202 200

  
203 201
            if long_img:
204 202
                text = text[:int(len(text)/ 3)]
205
                rect = QRect(rect.left() + offset_x, imgHeight - rect.bottom() + offset_y, int(rect.width()/ 3), rect.height())
206 203
            
207 204
            # skip if text is not allowed single character when text is one char
208 205
            if not text or (len(text) == 1 and text not in allowed_single_chars):
209 206
                continue
210 207
            # up to here
211 208
            if minSize <= rect.height() <= maxSize:  # TODO: 이 부분이 필요한가?
212
                text_rect = QRect(rect.left(), imgHeight - rect.bottom(), rect.width(), rect.height())
209
                if long_img:
210
                    text_rect = QRect(rect.left() + offset_x - thickness, rect.top() + offset_y - thickness, int(rect.width()/ 3), rect.height())
211
                else:
212
                    text_rect = QRect(rect.left() - thickness, imgHeight - rect.bottom() - thickness, rect.width(), rect.height())
213
                    
213 214
                if text_rect.width() < 5 or text_rect.height() < 5:
214 215
                    continue
215 216
                if angle == 90 or angle == 270:
......
219 220
                    transform.translate(-imgWidth * 0.5, -imgHeight * 0.5)
220 221
                    text_rect = transform.mapRect(text_rect)
221 222

  
222
                text_info = ti.TextInfo(text_filter(text), startPoint[0] + text_rect.left() - thickness,
223
                                        startPoint[1] + text_rect.top() - thickness,
223
                text_info = ti.TextInfo(text_filter(text), startPoint[0] + text_rect.left(),
224
                                        startPoint[1] + text_rect.top(),
224 225
                                        text_rect.width(), text_rect.height(), angle)
225 226
                textInfoList.append(text_info)
226 227

  

내보내기 Unified diff

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