프로젝트

일반

사용자정보

개정판 09841ec5

ID09841ec5d710d2aca4b1a6deebe5cb1b9c9b56b0
상위 876c12f2
하위 5707da6d

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

issue #000: allow multiple line text item

Change-Id: I635f21aaf046348a8b94266375a0233be5b84060

차이점 보기:

DTI_PID/DTI_PID/AppDocData.py
1109 1109
        @author humkyung
1110 1110
    '''
1111 1111
    def getSlidingWindowSize(self):
1112
        res = [10,10]
1112
        res = [10,15]
1113 1113
        try:
1114 1114
            configs = self.getConfigs('Sliding Window')
1115 1115
            for config in configs:
DTI_PID/DTI_PID/ConfigurationDialog.py
75 75
        configs = docData.getConfigs('Size', 'Delimiter')
76 76
        self.ui.lineEditSizeDelimiter.setText(configs[0].value if 1 == len(configs) else 'X')
77 77
        configs = docData.getConfigs('Range', 'Detection Ratio')
78
        self.ui.doubleSpinBoxDetectionRange.setValue(float(configs[0].value)) if 1 == len(configs) else self.ui.doubleSpinBoxDetectionRange.setValue(1.5)
78
        self.ui.doubleSpinBoxDetectionRange.setValue(float(configs[0].value)) if 1 == len(configs) else self.ui.doubleSpinBoxDetectionRange.setValue(2.5)
79 79

  
80 80
        configs = docData.getConfigs('Filter', 'MinimumSize')
81
        self.ui.spinBoxMinimumSize.setValue(int(configs[0].value)) if 1 == len(configs) else self.ui.spinBoxMinimumSize.setValue(15)
81
        self.ui.spinBoxMinimumSize.setValue(int(configs[0].value)) if 1 == len(configs) else self.ui.spinBoxMinimumSize.setValue(30)
82 82

  
83 83
        # set min,max area for small object
84 84
        configs = docData.getConfigs('Small Object Size', 'Min Area')
......
92 92
        self.ui.spinBoxHeight.setValue(windowSize[1])
93 93

  
94 94
        configs = docData.getConfigs('Small Line Minimum Length', 'Min Length')
95
        self.ui.smallLineMinLengthSpinBox.setValue(int(configs[0].value)) if 1 == len(configs) else self.ui.smallLineMinLengthSpinBox.setValue(10)
95
        self.ui.smallLineMinLengthSpinBox.setValue(int(configs[0].value)) if 1 == len(configs) else self.ui.smallLineMinLengthSpinBox.setValue(25)
96 96
        configs = docData.getConfigs('Line Detector', 'Length to connect line')
97
        if configs: self.ui.spinBoxLengthToConnectLine.setValue(int(configs[0].value))
97
        if configs: self.ui.spinBoxLengthToConnectLine.setValue(int(configs[0].value)) if 1 == len(configs) else self.ui.spinBoxLengthToConnectLine.setValue(20)
98 98

  
99 99
        properties = docData.getLineProperties()
100 100
        if properties:
DTI_PID/DTI_PID/MainWindow.py
1727 1727
            for line in appDocData.lines:
1728 1728
                self.graphicsView.scene.addItem(line)
1729 1729
                line.transfer.onRemoved.connect(self.itemRemoved)
1730
                #for conn in line.connectors:
1731
                #    conn.transfer.onPosChanged.connect(line.onConnectorPosChaned)
1730
                for conn in line.connectors:
1731
                    conn.transfer.onPosChanged.connect(line.onConnectorPosChaned)
1732 1732

  
1733 1733
            for unknown in appDocData.unknowns + appDocData.lineIndicators:
1734 1734
                self.graphicsView.scene.addItem(unknown)
DTI_PID/DTI_PID/OcrResultDialog.py
3 3
    This is ocr result dialog module
4 4
"""
5 5
from PIL import Image
6
import io
6
import io, sys
7 7
import numpy as np
8 8
import math
9 9
from PyQt5.QtCore import *
......
151 151
                    18.04.26    Jeongwoo    Scene.itemAt(textX - boundBox.x(), textY - boundBox.y())
152 152
    '''
153 153
    def accept(self):
154
        from TextInfo import TextInfo
154 155
        self.isAccepted = True
155 156

  
156 157
        try:
......
159 160
                QMessageBox.about(self.ui.ocrDialogButtonBox, 'Notice', 'Please try again after recognition or type.')
160 161
                return
161 162

  
162
            splitText = text.split('\n')
163
            isSplit = self.ui.checkBoxSeperate.isChecked()
164
            if isSplit:
165
                splitText = text.split('\n')
166
            else:
167
                splitText = [text]
163 168

  
164 169
            if not len(self.textInfoList) > 0:
165
                import cv2, sys
166
                from TextInfo import TextInfo
170
                import cv2
167 171
                #QMessageBox.about(self.ui.ocrDialogButtonBox, "알림", "텍스트 검출을 하신 후 다시 시도해주세요.")
168 172
                
169 173
                buffer = QBuffer()
......
193 197
                
194 198
                self.textInfoList.append(TextInfo(text, minX, minY, maxX - minX, maxY - minY, 0))
195 199

  
200
            if not isSplit:
201
                minX, minY, maxX, maxY = sys.maxsize, sys.maxsize, 0, 0
202
                for textInfo in self.textInfoList:
203
                    x, y, w, h = textInfo.getX() ,textInfo.getY(), textInfo.getW(), textInfo.getH()
204
                    minX = min(x ,minX)
205
                    minY = min(y, minY)
206
                    maxX = max(x + w, maxX)
207
                    maxY = max(y + h, maxY)
208
                
209
                self.textInfoList = [TextInfo(text, minX, minY, maxX - minX, maxY - minY, 0)]
210

  
196 211
            if len(self.textInfoList) > 0:
197 212
                for index in range(len(splitText)):
198 213
                    textInfo = self.textInfoList[index]
DTI_PID/DTI_PID/OcrResultDialog_UI.py
1 1
# -*- coding: utf-8 -*-
2 2

  
3
# Form implementation generated from reading ui file '.\UI\OcrResultDialog.ui'
3
# Form implementation generated from reading ui file './UI/OcrResultDialog.ui'
4 4
#
5 5
# Created by: PyQt5 UI code generator 5.11.3
6 6
#
......
88 88
        self.detectResultVerticalLayout_2 = QtWidgets.QVBoxLayout()
89 89
        self.detectResultVerticalLayout_2.setContentsMargins(8, 8, 8, 8)
90 90
        self.detectResultVerticalLayout_2.setObjectName("detectResultVerticalLayout_2")
91
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
92
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
91 93
        self.detectResultLabel_2 = QtWidgets.QLabel(self.bottomWidget)
92 94
        font = QtGui.QFont()
93 95
        font.setBold(True)
94 96
        font.setWeight(75)
95 97
        self.detectResultLabel_2.setFont(font)
96 98
        self.detectResultLabel_2.setObjectName("detectResultLabel_2")
97
        self.detectResultVerticalLayout_2.addWidget(self.detectResultLabel_2)
99
        self.horizontalLayout_3.addWidget(self.detectResultLabel_2)
100
        spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
101
        self.horizontalLayout_3.addItem(spacerItem)
102
        self.checkBoxSeperate = QtWidgets.QCheckBox(self.bottomWidget)
103
        self.checkBoxSeperate.setChecked(True)
104
        self.checkBoxSeperate.setObjectName("checkBoxSeperate")
105
        self.horizontalLayout_3.addWidget(self.checkBoxSeperate)
106
        self.detectResultVerticalLayout_2.addLayout(self.horizontalLayout_3)
98 107
        self.detectResultTextEdit = QtWidgets.QTextEdit(self.bottomWidget)
99 108
        font = QtGui.QFont()
100 109
        font.setFamily("Consolas")
......
133 142
        self.counterClockPushButton_2.setToolTip(_translate("Dialog", "반시계 방향 회전"))
134 143
        self.clockPushButton_2.setToolTip(_translate("Dialog", "시계 방향 회전"))
135 144
        self.detectResultLabel_2.setText(_translate("Dialog", "Recognition Result"))
145
        self.checkBoxSeperate.setText(_translate("Dialog", "Seperate"))
136 146
        self.pushButtonMakeTrainingImage.setText(_translate("Dialog", "Save OCR Training Image"))
137 147

  
138 148
import MainWindow_rc
DTI_PID/DTI_PID/Shapes/EngineeringAbstractItem.py
242 242
                        _attrs[attr] = eval(attr.Expression) if attr.Expression else ''
243 243
                    else:
244 244
                        _attrs[attr] = ''
245
            
245

  
246
            for _attr,_value in _attrs.items():
247
                if _value is None or _value == '':
248
                    _attr.AssocItem = None
249

  
246 250
            self.attrs = _attrs ### assign self.attrs
247 251
        except Exception as ex:
248 252
            from App import App 
DTI_PID/DTI_PID/UI/OcrResultDialog.ui
209 209
          <number>8</number>
210 210
         </property>
211 211
         <item>
212
          <widget class="QLabel" name="detectResultLabel_2">
213
           <property name="font">
214
            <font>
215
             <weight>75</weight>
216
             <bold>true</bold>
217
            </font>
218
           </property>
219
           <property name="text">
220
            <string>Recognition Result</string>
221
           </property>
222
          </widget>
212
          <layout class="QHBoxLayout" name="horizontalLayout_3">
213
           <item>
214
            <widget class="QLabel" name="detectResultLabel_2">
215
             <property name="font">
216
              <font>
217
               <weight>75</weight>
218
               <bold>true</bold>
219
              </font>
220
             </property>
221
             <property name="text">
222
              <string>Recognition Result</string>
223
             </property>
224
            </widget>
225
           </item>
226
           <item>
227
            <spacer name="horizontalSpacer">
228
             <property name="orientation">
229
              <enum>Qt::Horizontal</enum>
230
             </property>
231
             <property name="sizeHint" stdset="0">
232
              <size>
233
               <width>40</width>
234
               <height>20</height>
235
              </size>
236
             </property>
237
            </spacer>
238
           </item>
239
           <item>
240
            <widget class="QCheckBox" name="checkBoxSeperate">
241
             <property name="text">
242
              <string>Seperate</string>
243
             </property>
244
             <property name="checked">
245
              <bool>true</bool>
246
             </property>
247
            </widget>
248
           </item>
249
          </layout>
223 250
         </item>
224 251
         <item>
225 252
          <widget class="QTextEdit" name="detectResultTextEdit">

내보내기 Unified diff

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