프로젝트

일반

사용자정보

개정판 0d5824d5

ID0d5824d52a688e1b35310388ebc7498ec68fc6e3
상위 f48a9e89
하위 070ef1eb

humkyung 이(가) 6년 이상 전에 추가함

Add merge size option for recognizing text

차이점 보기:

DTI_PID/DTI_PID/Configuration_UI.py
11 11
class Ui_ConfigurationDialog(object):
12 12
    def setupUi(self, ConfigurationDialog):
13 13
        ConfigurationDialog.setObjectName("ConfigurationDialog")
14
        ConfigurationDialog.resize(550, 560)
14
        ConfigurationDialog.resize(550, 589)
15 15
        font = QtGui.QFont()
16 16
        font.setFamily("맑은 고딕")
17 17
        ConfigurationDialog.setFont(font)
......
226 226
        self.maxTextSizeSpinBox.setObjectName("maxTextSizeSpinBox")
227 227
        self.horizontalLayout_13.addWidget(self.maxTextSizeSpinBox)
228 228
        self.verticalLayout_5.addLayout(self.horizontalLayout_13)
229
        self.horizontalLayout_17 = QtWidgets.QHBoxLayout()
230
        self.horizontalLayout_17.setObjectName("horizontalLayout_17")
231
        self.label_22 = QtWidgets.QLabel(self.groupBoxText)
232
        self.label_22.setObjectName("label_22")
233
        self.horizontalLayout_17.addWidget(self.label_22)
234
        self.spinBoxMergeSize = QtWidgets.QSpinBox(self.groupBoxText)
235
        self.spinBoxMergeSize.setObjectName("spinBoxMergeSize")
236
        self.horizontalLayout_17.addWidget(self.spinBoxMergeSize)
237
        self.verticalLayout_5.addLayout(self.horizontalLayout_17)
229 238
        self.gridLayout_14.addLayout(self.verticalLayout_5, 0, 0, 1, 1)
230 239
        self.gridLayout_2.addWidget(self.groupBoxText, 0, 1, 1, 1)
231 240
        self.tabWidget.addTab(self.Recognition, "")
......
392 401
        self.label_21.setText(_translate("ConfigurationDialog", "침식 크기 : "))
393 402
        self.label_17.setText(_translate("ConfigurationDialog", "Minimum Text Size : "))
394 403
        self.label_18.setText(_translate("ConfigurationDialog", "Maximum Text Size : "))
404
        self.label_22.setText(_translate("ConfigurationDialog", "병합 크기 : "))
395 405
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.Recognition), _translate("ConfigurationDialog", "인식"))
396 406
        self.groupBox_2.setTitle(_translate("ConfigurationDialog", "Instrument Tag No Rule"))
397 407
        self.label_8.setText(_translate("ConfigurationDialog", "Measured Variable Code"))
DTI_PID/DTI_PID/DTI_PID.py
1167 1167

  
1168 1168
            rects.append([0 if horizontal > vertical else 90, QRect(x, y, w, h)])
1169 1169

  
1170
    configs = docData.getConfigs('Text Recognition', 'Merge Size')
1171
    mergeSize = int(configs[0].value) if 1 == len(configs) else 0
1170 1172
    # merge rectangles
1171 1173
    intersected = True
1172 1174
    while intersected:
1173 1175
        intersected = False
1174 1176
        for rect in rects[:]:
1175 1177
            if 0 == rect[0]:
1176
                rectExpand = rect[1].adjusted(-10, 0, 10, 0)
1178
                rectExpand = rect[1].adjusted(-mergeSize, 0, mergeSize, 0)
1177 1179
            else:
1178
                rectExpand = rect[1].adjusted(0, -10, 0, 10)
1180
                rectExpand = rect[1].adjusted(0, -mergeSize, 0, mergeSize)
1179 1181

  
1180 1182
            matches = [x for x in rects if (x[0] == rect[0]) and rectExpand.intersects(x[1])]
1181 1183
            if len(matches) > 1:
DTI_PID/DTI_PID/MainWindow.py
698 698
                if (w < 10 or h < 10): continue
699 699

  
700 700
                # create unknown item
701
                epsilon = cv2.arcLength(contour, True)*0.01
701
                epsilon = cv2.arcLength(contour, True)*0.001
702 702
                approx = cv2.approxPolyDP(contour, epsilon, True)
703 703
                approx = [pt[0] for pt in approx]
704 704
                item = QEngineeringUnknownItem(approx)
DTI_PID/DTI_PID/QConfigurationDialog.py
46 46
                    Jeongwoo 2018.05.18 read Small Line Minimum Length
47 47
                    Jeongwoo 2018.06.04 read Min/Max Text Size
48 48
                    Jeongwoo 2018.06.05 read Text Area Detection Method
49
                    humkyung 2018.06.20 add expand and shrink size for recognizing text
49
                    humkyung 2018.06.20 add expand,shrink and merge size for recognizing text
50 50
    '''
51 51
    def __init__(self, parent):
52 52
        QDialog.__init__(self, parent)
......
71 71
        self.ui.spinBoxExpandSize.setValue(int(configs[0].value)) if 1 == len(configs) else self.ui.spinBoxExpandSize.setValue(10)
72 72
        configs = docData.getConfigs('Text Recognition', 'Shrink Size')
73 73
        self.ui.spinBoxShrinkSize.setValue(int(configs[0].value)) if 1 == len(configs) else self.ui.spinBoxShrinkSize.setValue(0)
74
        configs = docData.getConfigs('Text Recognition', 'Merge Size')
75
        self.ui.spinBoxMergeSize.setValue(int(configs[0].value)) if 1 == len(configs) else self.ui.spinBoxMergeSize.setValue(10)
74 76

  
75 77
        configs = docData.getConfigs('Text Size', 'Min Text Size')
76 78
        self.ui.minTextSizeSpinBox.setValue(int(configs[0].value)) if 1 == len(configs) else self.ui.minTextSizeSpinBox.setValue(30)
......
181 183
            configs.append(Config('Text Area', 'Text Area', 0 if self.ui.textAreaTypeARadioButton.isChecked() else 1))
182 184
            configs.append(Config('Text Recognition', 'Expand Size', self.ui.spinBoxExpandSize.value()))
183 185
            configs.append(Config('Text Recognition', 'Shrink Size', self.ui.spinBoxShrinkSize.value()))
186
            configs.append(Config('Text Recognition', 'Merge Size', self.ui.spinBoxMergeSize.value()))
184 187
            configs.append(Config('Text Size', 'Min Text Size', self.ui.minTextSizeSpinBox.value()))
185 188
            configs.append(Config('Text Size', 'Max Text Size', self.ui.maxTextSizeSpinBox.value()))
186 189
            configs.append(Config('Size', 'Delimiter', self.ui.lineEditSizeDelimiter.text()))
DTI_PID/DTI_PID/UI/Configuration.ui
7 7
    <x>0</x>
8 8
    <y>0</y>
9 9
    <width>550</width>
10
    <height>560</height>
10
    <height>589</height>
11 11
   </rect>
12 12
  </property>
13 13
  <property name="font">
......
388 388
              </item>
389 389
             </layout>
390 390
            </item>
391
            <item>
392
             <layout class="QHBoxLayout" name="horizontalLayout_17">
393
              <item>
394
               <widget class="QLabel" name="label_22">
395
                <property name="text">
396
                 <string>병합 크기 : </string>
397
                </property>
398
               </widget>
399
              </item>
400
              <item>
401
               <widget class="QSpinBox" name="spinBoxMergeSize"/>
402
              </item>
403
             </layout>
404
            </item>
391 405
           </layout>
392 406
          </item>
393 407
         </layout>

내보내기 Unified diff

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