개정판 727341a8
issue #1366: prepare symbol recognition
Change-Id: Ic7e75decb028df3125a414c6925c2f74a1662b14
DTI_PID/DTI_PID/AppWebService.py | ||
---|---|---|
47 | 47 |
mb.exec_() |
48 | 48 |
return False |
49 | 49 |
|
50 |
def request_text_box(self, img, img_path, score_path):
|
|
50 |
def request_symbol_box(self, img, img_path, score_path):
|
|
51 | 51 |
# send uncroped image |
52 | 52 |
try: |
53 | 53 |
if not self.test_connection(): |
54 | 54 |
return [] |
55 | 55 |
|
56 |
symbol_box = '/symbol_box' |
|
57 |
|
|
58 |
_, bts = cv2.imencode('.png', img) |
|
59 |
bts = bts.tostring() |
|
60 |
|
|
61 |
response = requests.post(self._url + symbol_box, data=bts) |
|
62 |
|
|
63 |
return response.json()['symbol_box'] |
|
64 |
except Exception as ex: |
|
65 |
from App import App |
|
66 |
from AppDocData import MessageType |
|
67 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
68 |
sys.exc_info()[-1].tb_lineno) |
|
69 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
70 |
return [] |
|
71 |
|
|
72 |
def request_text_box(self, img, img_path, score_path): |
|
73 |
# send uncroped image, test code |
|
74 |
try: |
|
75 |
if not self.test_connection(): |
|
76 |
return [] |
|
77 |
|
|
56 | 78 |
text_box = '/text_box' |
57 | 79 |
|
58 | 80 |
_, bts = cv2.imencode('.png', img) |
... | ... | |
70 | 92 |
return [] |
71 | 93 |
|
72 | 94 |
def request_text_box_tile(self, img_infos, img_path, score_path): |
95 |
""" main code """ |
|
73 | 96 |
try: |
74 | 97 |
if not self.test_connection(): |
75 | 98 |
return [] |
DTI_PID/DTI_PID/ConfigurationDialog.py | ||
---|---|---|
434 | 434 |
else: |
435 | 435 |
self.ui.radioButtonTextAreaLocal.setChecked(True) |
436 | 436 |
self.ui.radioButtonTextAreaServer.setChecked(False) |
437 |
configs = docData.getConfigs('Engine', 'Symbol') |
|
438 |
if configs: |
|
439 |
size = int(configs[0].value) |
|
440 |
self.ui.radioButtonSymbolLocal.setChecked(True if size == 1 else False) |
|
441 |
self.ui.radioButtonSymbolServer.setChecked(True if size == -1 else False) |
|
442 |
else: |
|
443 |
self.ui.radioButtonSymbolLocal.setChecked(True) |
|
444 |
self.ui.radioButtonSymbolServer.setChecked(False) |
|
437 | 445 |
configs = docData.getConfigs('Engine', 'OCR') |
438 | 446 |
if configs: |
439 | 447 |
size = int(configs[0].value) |
... | ... | |
1083 | 1091 |
Config('Data Save', 'Unknown Xml Only', '1' if self.ui.radioButtonSaveUnknownYes.isChecked() else '-1')) |
1084 | 1092 |
configs.append(Config('Engine', 'Address', self.ui.lineEditServerAddress.text())) |
1085 | 1093 |
configs.append(Config('Engine', 'Text Area', '1' if self.ui.radioButtonTextAreaLocal.isChecked() else '-1')) |
1094 |
configs.append(Config('Engine', 'Symbol', '1' if self.ui.radioButtonSymbolLocal.isChecked() else '-1')) |
|
1086 | 1095 |
configs.append(Config('Engine', 'OCR', '1' if self.ui.radioButtonOCRLocal.isChecked() else '-1')) |
1087 | 1096 |
|
1088 | 1097 |
docData.saveConfigs(configs) |
DTI_PID/DTI_PID/Configuration_UI.py | ||
---|---|---|
741 | 741 |
self.radioButtonOCRServer = QtWidgets.QRadioButton(self.groupBox_13) |
742 | 742 |
self.radioButtonOCRServer.setObjectName("radioButtonOCRServer") |
743 | 743 |
self.horizontalLayout_8.addWidget(self.radioButtonOCRServer) |
744 |
self.gridLayout_37.addLayout(self.horizontalLayout_8, 2, 1, 1, 1)
|
|
744 |
self.gridLayout_37.addLayout(self.horizontalLayout_8, 3, 1, 1, 1)
|
|
745 | 745 |
self.label_46 = QtWidgets.QLabel(self.groupBox_13) |
746 | 746 |
self.label_46.setMinimumSize(QtCore.QSize(200, 0)) |
747 | 747 |
self.label_46.setObjectName("label_46") |
748 | 748 |
self.gridLayout_37.addWidget(self.label_46, 1, 0, 1, 1) |
749 | 749 |
spacerItem7 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) |
750 | 750 |
self.gridLayout_37.addItem(spacerItem7, 1, 2, 1, 1) |
751 |
self.label_47 = QtWidgets.QLabel(self.groupBox_13) |
|
752 |
self.label_47.setObjectName("label_47") |
|
753 |
self.gridLayout_37.addWidget(self.label_47, 2, 0, 1, 1) |
|
754 | 751 |
self.label_48 = QtWidgets.QLabel(self.groupBox_13) |
755 | 752 |
self.label_48.setObjectName("label_48") |
756 | 753 |
self.gridLayout_37.addWidget(self.label_48, 0, 0, 1, 1) |
... | ... | |
760 | 757 |
self.pushButtonServerTest = QtWidgets.QPushButton(self.groupBox_13) |
761 | 758 |
self.pushButtonServerTest.setObjectName("pushButtonServerTest") |
762 | 759 |
self.gridLayout_37.addWidget(self.pushButtonServerTest, 0, 2, 1, 1) |
760 |
self.label_47 = QtWidgets.QLabel(self.groupBox_13) |
|
761 |
self.label_47.setObjectName("label_47") |
|
762 |
self.gridLayout_37.addWidget(self.label_47, 3, 0, 1, 1) |
|
763 |
self.label_51 = QtWidgets.QLabel(self.groupBox_13) |
|
764 |
self.label_51.setObjectName("label_51") |
|
765 |
self.gridLayout_37.addWidget(self.label_51, 2, 0, 1, 1) |
|
766 |
self.horizontalLayout_9 = QtWidgets.QHBoxLayout() |
|
767 |
self.horizontalLayout_9.setObjectName("horizontalLayout_9") |
|
768 |
self.radioButtonSymbolLocal = QtWidgets.QRadioButton(self.groupBox_13) |
|
769 |
self.radioButtonSymbolLocal.setObjectName("radioButtonSymbolLocal") |
|
770 |
self.buttonGroup_7 = QtWidgets.QButtonGroup(ConfigurationDialog) |
|
771 |
self.buttonGroup_7.setObjectName("buttonGroup_7") |
|
772 |
self.buttonGroup_7.addButton(self.radioButtonSymbolLocal) |
|
773 |
self.horizontalLayout_9.addWidget(self.radioButtonSymbolLocal) |
|
774 |
self.radioButtonSymbolServer = QtWidgets.QRadioButton(self.groupBox_13) |
|
775 |
self.radioButtonSymbolServer.setObjectName("radioButtonSymbolServer") |
|
776 |
self.buttonGroup_7.addButton(self.radioButtonSymbolServer) |
|
777 |
self.horizontalLayout_9.addWidget(self.radioButtonSymbolServer) |
|
778 |
self.gridLayout_37.addLayout(self.horizontalLayout_9, 2, 1, 1, 1) |
|
763 | 779 |
self.gridLayout_38.addLayout(self.gridLayout_37, 0, 0, 1, 1) |
764 | 780 |
self.gridLayout_21.addWidget(self.groupBox_13, 2, 0, 1, 1) |
765 | 781 |
self.gridLayout_22.addLayout(self.gridLayout_21, 0, 0, 1, 1) |
... | ... | |
959 | 975 |
self.radioButtonOCRLocal.setText(_translate("ConfigurationDialog", "Local")) |
960 | 976 |
self.radioButtonOCRServer.setText(_translate("ConfigurationDialog", "Server")) |
961 | 977 |
self.label_46.setText(_translate("ConfigurationDialog", "Text Area")) |
962 |
self.label_47.setText(_translate("ConfigurationDialog", "OCR")) |
|
963 | 978 |
self.label_48.setText(_translate("ConfigurationDialog", "Server Address")) |
964 | 979 |
self.pushButtonServerTest.setText(_translate("ConfigurationDialog", "Test Connection")) |
980 |
self.label_47.setText(_translate("ConfigurationDialog", "OCR")) |
|
981 |
self.label_51.setText(_translate("ConfigurationDialog", "Symbol")) |
|
982 |
self.radioButtonSymbolLocal.setText(_translate("ConfigurationDialog", "Local")) |
|
983 |
self.radioButtonSymbolServer.setText(_translate("ConfigurationDialog", "Server")) |
|
965 | 984 |
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabETC), _translate("ConfigurationDialog", "ETC")) |
966 | 985 |
|
967 | 986 |
import MainWindow_rc |
DTI_PID/DTI_PID/UI/Configuration.ui | ||
---|---|---|
1557 | 1557 |
</item> |
1558 | 1558 |
</layout> |
1559 | 1559 |
</item> |
1560 |
<item row="2" column="1">
|
|
1560 |
<item row="3" column="1">
|
|
1561 | 1561 |
<layout class="QHBoxLayout" name="horizontalLayout_8"> |
1562 | 1562 |
<item> |
1563 | 1563 |
<widget class="QRadioButton" name="radioButtonOCRLocal"> |
... | ... | |
1601 | 1601 |
</property> |
1602 | 1602 |
</spacer> |
1603 | 1603 |
</item> |
1604 |
<item row="2" column="0"> |
|
1605 |
<widget class="QLabel" name="label_47"> |
|
1606 |
<property name="text"> |
|
1607 |
<string>OCR</string> |
|
1608 |
</property> |
|
1609 |
</widget> |
|
1610 |
</item> |
|
1611 | 1604 |
<item row="0" column="0"> |
1612 | 1605 |
<widget class="QLabel" name="label_48"> |
1613 | 1606 |
<property name="text"> |
... | ... | |
1625 | 1618 |
</property> |
1626 | 1619 |
</widget> |
1627 | 1620 |
</item> |
1621 |
<item row="3" column="0"> |
|
1622 |
<widget class="QLabel" name="label_47"> |
|
1623 |
<property name="text"> |
|
1624 |
<string>OCR</string> |
|
1625 |
</property> |
|
1626 |
</widget> |
|
1627 |
</item> |
|
1628 |
<item row="2" column="0"> |
|
1629 |
<widget class="QLabel" name="label_51"> |
|
1630 |
<property name="text"> |
|
1631 |
<string>Symbol</string> |
|
1632 |
</property> |
|
1633 |
</widget> |
|
1634 |
</item> |
|
1635 |
<item row="2" column="1"> |
|
1636 |
<layout class="QHBoxLayout" name="horizontalLayout_9"> |
|
1637 |
<item> |
|
1638 |
<widget class="QRadioButton" name="radioButtonSymbolLocal"> |
|
1639 |
<property name="text"> |
|
1640 |
<string>Local</string> |
|
1641 |
</property> |
|
1642 |
<attribute name="buttonGroup"> |
|
1643 |
<string notr="true">buttonGroup_7</string> |
|
1644 |
</attribute> |
|
1645 |
</widget> |
|
1646 |
</item> |
|
1647 |
<item> |
|
1648 |
<widget class="QRadioButton" name="radioButtonSymbolServer"> |
|
1649 |
<property name="text"> |
|
1650 |
<string>Server</string> |
|
1651 |
</property> |
|
1652 |
<attribute name="buttonGroup"> |
|
1653 |
<string notr="true">buttonGroup_7</string> |
|
1654 |
</attribute> |
|
1655 |
</widget> |
|
1656 |
</item> |
|
1657 |
</layout> |
|
1658 |
</item> |
|
1628 | 1659 |
</layout> |
1629 | 1660 |
</item> |
1630 | 1661 |
</layout> |
... | ... | |
1770 | 1801 |
</connection> |
1771 | 1802 |
</connections> |
1772 | 1803 |
<buttongroups> |
1804 |
<buttongroup name="buttonGroup_4"/> |
|
1805 |
<buttongroup name="buttonGroup_6"/> |
|
1773 | 1806 |
<buttongroup name="buttonGroup_2"/> |
1774 | 1807 |
<buttongroup name="buttonGroup_3"/> |
1775 |
<buttongroup name="buttonGroup_5"/> |
|
1776 | 1808 |
<buttongroup name="buttonGroup"/> |
1777 |
<buttongroup name="buttonGroup_4"/>
|
|
1778 |
<buttongroup name="buttonGroup_6"/>
|
|
1809 |
<buttongroup name="buttonGroup_5"/>
|
|
1810 |
<buttongroup name="buttonGroup_7"/>
|
|
1779 | 1811 |
</buttongroups> |
1780 | 1812 |
</ui> |
내보내기 Unified diff