개정판 eb1b53b1
issue #663: restore blind flange setting, add ai threshold
Change-Id: I3b43a31a05a295dfbb5e61aeed5753dd3c46f030
DTI_PID/DTI_PID/ConfigurationDialog.py | ||
---|---|---|
499 | 499 |
size = int(configs[0].value) |
500 | 500 |
self.ui.radioButtonSymbolLocal.setChecked(True if size == 1 else False) |
501 | 501 |
self.ui.radioButtonSymbolServer.setChecked(True if size == -1 else False) |
502 |
self.ui.spinBoxServerSymbol.setEnabled(True if size == -1 else False) |
|
502 | 503 |
else: |
503 | 504 |
self.ui.radioButtonSymbolLocal.setChecked(True) |
504 | 505 |
self.ui.radioButtonSymbolServer.setChecked(False) |
506 |
self.ui.spinBoxServerSymbol.setEnabled(False) |
|
507 | ||
508 |
configs = docData.getConfigs('Engine', 'Threshold') |
|
509 |
self.ui.spinBoxServerSymbol.setValue(int(configs[0].value) if configs else 25) |
|
510 | ||
505 | 511 |
configs = docData.getConfigs('Engine', 'OCR') |
506 | 512 |
if configs: |
507 | 513 |
size = int(configs[0].value) |
... | ... | |
538 | 544 |
self.ui.tableViewTagNo.doubleClicked.connect(self.tagNoItemDoubleClicked) |
539 | 545 |
self.ui.pushButtonClearAccessInfo.clicked.connect(self.clear_drawing_access_info_clicked) |
540 | 546 |
self.ui.pushButtonServerTest.clicked.connect(self.on_test_connection_clicked) |
547 |
self.ui.buttonGroup_7.buttonClicked.connect(self.symbol_engine_change) # symbol engine group |
|
541 | 548 | |
542 | 549 |
# close when user press escape key |
543 | 550 |
shortcut = QShortcut(QKeySequence(Qt.Key_Escape), self) |
... | ... | |
557 | 564 |
f"{sys.exc_info()[-1].tb_lineno}" |
558 | 565 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
559 | 566 | |
567 |
def symbol_engine_change(self): |
|
568 |
if self.ui.radioButtonSymbolServer.isChecked(): |
|
569 |
self.ui.spinBoxServerSymbol.setEnabled(True) |
|
570 |
else: |
|
571 |
self.ui.spinBoxServerSymbol.setEnabled(False) |
|
572 | ||
560 | 573 |
def on_test_connection_clicked(self): |
561 | 574 |
""" web server connection test """ |
562 | 575 |
from AppWebService import AppWebService |
... | ... | |
1169 | 1182 |
configs.append(Config('Engine', 'Address', self.ui.lineEditServerAddress.text())) |
1170 | 1183 |
configs.append(Config('Engine', 'Text Area', '1' if self.ui.radioButtonTextAreaLocal.isChecked() else '-1')) |
1171 | 1184 |
configs.append(Config('Engine', 'Symbol', '1' if self.ui.radioButtonSymbolLocal.isChecked() else '-1')) |
1185 |
configs.append(Config('Engine', 'Threshold', str(self.ui.spinBoxServerSymbol.value()))) |
|
1172 | 1186 |
configs.append(Config('Engine', 'OCR', '1' if self.ui.radioButtonOCRLocal.isChecked() else '-1')) |
1173 | 1187 |
configs.append(Config('Project', 'Operation', '1' if self.ui.radioButtonOpModeGenenal.isChecked() else '-1')) |
1174 | 1188 |
DTI_PID/DTI_PID/Configuration_UI.py | ||
---|---|---|
1 | 1 |
# -*- coding: utf-8 -*- |
2 | 2 | |
3 |
# Form implementation generated from reading ui file '.\UI\Configuration.ui'
|
|
3 |
# Form implementation generated from reading ui file './UI/Configuration.ui'
|
|
4 | 4 |
# |
5 |
# Created by: PyQt5 UI code generator 5.13.1
|
|
5 |
# Created by: PyQt5 UI code generator 5.11.3
|
|
6 | 6 |
# |
7 | 7 |
# WARNING! All changes made in this file will be lost! |
8 | 8 | |
9 | ||
10 | 9 |
from PyQt5 import QtCore, QtGui, QtWidgets |
11 | 10 | |
12 | ||
13 | 11 |
class Ui_ConfigurationDialog(object): |
14 | 12 |
def setupUi(self, ConfigurationDialog): |
15 | 13 |
ConfigurationDialog.setObjectName("ConfigurationDialog") |
... | ... | |
294 | 292 |
self.pushButtonLineNoAttribute.setMaximumSize(QtCore.QSize(16777215, 24)) |
295 | 293 |
self.pushButtonLineNoAttribute.setObjectName("pushButtonLineNoAttribute") |
296 | 294 |
self.gridLayout_28.addWidget(self.pushButtonLineNoAttribute, 0, 0, 1, 1) |
295 |
self.pushButtonDeleteProperty = QtWidgets.QPushButton(self.groupBoxLineNo) |
|
296 |
self.pushButtonDeleteProperty.setMinimumSize(QtCore.QSize(50, 0)) |
|
297 |
self.pushButtonDeleteProperty.setMaximumSize(QtCore.QSize(50, 16777215)) |
|
298 |
self.pushButtonDeleteProperty.setText("") |
|
299 |
icon1 = QtGui.QIcon() |
|
300 |
icon1.addPixmap(QtGui.QPixmap(":/newPrefix/Remove.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
|
301 |
self.pushButtonDeleteProperty.setIcon(icon1) |
|
302 |
self.pushButtonDeleteProperty.setObjectName("pushButtonDeleteProperty") |
|
303 |
self.gridLayout_28.addWidget(self.pushButtonDeleteProperty, 0, 3, 1, 1) |
|
297 | 304 |
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) |
298 | 305 |
self.gridLayout_28.addItem(spacerItem, 0, 1, 1, 1) |
299 | 306 |
self.pushButtonAddProperty = QtWidgets.QPushButton(self.groupBoxLineNo) |
300 | 307 |
self.pushButtonAddProperty.setMinimumSize(QtCore.QSize(50, 0)) |
301 | 308 |
self.pushButtonAddProperty.setMaximumSize(QtCore.QSize(50, 16777215)) |
302 | 309 |
self.pushButtonAddProperty.setText("") |
303 |
icon1 = QtGui.QIcon()
|
|
304 |
icon1.addPixmap(QtGui.QPixmap(":/newPrefix/Add.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
|
305 |
self.pushButtonAddProperty.setIcon(icon1)
|
|
310 |
icon2 = QtGui.QIcon()
|
|
311 |
icon2.addPixmap(QtGui.QPixmap(":/newPrefix/Add.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
|
312 |
self.pushButtonAddProperty.setIcon(icon2)
|
|
306 | 313 |
self.pushButtonAddProperty.setDefault(False) |
307 | 314 |
self.pushButtonAddProperty.setObjectName("pushButtonAddProperty") |
308 | 315 |
self.gridLayout_28.addWidget(self.pushButtonAddProperty, 0, 2, 1, 1) |
309 |
self.pushButtonDeleteProperty = QtWidgets.QPushButton(self.groupBoxLineNo) |
|
310 |
self.pushButtonDeleteProperty.setMinimumSize(QtCore.QSize(50, 0)) |
|
311 |
self.pushButtonDeleteProperty.setMaximumSize(QtCore.QSize(50, 16777215)) |
|
312 |
self.pushButtonDeleteProperty.setText("") |
|
313 |
icon2 = QtGui.QIcon() |
|
314 |
icon2.addPixmap(QtGui.QPixmap(":/newPrefix/Remove.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
|
315 |
self.pushButtonDeleteProperty.setIcon(icon2) |
|
316 |
self.pushButtonDeleteProperty.setObjectName("pushButtonDeleteProperty") |
|
317 |
self.gridLayout_28.addWidget(self.pushButtonDeleteProperty, 0, 3, 1, 1) |
|
318 | 316 |
self.tableViewLineNo = QtWidgets.QTableView(self.groupBoxLineNo) |
319 | 317 |
self.tableViewLineNo.setObjectName("tableViewLineNo") |
320 | 318 |
self.gridLayout_28.addWidget(self.tableViewLineNo, 1, 0, 1, 4) |
... | ... | |
326 | 324 |
self.gridLayout_34.setObjectName("gridLayout_34") |
327 | 325 |
self.gridLayout_33 = QtWidgets.QGridLayout() |
328 | 326 |
self.gridLayout_33.setObjectName("gridLayout_33") |
327 |
self.pushButtonDeleteTagProperty = QtWidgets.QPushButton(self.groupBoxEquipTag) |
|
328 |
self.pushButtonDeleteTagProperty.setMaximumSize(QtCore.QSize(50, 16777215)) |
|
329 |
self.pushButtonDeleteTagProperty.setText("") |
|
330 |
self.pushButtonDeleteTagProperty.setIcon(icon1) |
|
331 |
self.pushButtonDeleteTagProperty.setObjectName("pushButtonDeleteTagProperty") |
|
332 |
self.gridLayout_33.addWidget(self.pushButtonDeleteTagProperty, 0, 3, 1, 1) |
|
329 | 333 |
self.pushButtonAddTagProperty = QtWidgets.QPushButton(self.groupBoxEquipTag) |
330 | 334 |
self.pushButtonAddTagProperty.setMaximumSize(QtCore.QSize(50, 16777215)) |
331 | 335 |
self.pushButtonAddTagProperty.setText("") |
332 |
self.pushButtonAddTagProperty.setIcon(icon1)
|
|
336 |
self.pushButtonAddTagProperty.setIcon(icon2)
|
|
333 | 337 |
self.pushButtonAddTagProperty.setObjectName("pushButtonAddTagProperty") |
334 | 338 |
self.gridLayout_33.addWidget(self.pushButtonAddTagProperty, 0, 2, 1, 1) |
335 | 339 |
spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) |
... | ... | |
337 | 341 |
self.pushButtonTagNoAttribute = QtWidgets.QPushButton(self.groupBoxEquipTag) |
338 | 342 |
self.pushButtonTagNoAttribute.setObjectName("pushButtonTagNoAttribute") |
339 | 343 |
self.gridLayout_33.addWidget(self.pushButtonTagNoAttribute, 0, 0, 1, 1) |
340 |
self.pushButtonDeleteTagProperty = QtWidgets.QPushButton(self.groupBoxEquipTag) |
|
341 |
self.pushButtonDeleteTagProperty.setMaximumSize(QtCore.QSize(50, 16777215)) |
|
342 |
self.pushButtonDeleteTagProperty.setText("") |
|
343 |
self.pushButtonDeleteTagProperty.setIcon(icon2) |
|
344 |
self.pushButtonDeleteTagProperty.setObjectName("pushButtonDeleteTagProperty") |
|
345 |
self.gridLayout_33.addWidget(self.pushButtonDeleteTagProperty, 0, 3, 1, 1) |
|
346 | 344 |
self.tableViewTagNo = QtWidgets.QTableView(self.groupBoxEquipTag) |
347 | 345 |
self.tableViewTagNo.setObjectName("tableViewTagNo") |
348 | 346 |
self.gridLayout_33.addWidget(self.tableViewTagNo, 1, 0, 1, 4) |
... | ... | |
437 | 435 |
self.gridLayout_40.setObjectName("gridLayout_40") |
438 | 436 |
self.gridLayout_39 = QtWidgets.QGridLayout() |
439 | 437 |
self.gridLayout_39.setObjectName("gridLayout_39") |
440 |
self.lineEditFlange = QtWidgets.QLineEdit(self.groupBoxSymbol) |
|
441 |
self.lineEditFlange.setObjectName("lineEditFlange") |
|
442 |
self.gridLayout_39.addWidget(self.lineEditFlange, 2, 1, 1, 1) |
|
438 |
spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) |
|
439 |
self.gridLayout_39.addItem(spacerItem3, 2, 2, 1, 1) |
|
443 | 440 |
self.label_52 = QtWidgets.QLabel(self.groupBoxSymbol) |
444 | 441 |
self.label_52.setObjectName("label_52") |
445 | 442 |
self.gridLayout_39.addWidget(self.label_52, 2, 0, 1, 1) |
446 |
spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) |
|
447 |
self.gridLayout_39.addItem(spacerItem3, 2, 2, 1, 1) |
|
448 | 443 |
self.horizontalLayout_10 = QtWidgets.QHBoxLayout() |
449 | 444 |
self.horizontalLayout_10.setObjectName("horizontalLayout_10") |
450 | 445 |
self.radioButtonDetectPackageYes = QtWidgets.QRadioButton(self.groupBoxSymbol) |
... | ... | |
458 | 453 |
self.buttonGroup_8.addButton(self.radioButtonDetectPackageNo) |
459 | 454 |
self.horizontalLayout_10.addWidget(self.radioButtonDetectPackageNo) |
460 | 455 |
self.gridLayout_39.addLayout(self.horizontalLayout_10, 1, 1, 1, 1) |
456 |
self.lineEditFlange = QtWidgets.QLineEdit(self.groupBoxSymbol) |
|
457 |
self.lineEditFlange.setObjectName("lineEditFlange") |
|
458 |
self.gridLayout_39.addWidget(self.lineEditFlange, 2, 1, 1, 1) |
|
461 | 459 |
self.label_53 = QtWidgets.QLabel(self.groupBoxSymbol) |
462 | 460 |
self.label_53.setObjectName("label_53") |
463 | 461 |
self.gridLayout_39.addWidget(self.label_53, 1, 0, 1, 1) |
... | ... | |
849 | 847 |
self.buttonGroup_7.addButton(self.radioButtonSymbolServer) |
850 | 848 |
self.horizontalLayout_9.addWidget(self.radioButtonSymbolServer) |
851 | 849 |
self.gridLayout_37.addLayout(self.horizontalLayout_9, 2, 1, 1, 1) |
850 |
self.spinBoxServerSymbol = QtWidgets.QSpinBox(self.groupBox_13) |
|
851 |
self.spinBoxServerSymbol.setObjectName("spinBoxServerSymbol") |
|
852 |
self.gridLayout_37.addWidget(self.spinBoxServerSymbol, 2, 2, 1, 1) |
|
852 | 853 |
self.gridLayout_38.addLayout(self.gridLayout_37, 0, 0, 1, 1) |
853 | 854 |
self.gridLayout_21.addWidget(self.groupBox_13, 2, 0, 1, 1) |
854 | 855 |
self.groupBox_14 = QtWidgets.QGroupBox(self.tabETC) |
... | ... | |
1072 | 1073 |
self.label_48.setText(_translate("ConfigurationDialog", "Server Address")) |
1073 | 1074 |
self.pushButtonServerTest.setText(_translate("ConfigurationDialog", "Test Connection")) |
1074 | 1075 |
self.label_47.setText(_translate("ConfigurationDialog", "OCR")) |
1075 |
self.label_51.setText(_translate("ConfigurationDialog", "Symbol")) |
|
1076 |
self.label_51.setText(_translate("ConfigurationDialog", "Symbol(Server Threshold(%))"))
|
|
1076 | 1077 |
self.radioButtonSymbolLocal.setText(_translate("ConfigurationDialog", "Local")) |
1077 | 1078 |
self.radioButtonSymbolServer.setText(_translate("ConfigurationDialog", "Server")) |
1078 | 1079 |
self.groupBox_14.setTitle(_translate("ConfigurationDialog", "Project")) |
... | ... | |
1080 | 1081 |
self.radioButtonOpModeGenenal.setText(_translate("ConfigurationDialog", "Genenal")) |
1081 | 1082 |
self.radioButtonOpModeInst.setText(_translate("ConfigurationDialog", "Instrument")) |
1082 | 1083 |
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabETC), _translate("ConfigurationDialog", "ETC")) |
1084 | ||
1083 | 1085 |
import MainWindow_rc |
1086 | ||
1087 |
if __name__ == "__main__": |
|
1088 |
import sys |
|
1089 |
app = QtWidgets.QApplication(sys.argv) |
|
1090 |
ConfigurationDialog = QtWidgets.QDialog() |
|
1091 |
ui = Ui_ConfigurationDialog() |
|
1092 |
ui.setupUi(ConfigurationDialog) |
|
1093 |
ConfigurationDialog.show() |
|
1094 |
sys.exit(app.exec_()) |
|
1095 |
DTI_PID/DTI_PID/RecognitionDialog.py | ||
---|---|---|
3197 | 3197 |
return tempChildInfo |
3198 | 3198 | |
3199 | 3199 |
@staticmethod |
3200 |
def calculate_exact_position(area, symGray, symbol, rect, worker): |
|
3200 |
def calculate_exact_position(area, symGray, symbol, rect, worker, threshold):
|
|
3201 | 3201 |
import copy |
3202 | 3202 | |
3203 | 3203 |
try: |
... | ... | |
3301 | 3301 |
#colCount = len(tmRes[0]) |
3302 | 3302 |
#col, row = divmod(maxIndex, colCount) |
3303 | 3303 | |
3304 |
if max_val > 0.25:
|
|
3304 |
if max_val > threshold:
|
|
3305 | 3305 |
searchedInfos.append([max_val, max_loc[0] + x_start, max_loc[1] + y_start, symbolRotatedAngle, flipped, originalPoint, connectionPoint, sw, sh]) |
3306 | 3306 | |
3307 | 3307 |
if rc % 2 == 0: |
... | ... | |
3443 | 3443 |
sym = cv2.imread(symbolPath, 1) |
3444 | 3444 |
symGray = Worker.cvtGrayImage(sym) |
3445 | 3445 | |
3446 |
configs = app_doc_data.getConfigs('Engine', 'Threshold') |
|
3447 |
threshold = int(configs[0].value) / 100 if configs else 0.25 |
|
3448 | ||
3446 | 3449 |
for symbol in symbols: |
3447 | 3450 |
if symbol[0] == symbolName: |
3448 | 3451 |
searchedItemSp, symbolRotatedAngle, flipped, originalPoint, connectionPoint, sw, sh, score = \ |
3449 |
Worker.calculate_exact_position(area, symGray, targetSymbol, symbol, worker) |
|
3452 |
Worker.calculate_exact_position(area, symGray, targetSymbol, symbol, worker, threshold)
|
|
3450 | 3453 |
if not searchedItemSp: |
3451 | 3454 |
continue |
3452 | 3455 |
DTI_PID/DTI_PID/UI/Configuration.ui | ||
---|---|---|
935 | 935 |
<layout class="QGridLayout" name="gridLayout_40"> |
936 | 936 |
<item row="0" column="0"> |
937 | 937 |
<layout class="QGridLayout" name="gridLayout_39"> |
938 |
<item row="2" column="2"> |
|
939 |
<spacer name="horizontalSpacer_7"> |
|
940 |
<property name="orientation"> |
|
941 |
<enum>Qt::Horizontal</enum> |
|
942 |
</property> |
|
943 |
<property name="sizeHint" stdset="0"> |
|
944 |
<size> |
|
945 |
<width>40</width> |
|
946 |
<height>20</height> |
|
947 |
</size> |
|
948 |
</property> |
|
949 |
</spacer> |
|
950 |
</item> |
|
951 |
<item row="2" column="0"> |
|
952 |
<widget class="QLabel" name="label_52"> |
|
953 |
<property name="text"> |
|
954 |
<string>Default Flange : </string> |
|
955 |
</property> |
|
956 |
</widget> |
|
957 |
</item> |
|
938 | 958 |
<item row="1" column="1"> |
939 | 959 |
<layout class="QHBoxLayout" name="horizontalLayout_10"> |
940 | 960 |
<item> |
... | ... | |
959 | 979 |
</item> |
960 | 980 |
</layout> |
961 | 981 |
</item> |
982 |
<item row="2" column="1"> |
|
983 |
<widget class="QLineEdit" name="lineEditFlange"/> |
|
984 |
</item> |
|
962 | 985 |
<item row="1" column="0"> |
963 | 986 |
<widget class="QLabel" name="label_53"> |
964 | 987 |
<property name="text"> |
... | ... | |
966 | 989 |
</property> |
967 | 990 |
</widget> |
968 | 991 |
</item> |
969 |
<item row="2" column="1"> |
|
970 |
<widget class="QLineEdit" name="lineEditFlange"/> |
|
971 |
</item> |
|
972 |
<item row="2" column="2"> |
|
973 |
<spacer name="horizontalSpacer_7"> |
|
974 |
<property name="orientation"> |
|
975 |
<enum>Qt::Horizontal</enum> |
|
976 |
</property> |
|
977 |
<property name="sizeHint" stdset="0"> |
|
978 |
<size> |
|
979 |
<width>40</width> |
|
980 |
<height>20</height> |
|
981 |
</size> |
|
982 |
</property> |
|
983 |
</spacer> |
|
984 |
</item> |
|
985 |
<item row="2" column="0"> |
|
986 |
<widget class="QLabel" name="label_52"> |
|
992 |
<item row="3" column="0"> |
|
993 |
<widget class="QLabel" name="label_56"> |
|
987 | 994 |
<property name="text"> |
988 |
<string>Defualt Flange : </string>
|
|
995 |
<string>Default Blind Flange : </string>
|
|
989 | 996 |
</property> |
990 | 997 |
</widget> |
991 | 998 |
</item> |
999 |
<item row="3" column="1"> |
|
1000 |
<widget class="QLineEdit" name="lineEditBlind"/> |
|
1001 |
</item> |
|
992 | 1002 |
</layout> |
993 | 1003 |
</item> |
994 | 1004 |
</layout> |
... | ... | |
1752 | 1762 |
<item row="2" column="0"> |
1753 | 1763 |
<widget class="QLabel" name="label_51"> |
1754 | 1764 |
<property name="text"> |
1755 |
<string>Symbol</string> |
|
1765 |
<string>Symbol(Server Threshold(%))</string>
|
|
1756 | 1766 |
</property> |
1757 | 1767 |
</widget> |
1758 | 1768 |
</item> |
... | ... | |
1780 | 1790 |
</item> |
1781 | 1791 |
</layout> |
1782 | 1792 |
</item> |
1793 |
<item row="2" column="2"> |
|
1794 |
<widget class="QSpinBox" name="spinBoxServerSymbol"/> |
|
1795 |
</item> |
|
1783 | 1796 |
</layout> |
1784 | 1797 |
</item> |
1785 | 1798 |
</layout> |
... | ... | |
1971 | 1984 |
</connections> |
1972 | 1985 |
<buttongroups> |
1973 | 1986 |
<buttongroup name="buttonGroup_7"/> |
1974 |
<buttongroup name="buttonGroup_9"/> |
|
1975 |
<buttongroup name="buttonGroup_8"/> |
|
1987 |
<buttongroup name="buttonGroup_5"/> |
|
1976 | 1988 |
<buttongroup name="buttonGroup_6"/> |
1977 | 1989 |
<buttongroup name="buttonGroup_2"/> |
1978 |
<buttongroup name="buttonGroup_4"/> |
|
1979 |
<buttongroup name="buttonGroup"/> |
|
1990 |
<buttongroup name="buttonGroup_8"/> |
|
1980 | 1991 |
<buttongroup name="buttonGroup_3"/> |
1981 |
<buttongroup name="buttonGroup_5"/> |
|
1992 |
<buttongroup name="buttonGroup_9"/> |
|
1993 |
<buttongroup name="buttonGroup"/> |
|
1994 |
<buttongroup name="buttonGroup_4"/> |
|
1982 | 1995 |
</buttongroups> |
1983 | 1996 |
</ui> |
내보내기 Unified diff