프로젝트

일반

사용자정보

개정판 4cf27a9b

ID4cf27a9b4950d21fa8d02e09493d648cf8f45db3
상위 852b0eff
하위 86c2d86a, aa576697

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

issue #480: add line detection option

Change-Id: I077ea988cf28abc8e1545280a8de7cb5c708541a

차이점 보기:

DTI_PID/DTI_PID/ConfigurationDialog.py
176 176
        else:
177 177
            self.ui.radioButtonDiagonalYes.setChecked(False)
178 178
            self.ui.radioButtonDiagonalNo.setChecked(True)
179
        configs = docData.getConfigs('Line', 'Gap')
180
        if configs:
181
            size = int(configs[0].value)
182
            self.ui.radioButtonGapYes.setChecked(True if size == 1 else False)
183
            self.ui.radioButtonGapNo.setChecked(True if size == -1 else False)
184
        else:
185
            self.ui.radioButtonGapYes.setChecked(False)
186
            self.ui.radioButtonGapNo.setChecked(True)
179 187

  
180 188
        configs = docData.getConfigs('Text', 'Background')
181 189
        if configs:
......
926 934
                Config('Line Detector', 'Length to connect line', self.ui.spinBoxLengthToConnectLine.value()))
927 935
            configs.append(Config('Line', 'Default Type', self.ui.comboBoxLineType.currentText()))
928 936
            configs.append(Config('Line', 'Diagonal', '1' if self.ui.radioButtonDiagonalYes.isChecked() else '-1'))
937
            configs.append(Config('Line', 'Gap', '1' if self.ui.radioButtonGapYes.isChecked() else '-1'))
929 938
            configs.append(Config('Text', 'Background', '1' if self.ui.radioButtonBackTextYes.isChecked() else '-1'))
930 939
            configs.append(Config('Note No Tag Rule', 'Note No Expression', self.ui.lineEditNoteNoExpression.text()))
931 940
            configs.append(Config('Note No Tag Rule', 'Note No Symbol Name', self.ui.lineEditNoteNoSymbolName.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(768, 739)
14
        ConfigurationDialog.resize(768, 766)
15 15
        font = QtGui.QFont()
16 16
        font.setFamily("맑은 고딕")
17 17
        ConfigurationDialog.setFont(font)
......
283 283
        self.spinBoxLengthToConnectLine.setProperty("value", 20)
284 284
        self.spinBoxLengthToConnectLine.setObjectName("spinBoxLengthToConnectLine")
285 285
        self.gridLayout_11.addWidget(self.spinBoxLengthToConnectLine, 3, 1, 1, 1)
286
        self.spinBoxMinArea = QtWidgets.QSpinBox(self.groupBox)
287
        self.spinBoxMinArea.setMinimumSize(QtCore.QSize(100, 0))
288
        self.spinBoxMinArea.setObjectName("spinBoxMinArea")
289
        self.gridLayout_11.addWidget(self.spinBoxMinArea, 0, 1, 1, 1)
290 286
        self.smallLineMinLengthSpinBox = QtWidgets.QSpinBox(self.groupBox)
291 287
        self.smallLineMinLengthSpinBox.setMinimumSize(QtCore.QSize(100, 0))
292 288
        self.smallLineMinLengthSpinBox.setObjectName("smallLineMinLengthSpinBox")
......
298 294
        self.spinBoxWidth.setMinimumSize(QtCore.QSize(100, 0))
299 295
        self.spinBoxWidth.setObjectName("spinBoxWidth")
300 296
        self.gridLayout_11.addWidget(self.spinBoxWidth, 1, 1, 1, 1)
297
        self.spinBoxMinArea = QtWidgets.QSpinBox(self.groupBox)
298
        self.spinBoxMinArea.setMinimumSize(QtCore.QSize(100, 0))
299
        self.spinBoxMinArea.setObjectName("spinBoxMinArea")
300
        self.gridLayout_11.addWidget(self.spinBoxMinArea, 0, 1, 1, 1)
301 301
        self.label_4 = QtWidgets.QLabel(self.groupBox)
302 302
        self.label_4.setObjectName("label_4")
303 303
        self.gridLayout_11.addWidget(self.label_4, 0, 0, 1, 1)
304
        self.label_16 = QtWidgets.QLabel(self.groupBox)
305
        self.label_16.setObjectName("label_16")
306
        self.gridLayout_11.addWidget(self.label_16, 2, 0, 1, 1)
307
        self.label_9 = QtWidgets.QLabel(self.groupBox)
308
        self.label_9.setObjectName("label_9")
309
        self.gridLayout_11.addWidget(self.label_9, 3, 0, 1, 1)
310 304
        self.label = QtWidgets.QLabel(self.groupBox)
311 305
        self.label.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
312 306
        self.label.setObjectName("label")
......
315 309
        self.label_5.setAlignment(QtCore.Qt.AlignCenter)
316 310
        self.label_5.setObjectName("label_5")
317 311
        self.gridLayout_11.addWidget(self.label_5, 0, 2, 1, 1)
318
        self.spinBoxHeight = QtWidgets.QSpinBox(self.groupBox)
319
        self.spinBoxHeight.setMinimumSize(QtCore.QSize(100, 0))
320
        self.spinBoxHeight.setObjectName("spinBoxHeight")
321
        self.gridLayout_11.addWidget(self.spinBoxHeight, 1, 2, 1, 1)
312
        self.label_35 = QtWidgets.QLabel(self.groupBox)
313
        self.label_35.setObjectName("label_35")
314
        self.gridLayout_11.addWidget(self.label_35, 6, 0, 1, 1)
322 315
        self.label_28 = QtWidgets.QLabel(self.groupBox)
323 316
        self.label_28.setObjectName("label_28")
324 317
        self.gridLayout_11.addWidget(self.label_28, 4, 0, 1, 1)
325
        spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
326
        self.gridLayout_11.addItem(spacerItem1, 0, 4, 1, 1)
327
        self.spinBoxMaxArea = QtWidgets.QSpinBox(self.groupBox)
328
        self.spinBoxMaxArea.setMinimumSize(QtCore.QSize(100, 0))
329
        self.spinBoxMaxArea.setObjectName("spinBoxMaxArea")
330
        self.gridLayout_11.addWidget(self.spinBoxMaxArea, 0, 3, 1, 1)
331
        self.label_35 = QtWidgets.QLabel(self.groupBox)
332
        self.label_35.setObjectName("label_35")
333
        self.gridLayout_11.addWidget(self.label_35, 5, 0, 1, 1)
334 318
        self.radioButtonDiagonalYes = QtWidgets.QRadioButton(self.groupBox)
335 319
        self.radioButtonDiagonalYes.setObjectName("radioButtonDiagonalYes")
336 320
        self.buttonGroup_3 = QtWidgets.QButtonGroup(ConfigurationDialog)
337 321
        self.buttonGroup_3.setObjectName("buttonGroup_3")
338 322
        self.buttonGroup_3.addButton(self.radioButtonDiagonalYes)
339
        self.gridLayout_11.addWidget(self.radioButtonDiagonalYes, 5, 1, 1, 1)
323
        self.gridLayout_11.addWidget(self.radioButtonDiagonalYes, 6, 1, 1, 1)
324
        self.label_16 = QtWidgets.QLabel(self.groupBox)
325
        self.label_16.setObjectName("label_16")
326
        self.gridLayout_11.addWidget(self.label_16, 2, 0, 1, 1)
327
        self.spinBoxHeight = QtWidgets.QSpinBox(self.groupBox)
328
        self.spinBoxHeight.setMinimumSize(QtCore.QSize(100, 0))
329
        self.spinBoxHeight.setObjectName("spinBoxHeight")
330
        self.gridLayout_11.addWidget(self.spinBoxHeight, 1, 2, 1, 1)
331
        self.spinBoxMaxArea = QtWidgets.QSpinBox(self.groupBox)
332
        self.spinBoxMaxArea.setMinimumSize(QtCore.QSize(100, 0))
333
        self.spinBoxMaxArea.setObjectName("spinBoxMaxArea")
334
        self.gridLayout_11.addWidget(self.spinBoxMaxArea, 0, 3, 1, 1)
340 335
        self.radioButtonDiagonalNo = QtWidgets.QRadioButton(self.groupBox)
341 336
        self.radioButtonDiagonalNo.setObjectName("radioButtonDiagonalNo")
342 337
        self.buttonGroup_3.addButton(self.radioButtonDiagonalNo)
343
        self.gridLayout_11.addWidget(self.radioButtonDiagonalNo, 5, 2, 1, 1)
338
        self.gridLayout_11.addWidget(self.radioButtonDiagonalNo, 6, 2, 1, 1)
339
        spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
340
        self.gridLayout_11.addItem(spacerItem1, 0, 4, 1, 1)
341
        self.label_9 = QtWidgets.QLabel(self.groupBox)
342
        self.label_9.setObjectName("label_9")
343
        self.gridLayout_11.addWidget(self.label_9, 3, 0, 1, 1)
344
        self.label_45 = QtWidgets.QLabel(self.groupBox)
345
        self.label_45.setObjectName("label_45")
346
        self.gridLayout_11.addWidget(self.label_45, 5, 0, 1, 1)
347
        self.radioButtonGapYes = QtWidgets.QRadioButton(self.groupBox)
348
        self.radioButtonGapYes.setObjectName("radioButtonGapYes")
349
        self.buttonGroup_5 = QtWidgets.QButtonGroup(ConfigurationDialog)
350
        self.buttonGroup_5.setObjectName("buttonGroup_5")
351
        self.buttonGroup_5.addButton(self.radioButtonGapYes)
352
        self.gridLayout_11.addWidget(self.radioButtonGapYes, 5, 1, 1, 1)
353
        self.radioButtonGapNo = QtWidgets.QRadioButton(self.groupBox)
354
        self.radioButtonGapNo.setObjectName("radioButtonGapNo")
355
        self.buttonGroup_5.addButton(self.radioButtonGapNo)
356
        self.gridLayout_11.addWidget(self.radioButtonGapNo, 5, 2, 1, 1)
344 357
        self.gridLayout_5.addLayout(self.gridLayout_11, 0, 0, 1, 1)
345 358
        self.gridLayout_21.addWidget(self.groupBox, 0, 1, 1, 1)
346 359
        self.groupBoxEquipTag = QtWidgets.QGroupBox(self.Recognition2)
......
799 812
        self.pushButtonDeleteProperty.setText(_translate("ConfigurationDialog", "Delete"))
800 813
        self.groupBox.setTitle(_translate("ConfigurationDialog", "Line Detection"))
801 814
        self.label_4.setText(_translate("ConfigurationDialog", "Ignore Small Object Size : "))
802
        self.label_16.setText(_translate("ConfigurationDialog", "Line Minimum Length : "))
803
        self.label_9.setText(_translate("ConfigurationDialog", "Length to Connect Line : "))
804 815
        self.label.setText(_translate("ConfigurationDialog", "Sliding Window Size(WxH) : "))
805 816
        self.label_5.setText(_translate("ConfigurationDialog", "< Area < "))
806
        self.label_28.setText(_translate("ConfigurationDialog", "Default Line Type : "))
807 817
        self.label_35.setText(_translate("ConfigurationDialog", "Diagonal Detection : "))
818
        self.label_28.setText(_translate("ConfigurationDialog", "Default Line Type : "))
808 819
        self.radioButtonDiagonalYes.setText(_translate("ConfigurationDialog", "Yes"))
820
        self.label_16.setText(_translate("ConfigurationDialog", "Line Minimum Length : "))
809 821
        self.radioButtonDiagonalNo.setText(_translate("ConfigurationDialog", "No"))
822
        self.label_9.setText(_translate("ConfigurationDialog", "Length to Connect Line : "))
823
        self.label_45.setText(_translate("ConfigurationDialog", "Detect Without Symbol"))
824
        self.radioButtonGapYes.setText(_translate("ConfigurationDialog", "Yes"))
825
        self.radioButtonGapNo.setText(_translate("ConfigurationDialog", "No"))
810 826
        self.groupBoxEquipTag.setTitle(_translate("ConfigurationDialog", "Equipment Tag No"))
811 827
        self.pushButtonDeleteTagProperty.setText(_translate("ConfigurationDialog", "Delete"))
812 828
        self.pushButtonAddTagProperty.setText(_translate("ConfigurationDialog", "Add"))
DTI_PID/DTI_PID/RecognitionDialog.py
751 751
                        connectedLines.extend(res)
752 752

  
753 753
            # line detection without symbol connection point info
754
            remainLines = detector.detect_line_without_symbol()
755
            windowSize = app_doc_data.getSlidingWindowSize()
756
            thickness = int(windowSize[1])
757

  
758
            configs = app_doc_data.getConfigs('Line', 'Diagonal')
759
            if configs and int(configs[0].value) is not 1:
760
                diagonal = HoughBundler()
761
                for index in reversed(range(len(remainLines))):
762
                    angle = diagonal.get_orientation([remainLines[index][0][0], remainLines[index][0][1], remainLines[index][1][0], remainLines[index][1][1]])
763
                    if not (angle < 3 or angle > 87):
764
                        remainLines.pop(index)
765

  
766
            for line in remainLines:
767
                line.append(thickness)
768
            connectedLines.extend(remainLines)
754
            configs = app_doc_data.getConfigs('Line', 'Gap')
755
            if configs and int(configs[0].value) is 1:
756
                remainLines = detector.detect_line_without_symbol()
757
                windowSize = app_doc_data.getSlidingWindowSize()
758
                thickness = int(windowSize[1])
759

  
760
                configs = app_doc_data.getConfigs('Line', 'Diagonal')
761
                if configs and int(configs[0].value) is not 1:
762
                    diagonal = HoughBundler()
763
                    for index in reversed(range(len(remainLines))):
764
                        angle = diagonal.get_orientation([remainLines[index][0][0], remainLines[index][0][1], remainLines[index][1][0], remainLines[index][1][1]])
765
                        if not (angle < 3 or angle > 87):
766
                            remainLines.pop(index)
767

  
768
                for line in remainLines:
769
                    line.append(thickness)
770
                connectedLines.extend(remainLines)
769 771

  
770 772
            configs = app_doc_data.getConfigs('Line Detector', 'Length to connect line')
771 773
            toler = int(configs[0].value) if configs else 20
DTI_PID/DTI_PID/UI/Configuration.ui
604 604
              </property>
605 605
             </widget>
606 606
            </item>
607
            <item row="0" column="1">
608
             <widget class="QSpinBox" name="spinBoxMinArea">
607
            <item row="2" column="1">
608
             <widget class="QSpinBox" name="smallLineMinLengthSpinBox">
609 609
              <property name="minimumSize">
610 610
               <size>
611 611
                <width>100</width>
......
614 614
              </property>
615 615
             </widget>
616 616
            </item>
617
            <item row="2" column="1">
618
             <widget class="QSpinBox" name="smallLineMinLengthSpinBox">
617
            <item row="4" column="1" colspan="2">
618
             <widget class="QComboBox" name="comboBoxLineType"/>
619
            </item>
620
            <item row="1" column="1">
621
             <widget class="QSpinBox" name="spinBoxWidth">
619 622
              <property name="minimumSize">
620 623
               <size>
621 624
                <width>100</width>
......
624 627
              </property>
625 628
             </widget>
626 629
            </item>
627
            <item row="4" column="1" colspan="2">
628
             <widget class="QComboBox" name="comboBoxLineType"/>
629
            </item>
630
            <item row="1" column="1">
631
             <widget class="QSpinBox" name="spinBoxWidth">
630
            <item row="0" column="1">
631
             <widget class="QSpinBox" name="spinBoxMinArea">
632 632
              <property name="minimumSize">
633 633
               <size>
634 634
                <width>100</width>
......
644 644
              </property>
645 645
             </widget>
646 646
            </item>
647
            <item row="2" column="0">
648
             <widget class="QLabel" name="label_16">
649
              <property name="text">
650
               <string>Line Minimum Length : </string>
651
              </property>
652
             </widget>
653
            </item>
654
            <item row="3" column="0">
655
             <widget class="QLabel" name="label_9">
656
              <property name="text">
657
               <string>Length to Connect Line : </string>
658
              </property>
659
             </widget>
660
            </item>
661 647
            <item row="1" column="0">
662 648
             <widget class="QLabel" name="label">
663 649
              <property name="text">
......
678 664
              </property>
679 665
             </widget>
680 666
            </item>
667
            <item row="6" column="0">
668
             <widget class="QLabel" name="label_35">
669
              <property name="text">
670
               <string>Diagonal Detection : </string>
671
              </property>
672
             </widget>
673
            </item>
674
            <item row="4" column="0">
675
             <widget class="QLabel" name="label_28">
676
              <property name="text">
677
               <string>Default Line Type : </string>
678
              </property>
679
             </widget>
680
            </item>
681
            <item row="6" column="1">
682
             <widget class="QRadioButton" name="radioButtonDiagonalYes">
683
              <property name="text">
684
               <string>Yes</string>
685
              </property>
686
              <attribute name="buttonGroup">
687
               <string notr="true">buttonGroup_3</string>
688
              </attribute>
689
             </widget>
690
            </item>
691
            <item row="2" column="0">
692
             <widget class="QLabel" name="label_16">
693
              <property name="text">
694
               <string>Line Minimum Length : </string>
695
              </property>
696
             </widget>
697
            </item>
681 698
            <item row="1" column="2">
682 699
             <widget class="QSpinBox" name="spinBoxHeight">
683 700
              <property name="minimumSize">
......
688 705
              </property>
689 706
             </widget>
690 707
            </item>
691
            <item row="4" column="0">
692
             <widget class="QLabel" name="label_28">
708
            <item row="0" column="3">
709
             <widget class="QSpinBox" name="spinBoxMaxArea">
710
              <property name="minimumSize">
711
               <size>
712
                <width>100</width>
713
                <height>0</height>
714
               </size>
715
              </property>
716
             </widget>
717
            </item>
718
            <item row="6" column="2">
719
             <widget class="QRadioButton" name="radioButtonDiagonalNo">
693 720
              <property name="text">
694
               <string>Default Line Type : </string>
721
               <string>No</string>
695 722
              </property>
723
              <attribute name="buttonGroup">
724
               <string notr="true">buttonGroup_3</string>
725
              </attribute>
696 726
             </widget>
697 727
            </item>
698 728
            <item row="0" column="4">
......
708 738
              </property>
709 739
             </spacer>
710 740
            </item>
711
            <item row="0" column="3">
712
             <widget class="QSpinBox" name="spinBoxMaxArea">
713
              <property name="minimumSize">
714
               <size>
715
                <width>100</width>
716
                <height>0</height>
717
               </size>
741
            <item row="3" column="0">
742
             <widget class="QLabel" name="label_9">
743
              <property name="text">
744
               <string>Length to Connect Line : </string>
718 745
              </property>
719 746
             </widget>
720 747
            </item>
721 748
            <item row="5" column="0">
722
             <widget class="QLabel" name="label_35">
749
             <widget class="QLabel" name="label_45">
723 750
              <property name="text">
724
               <string>Diagonal Detection : </string>
751
               <string>Detect Without Symbol</string>
725 752
              </property>
726 753
             </widget>
727 754
            </item>
728 755
            <item row="5" column="1">
729
             <widget class="QRadioButton" name="radioButtonDiagonalYes">
756
             <widget class="QRadioButton" name="radioButtonGapYes">
730 757
              <property name="text">
731 758
               <string>Yes</string>
732 759
              </property>
733 760
              <attribute name="buttonGroup">
734
               <string notr="true">buttonGroup_3</string>
761
               <string notr="true">buttonGroup_5</string>
735 762
              </attribute>
736 763
             </widget>
737 764
            </item>
738 765
            <item row="5" column="2">
739
             <widget class="QRadioButton" name="radioButtonDiagonalNo">
766
             <widget class="QRadioButton" name="radioButtonGapNo">
740 767
              <property name="text">
741 768
               <string>No</string>
742 769
              </property>
743 770
              <attribute name="buttonGroup">
744
               <string notr="true">buttonGroup_3</string>
771
               <string notr="true">buttonGroup_5</string>
745 772
              </attribute>
746 773
             </widget>
747 774
            </item>
......
1568 1595
  </connection>
1569 1596
 </connections>
1570 1597
 <buttongroups>
1598
  <buttongroup name="buttonGroup_4"/>
1571 1599
  <buttongroup name="buttonGroup_2"/>
1572
  <buttongroup name="buttonGroup"/>
1573 1600
  <buttongroup name="buttonGroup_3"/>
1574
  <buttongroup name="buttonGroup_4"/>
1601
  <buttongroup name="buttonGroup"/>
1602
  <buttongroup name="buttonGroup_5"/>
1575 1603
 </buttongroups>
1576 1604
</ui>

내보내기 Unified diff

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