개정판 1669b150
issue #655: trainingImageList added
DTI_PID/DTI_PID/App.py | ||
---|---|---|
66 | 66 |
''' |
67 | 67 |
img = cv2.imread('d:/Projects/DTIPID/HEC/drawings/HEC_P1_600DPI.png') |
68 | 68 |
img = cv2.threshold(cv2.cvtColor(img, cv2.COLOR_BGR2GRAY), 127, 255, cv2.THRESH_BINARY)[1] |
69 |
cv2.imwrite('d:/Projects/DTIPID/HEC/drawings/HEC_P1_600DPI_.png', img)6
|
|
69 |
cv2.imwrite('d:/Projects/DTIPID/HEC/drawings/HEC_P1_600DPI_.png', img) |
|
70 | 70 |
''' |
71 | 71 | |
72 | 72 |
app = App(sys.argv) |
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
67 | 67 |
Add QActionGroup for managing checkable action |
68 | 68 |
Jeongwoo 2018.06.27 Add Action [Zoom, Fit Window] and Add new actions into ActionGroup |
69 | 69 |
humkyung 2018.08.23 add labelStatus to statusbar |
70 |
Euisung 2018.09.27 add OCR Training , Signal/Slot Connection 'oCRTrainingClicked' |
|
70 | 71 |
Euisung 2018.10.05 add OCR Editor , Signal/Slot Connection 'oCRTrainingEdidorClicked' |
71 | 72 |
''' |
72 | 73 |
def __init__(self): |
... | ... | |
185 | 186 |
self.addMessage.connect(self.onAddMessage) |
186 | 187 |
self.actionFindReplaceText.triggered.connect(self.findReplaceTextClicked) |
187 | 188 |
self.pushButtonDetectSymbol.clicked.connect(self.onShowDetectSymbol) |
189 |
self.actionOCR_Training.triggered.connect(self.oCRTrainingClicked) |
|
188 | 190 |
self.actionOCR_Training_Editor.triggered.connect(self.oCRTrainingEdidorClicked) |
189 | 191 | |
190 | 192 |
# removedItems |
... | ... | |
222 | 224 |
return |
223 | 225 | |
224 | 226 |
''' |
227 |
@brief OCR Training |
|
228 |
@author euisung |
|
229 |
@date 2018.09.27 |
|
230 |
@history euisung 2018.10.16 TrainingListDialog -> TrainingImageListDialog |
|
231 |
''' |
|
232 |
def oCRTrainingClicked(self): |
|
233 |
from TrainingImageListDialog import QTrainingImageListDialog |
|
234 | ||
235 |
try: |
|
236 |
#appDocData = AppDocData.instance() |
|
237 |
#project = appDocData.getCurrentProject() |
|
238 | ||
239 |
#path = project.getDrawingFilePath() |
|
240 | ||
241 |
#print(path) |
|
242 |
dialog = QTrainingImageListDialog(self) |
|
243 |
dialog.exec_() |
|
244 |
except Exception as ex: |
|
245 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
|
246 |
|
|
247 |
return |
|
248 | ||
249 |
''' |
|
225 | 250 |
@brief show unknownitem's count |
226 | 251 |
@author kyouho |
227 | 252 |
@date 2018.08.27 |
DTI_PID/DTI_PID/OcrResultDialog.py | ||
---|---|---|
13 | 13 |
import QtImageViewer |
14 | 14 |
import tesseract_ocr_module as TOCR |
15 | 15 |
from App import App |
16 |
from AppDocData import * |
|
16 | 17 | |
17 | 18 |
class QOcrResultDialog(QDialog): |
18 | 19 |
def __init__(self, parent, qimage, boundingBox, isModify = False, text = None): |
... | ... | |
41 | 42 |
self.ui.counterClockPushButton_2.clicked.connect(lambda : self.rotateImage(True)) |
42 | 43 |
self.ui.clockPushButton_2.clicked.connect(lambda : self.rotateImage(False)) |
43 | 44 |
self.ui.redetectPushButton_2.clicked.connect(self.detectText) |
45 |
self.ui.pushButtonMakeTrainingImage.clicked.connect(self.pushButtonMakeTrainingImageClicked) |
|
44 | 46 | |
45 | 47 |
if self.isModify == False: |
46 | 48 |
self.detectText() |
... | ... | |
48 | 50 |
self.ui.detectResultTextEdit_2.setPlainText(text) |
49 | 51 | |
50 | 52 |
self.isAccepted = False |
53 | ||
54 |
''' |
|
55 |
@brief Make OCR Training Image |
|
56 |
@author euisung |
|
57 |
@date 2018.10.16 |
|
58 |
''' |
|
59 |
def pushButtonMakeTrainingImageClicked(self): |
|
60 |
import uuid |
|
61 |
uid = str(uuid.uuid4()) + '.png' |
|
62 |
appDocData = AppDocData.instance() |
|
63 |
project = appDocData.getCurrentProject() |
|
64 |
trainingImgPath = os.path.join(project.getTrainingFilePath(), uid) |
|
65 | ||
66 |
self.image.save(trainingImgPath) |
|
51 | 67 |
|
52 | 68 |
def rotateImage(self, isCounterClock): |
53 | 69 |
for item in self.graphicsView.scene.items(): |
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 |
# Created by: PyQt5 UI code generator 5.10.1
|
|
5 |
# Created by: PyQt5 UI code generator 5.11.2
|
|
6 | 6 |
# |
7 | 7 |
# WARNING! All changes made in this file will be lost! |
8 | 8 | |
... | ... | |
24 | 24 |
self.ocrDialogButtonBox.setOrientation(QtCore.Qt.Horizontal) |
25 | 25 |
self.ocrDialogButtonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) |
26 | 26 |
self.ocrDialogButtonBox.setObjectName("ocrDialogButtonBox") |
27 |
self.gridLayout_2.addWidget(self.ocrDialogButtonBox, 2, 0, 1, 1)
|
|
27 |
self.gridLayout_2.addWidget(self.ocrDialogButtonBox, 3, 0, 1, 1)
|
|
28 | 28 |
self.splitter = QtWidgets.QSplitter(Dialog) |
29 | 29 |
self.splitter.setOrientation(QtCore.Qt.Vertical) |
30 | 30 |
self.splitter.setObjectName("splitter") |
... | ... | |
105 | 105 |
self.detectResultVerticalLayout_2.addWidget(self.detectResultTextEdit_2) |
106 | 106 |
self.verticalLayout_4.addLayout(self.detectResultVerticalLayout_2) |
107 | 107 |
self.gridLayout_2.addWidget(self.splitter, 1, 0, 1, 1) |
108 |
self.pushButtonMakeTrainingImage = QtWidgets.QPushButton(Dialog) |
|
109 |
self.pushButtonMakeTrainingImage.setObjectName("pushButtonMakeTrainingImage") |
|
110 |
self.gridLayout_2.addWidget(self.pushButtonMakeTrainingImage, 2, 0, 1, 1) |
|
108 | 111 | |
109 | 112 |
self.retranslateUi(Dialog) |
110 | 113 |
self.ocrDialogButtonBox.accepted.connect(Dialog.accept) |
... | ... | |
118 | 121 |
self.counterClockPushButton_2.setToolTip(_translate("Dialog", "반시계 방향 회전")) |
119 | 122 |
self.clockPushButton_2.setToolTip(_translate("Dialog", "시계 방향 회전")) |
120 | 123 |
self.detectResultLabel_2.setText(_translate("Dialog", "검출 결과")) |
124 |
self.pushButtonMakeTrainingImage.setText(_translate("Dialog", "OCR 학습 이미지 저장")) |
|
121 | 125 | |
122 | 126 |
import MainWindow_rc |
123 | 127 |
DTI_PID/DTI_PID/Shapes/TrainingBoxItem.py | ||
---|---|---|
19 | 19 |
from EngineeringAbstractItem import QEngineeringAbstractItem |
20 | 20 | |
21 | 21 |
class QTrainingBoxItem(QGraphicsRectItem): |
22 |
def __init__(self, x, y, w, h, uid=None, parent=None): |
|
22 |
def __init__(self, char, x, y, w, h, uid=None, parent=None):
|
|
23 | 23 |
import uuid |
24 | 24 | |
25 | 25 |
QGraphicsRectItem.__init__(self, x, y, w, h, parent) |
26 | 26 | |
27 |
self.char = char |
|
27 | 28 |
self.uid = uuid.uuid4() if uid is None else uid |
28 | 29 |
self.loc = None |
29 | 30 |
self.size = None |
... | ... | |
107 | 108 |
self.ui.spinBoxTop.setValue(round(rect.y())) |
108 | 109 |
self.ui.spinBoxWidth.setValue(round(rect.width())) |
109 | 110 |
self.ui.spinBoxHeight.setValue(round(rect.height())) |
111 |
self.ui.lineEditChar.setText(self.char) |
|
110 | 112 | |
111 | 113 |
rectSide = QRectF(rect.x() - 3, rect.y() - 3, rect.width() + 6, rect.height() + 6) |
112 | 114 |
bound = self.leftSideView.scene().items()[0] |
DTI_PID/DTI_PID/TrainingEditorDialog.py | ||
---|---|---|
82 | 82 | |
83 | 83 |
for box in boxList: |
84 | 84 |
boxComponent = box.split(' ') |
85 |
singleBox = QTrainingBoxItem(int(boxComponent[1]), cvImg.shape[0] - int(boxComponent[4]), int(boxComponent[3]) - int(boxComponent[1]), int(boxComponent[4]) - int(boxComponent[2])) |
|
85 |
singleBox = QTrainingBoxItem(str(boxComponent[0]), int(boxComponent[1]), cvImg.shape[0] - int(boxComponent[4]), int(boxComponent[3]) - int(boxComponent[1]), int(boxComponent[4]) - int(boxComponent[2]))
|
|
86 | 86 |
singleBox.loc = [int(boxComponent[1]), cvImg.shape[0] - int(boxComponent[2])] |
87 | 87 |
singleBox.size = [int(boxComponent[3]) - int(boxComponent[1]), int(boxComponent[2]) - int(boxComponent[4])] |
88 | 88 |
singleBox.angle = 0 |
89 |
#singleBox.setPlainText(boxComponent[0]) |
|
90 | 89 |
singleBox.transfer.onRemoved.connect(self.itemRemoved) |
91 | 90 |
singleBox.addTextItemToScene(self.ui, self.graphicsViewTrainingDrawing, self.graphicsViewZoomDrawing, self.spinBoxFlag) |
92 | 91 |
|
DTI_PID/DTI_PID/TrainingEditor_UI.py | ||
---|---|---|
1 | 1 |
# -*- coding: utf-8 -*- |
2 | 2 | |
3 |
# Form implementation generated from reading ui file './UI/TrainingEditor.ui'
|
|
3 |
# Form implementation generated from reading ui file '.\UI\TrainingEditor.ui'
|
|
4 | 4 |
# |
5 | 5 |
# Created by: PyQt5 UI code generator 5.11.2 |
6 | 6 |
# |
... | ... | |
11 | 11 |
class Ui_TrainingEditorDialog(object): |
12 | 12 |
def setupUi(self, TrainingEditorDialog): |
13 | 13 |
TrainingEditorDialog.setObjectName("TrainingEditorDialog") |
14 |
TrainingEditorDialog.resize(1378, 805)
|
|
14 |
TrainingEditorDialog.resize(1088, 780)
|
|
15 | 15 |
self.gridLayout = QtWidgets.QGridLayout(TrainingEditorDialog) |
16 | 16 |
self.gridLayout.setObjectName("gridLayout") |
17 | 17 |
self.verticalLayout_6 = QtWidgets.QVBoxLayout() |
18 | 18 |
self.verticalLayout_6.setObjectName("verticalLayout_6") |
19 | 19 |
self.horizontalLayout_2 = QtWidgets.QHBoxLayout() |
20 | 20 |
self.horizontalLayout_2.setObjectName("horizontalLayout_2") |
21 |
self.verticalLayout_2 = QtWidgets.QVBoxLayout() |
|
22 |
self.verticalLayout_2.setObjectName("verticalLayout_2") |
|
23 |
self.checkBox_2 = QtWidgets.QCheckBox(TrainingEditorDialog) |
|
24 |
self.checkBox_2.setMaximumSize(QtCore.QSize(16777215, 32)) |
|
25 |
self.checkBox_2.setObjectName("checkBox_2") |
|
26 |
self.verticalLayout_2.addWidget(self.checkBox_2) |
|
27 |
self.checkBox = QtWidgets.QCheckBox(TrainingEditorDialog) |
|
28 |
self.checkBox.setMaximumSize(QtCore.QSize(16777215, 32)) |
|
29 |
self.checkBox.setObjectName("checkBox") |
|
30 |
self.verticalLayout_2.addWidget(self.checkBox) |
|
31 |
self.horizontalLayout_2.addLayout(self.verticalLayout_2) |
|
21 |
self.horizontalLayout = QtWidgets.QHBoxLayout() |
|
22 |
self.horizontalLayout.setObjectName("horizontalLayout") |
|
32 | 23 |
self.pushButtonZoom = QtWidgets.QPushButton(TrainingEditorDialog) |
33 |
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Maximum) |
|
34 |
sizePolicy.setHorizontalStretch(0) |
|
35 |
sizePolicy.setVerticalStretch(0) |
|
36 |
sizePolicy.setHeightForWidth(self.pushButtonZoom.sizePolicy().hasHeightForWidth()) |
|
37 |
self.pushButtonZoom.setSizePolicy(sizePolicy) |
|
38 | 24 |
self.pushButtonZoom.setMinimumSize(QtCore.QSize(64, 64)) |
39 | 25 |
self.pushButtonZoom.setMaximumSize(QtCore.QSize(64, 64)) |
40 |
self.pushButtonZoom.setToolTip("") |
|
41 |
self.pushButtonZoom.setIconSize(QtCore.QSize(16, 16)) |
|
42 | 26 |
self.pushButtonZoom.setCheckable(True) |
43 | 27 |
self.pushButtonZoom.setObjectName("pushButtonZoom") |
44 |
self.horizontalLayout_2.addWidget(self.pushButtonZoom) |
|
45 |
self.pushButton_5 = QtWidgets.QPushButton(TrainingEditorDialog) |
|
46 |
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Maximum) |
|
47 |
sizePolicy.setHorizontalStretch(0) |
|
48 |
sizePolicy.setVerticalStretch(0) |
|
49 |
sizePolicy.setHeightForWidth(self.pushButton_5.sizePolicy().hasHeightForWidth()) |
|
50 |
self.pushButton_5.setSizePolicy(sizePolicy) |
|
51 |
self.pushButton_5.setMinimumSize(QtCore.QSize(80, 32)) |
|
52 |
self.pushButton_5.setMaximumSize(QtCore.QSize(80, 32)) |
|
53 |
self.pushButton_5.setObjectName("pushButton_5") |
|
54 |
self.horizontalLayout_2.addWidget(self.pushButton_5) |
|
55 |
self.pushButton_6 = QtWidgets.QPushButton(TrainingEditorDialog) |
|
28 |
self.horizontalLayout.addWidget(self.pushButtonZoom) |
|
29 |
self.pushButtonAdd = QtWidgets.QPushButton(TrainingEditorDialog) |
|
56 | 30 |
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Maximum) |
57 | 31 |
sizePolicy.setHorizontalStretch(0) |
58 | 32 |
sizePolicy.setVerticalStretch(0) |
59 |
sizePolicy.setHeightForWidth(self.pushButton_6.sizePolicy().hasHeightForWidth())
|
|
60 |
self.pushButton_6.setSizePolicy(sizePolicy)
|
|
61 |
self.pushButton_6.setMinimumSize(QtCore.QSize(80, 32))
|
|
62 |
self.pushButton_6.setMaximumSize(QtCore.QSize(80, 32))
|
|
63 |
self.pushButton_6.setObjectName("pushButton_6")
|
|
64 |
self.horizontalLayout_2.addWidget(self.pushButton_6)
|
|
65 |
self.pushButton_7 = QtWidgets.QPushButton(TrainingEditorDialog)
|
|
33 |
sizePolicy.setHeightForWidth(self.pushButtonAdd.sizePolicy().hasHeightForWidth())
|
|
34 |
self.pushButtonAdd.setSizePolicy(sizePolicy)
|
|
35 |
self.pushButtonAdd.setMinimumSize(QtCore.QSize(64, 64))
|
|
36 |
self.pushButtonAdd.setMaximumSize(QtCore.QSize(64, 64))
|
|
37 |
self.pushButtonAdd.setObjectName("pushButtonAdd")
|
|
38 |
self.horizontalLayout.addWidget(self.pushButtonAdd)
|
|
39 |
self.pushButtonDelete = QtWidgets.QPushButton(TrainingEditorDialog)
|
|
66 | 40 |
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Maximum) |
67 | 41 |
sizePolicy.setHorizontalStretch(0) |
68 | 42 |
sizePolicy.setVerticalStretch(0) |
69 |
sizePolicy.setHeightForWidth(self.pushButton_7.sizePolicy().hasHeightForWidth())
|
|
70 |
self.pushButton_7.setSizePolicy(sizePolicy)
|
|
71 |
self.pushButton_7.setMinimumSize(QtCore.QSize(80, 32))
|
|
72 |
self.pushButton_7.setMaximumSize(QtCore.QSize(80, 32))
|
|
73 |
self.pushButton_7.setObjectName("pushButton_7")
|
|
74 |
self.horizontalLayout_2.addWidget(self.pushButton_7)
|
|
75 |
self.pushButton_8 = QtWidgets.QPushButton(TrainingEditorDialog)
|
|
43 |
sizePolicy.setHeightForWidth(self.pushButtonDelete.sizePolicy().hasHeightForWidth())
|
|
44 |
self.pushButtonDelete.setSizePolicy(sizePolicy)
|
|
45 |
self.pushButtonDelete.setMinimumSize(QtCore.QSize(64, 64))
|
|
46 |
self.pushButtonDelete.setMaximumSize(QtCore.QSize(64, 64))
|
|
47 |
self.pushButtonDelete.setObjectName("pushButtonDelete")
|
|
48 |
self.horizontalLayout.addWidget(self.pushButtonDelete)
|
|
49 |
self.pushButtonMerge = QtWidgets.QPushButton(TrainingEditorDialog)
|
|
76 | 50 |
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Maximum) |
77 | 51 |
sizePolicy.setHorizontalStretch(0) |
78 | 52 |
sizePolicy.setVerticalStretch(0) |
79 |
sizePolicy.setHeightForWidth(self.pushButton_8.sizePolicy().hasHeightForWidth())
|
|
80 |
self.pushButton_8.setSizePolicy(sizePolicy)
|
|
81 |
self.pushButton_8.setMinimumSize(QtCore.QSize(80, 32))
|
|
82 |
self.pushButton_8.setMaximumSize(QtCore.QSize(80, 32))
|
|
83 |
self.pushButton_8.setObjectName("pushButton_8")
|
|
84 |
self.horizontalLayout_2.addWidget(self.pushButton_8)
|
|
85 |
self.pushButton_9 = QtWidgets.QPushButton(TrainingEditorDialog)
|
|
53 |
sizePolicy.setHeightForWidth(self.pushButtonMerge.sizePolicy().hasHeightForWidth())
|
|
54 |
self.pushButtonMerge.setSizePolicy(sizePolicy)
|
|
55 |
self.pushButtonMerge.setMinimumSize(QtCore.QSize(64, 64))
|
|
56 |
self.pushButtonMerge.setMaximumSize(QtCore.QSize(64, 64))
|
|
57 |
self.pushButtonMerge.setObjectName("pushButtonMerge")
|
|
58 |
self.horizontalLayout.addWidget(self.pushButtonMerge)
|
|
59 |
self.pushButtonSplite = QtWidgets.QPushButton(TrainingEditorDialog)
|
|
86 | 60 |
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Maximum) |
87 | 61 |
sizePolicy.setHorizontalStretch(0) |
88 | 62 |
sizePolicy.setVerticalStretch(0) |
89 |
sizePolicy.setHeightForWidth(self.pushButton_9.sizePolicy().hasHeightForWidth()) |
|
90 |
self.pushButton_9.setSizePolicy(sizePolicy) |
|
91 |
self.pushButton_9.setMinimumSize(QtCore.QSize(80, 32)) |
|
92 |
self.pushButton_9.setMaximumSize(QtCore.QSize(80, 32)) |
|
93 |
self.pushButton_9.setObjectName("pushButton_9") |
|
94 |
self.horizontalLayout_2.addWidget(self.pushButton_9) |
|
95 |
self.pushButton_10 = QtWidgets.QPushButton(TrainingEditorDialog) |
|
96 |
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Maximum) |
|
97 |
sizePolicy.setHorizontalStretch(0) |
|
98 |
sizePolicy.setVerticalStretch(0) |
|
99 |
sizePolicy.setHeightForWidth(self.pushButton_10.sizePolicy().hasHeightForWidth()) |
|
100 |
self.pushButton_10.setSizePolicy(sizePolicy) |
|
101 |
self.pushButton_10.setMinimumSize(QtCore.QSize(80, 32)) |
|
102 |
self.pushButton_10.setMaximumSize(QtCore.QSize(80, 32)) |
|
103 |
self.pushButton_10.setObjectName("pushButton_10") |
|
104 |
self.horizontalLayout_2.addWidget(self.pushButton_10) |
|
63 |
sizePolicy.setHeightForWidth(self.pushButtonSplite.sizePolicy().hasHeightForWidth()) |
|
64 |
self.pushButtonSplite.setSizePolicy(sizePolicy) |
|
65 |
self.pushButtonSplite.setMinimumSize(QtCore.QSize(64, 64)) |
|
66 |
self.pushButtonSplite.setMaximumSize(QtCore.QSize(64, 64)) |
|
67 |
self.pushButtonSplite.setObjectName("pushButtonSplite") |
|
68 |
self.horizontalLayout.addWidget(self.pushButtonSplite) |
|
69 |
self.horizontalLayout_2.addLayout(self.horizontalLayout) |
|
105 | 70 |
spacerItem = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) |
106 | 71 |
self.horizontalLayout_2.addItem(spacerItem) |
107 |
self.pushButton_12 = QtWidgets.QPushButton(TrainingEditorDialog) |
|
108 |
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Maximum) |
|
109 |
sizePolicy.setHorizontalStretch(0) |
|
110 |
sizePolicy.setVerticalStretch(0) |
|
111 |
sizePolicy.setHeightForWidth(self.pushButton_12.sizePolicy().hasHeightForWidth()) |
|
112 |
self.pushButton_12.setSizePolicy(sizePolicy) |
|
113 |
self.pushButton_12.setMinimumSize(QtCore.QSize(35, 64)) |
|
114 |
self.pushButton_12.setMaximumSize(QtCore.QSize(32, 64)) |
|
115 |
self.pushButton_12.setObjectName("pushButton_12") |
|
116 |
self.horizontalLayout_2.addWidget(self.pushButton_12) |
|
117 |
self.verticalLayout_3 = QtWidgets.QVBoxLayout() |
|
118 |
self.verticalLayout_3.setObjectName("verticalLayout_3") |
|
119 |
spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum) |
|
120 |
self.verticalLayout_3.addItem(spacerItem1) |
|
121 |
self.lineEdit_2 = QtWidgets.QLineEdit(TrainingEditorDialog) |
|
122 |
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) |
|
123 |
sizePolicy.setHorizontalStretch(0) |
|
124 |
sizePolicy.setVerticalStretch(0) |
|
125 |
sizePolicy.setHeightForWidth(self.lineEdit_2.sizePolicy().hasHeightForWidth()) |
|
126 |
self.lineEdit_2.setSizePolicy(sizePolicy) |
|
127 |
self.lineEdit_2.setMaximumSize(QtCore.QSize(100, 16777215)) |
|
128 |
self.lineEdit_2.setObjectName("lineEdit_2") |
|
129 |
self.verticalLayout_3.addWidget(self.lineEdit_2) |
|
130 |
self.label_2 = QtWidgets.QLabel(TrainingEditorDialog) |
|
131 |
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred) |
|
132 |
sizePolicy.setHorizontalStretch(0) |
|
133 |
sizePolicy.setVerticalStretch(0) |
|
134 |
sizePolicy.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth()) |
|
135 |
self.label_2.setSizePolicy(sizePolicy) |
|
136 |
self.label_2.setMaximumSize(QtCore.QSize(100, 32)) |
|
137 |
self.label_2.setAlignment(QtCore.Qt.AlignCenter) |
|
138 |
self.label_2.setObjectName("label_2") |
|
139 |
self.verticalLayout_3.addWidget(self.label_2) |
|
140 |
self.horizontalLayout_2.addLayout(self.verticalLayout_3) |
|
141 |
self.pushButton_11 = QtWidgets.QPushButton(TrainingEditorDialog) |
|
142 |
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Maximum) |
|
143 |
sizePolicy.setHorizontalStretch(0) |
|
144 |
sizePolicy.setVerticalStretch(0) |
|
145 |
sizePolicy.setHeightForWidth(self.pushButton_11.sizePolicy().hasHeightForWidth()) |
|
146 |
self.pushButton_11.setSizePolicy(sizePolicy) |
|
147 |
self.pushButton_11.setMinimumSize(QtCore.QSize(35, 64)) |
|
148 |
self.pushButton_11.setMaximumSize(QtCore.QSize(32, 64)) |
|
149 |
self.pushButton_11.setObjectName("pushButton_11") |
|
150 |
self.horizontalLayout_2.addWidget(self.pushButton_11) |
|
151 | 72 |
self.verticalLayout_6.addLayout(self.horizontalLayout_2) |
152 | 73 |
self.horizontalLayout_4 = QtWidgets.QHBoxLayout() |
153 | 74 |
self.horizontalLayout_4.setObjectName("horizontalLayout_4") |
... | ... | |
158 | 79 |
self.verticalLayoutTrainingDrawing = QtWidgets.QVBoxLayout() |
159 | 80 |
self.verticalLayoutTrainingDrawing.setObjectName("verticalLayoutTrainingDrawing") |
160 | 81 |
self.verticalLayout_5.addLayout(self.verticalLayoutTrainingDrawing) |
161 |
spacerItem2 = QtWidgets.QSpacerItem(4000, 0, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
|
162 |
self.verticalLayout_5.addItem(spacerItem2)
|
|
82 |
spacerItem1 = QtWidgets.QSpacerItem(4000, 0, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
|
83 |
self.verticalLayout_5.addItem(spacerItem1)
|
|
163 | 84 |
self.horizontalLayout_4.addWidget(self.centralWidget) |
164 | 85 |
self.leftSideWidget = QtWidgets.QWidget(TrainingEditorDialog) |
165 | 86 |
self.leftSideWidget.setObjectName("leftSideWidget") |
... | ... | |
167 | 88 |
self.sideWidget.setObjectName("sideWidget") |
168 | 89 |
self.horizontalLayoutZoomDrawing = QtWidgets.QHBoxLayout() |
169 | 90 |
self.horizontalLayoutZoomDrawing.setObjectName("horizontalLayoutZoomDrawing") |
170 |
spacerItem3 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
|
171 |
self.horizontalLayoutZoomDrawing.addItem(spacerItem3)
|
|
91 |
spacerItem2 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
|
92 |
self.horizontalLayoutZoomDrawing.addItem(spacerItem2)
|
|
172 | 93 |
self.sideWidget.addLayout(self.horizontalLayoutZoomDrawing) |
173 | 94 |
self.verticalLayout_7 = QtWidgets.QVBoxLayout() |
174 | 95 |
self.verticalLayout_7.setObjectName("verticalLayout_7") |
... | ... | |
196 | 117 |
self.spinBoxTop.setObjectName("spinBoxTop") |
197 | 118 |
self.horizontalLayout_8.addWidget(self.spinBoxTop) |
198 | 119 |
self.verticalLayout_7.addLayout(self.horizontalLayout_8) |
199 |
spacerItem4 = QtWidgets.QSpacerItem(20, 10, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
|
|
200 |
self.verticalLayout_7.addItem(spacerItem4)
|
|
120 |
spacerItem3 = QtWidgets.QSpacerItem(20, 10, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
|
|
121 |
self.verticalLayout_7.addItem(spacerItem3)
|
|
201 | 122 |
self.horizontalLayout_7 = QtWidgets.QHBoxLayout() |
202 | 123 |
self.horizontalLayout_7.setObjectName("horizontalLayout_7") |
203 | 124 |
self.label_5 = QtWidgets.QLabel(self.leftSideWidget) |
... | ... | |
217 | 138 |
self.spinBoxHeight.setObjectName("spinBoxHeight") |
218 | 139 |
self.horizontalLayout_7.addWidget(self.spinBoxHeight) |
219 | 140 |
self.verticalLayout_7.addLayout(self.horizontalLayout_7) |
220 |
spacerItem5 = QtWidgets.QSpacerItem(20, 10, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
|
|
221 |
self.verticalLayout_7.addItem(spacerItem5)
|
|
141 |
spacerItem4 = QtWidgets.QSpacerItem(20, 10, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
|
|
142 |
self.verticalLayout_7.addItem(spacerItem4)
|
|
222 | 143 |
self.horizontalLayout_6 = QtWidgets.QHBoxLayout() |
223 | 144 |
self.horizontalLayout_6.setObjectName("horizontalLayout_6") |
224 | 145 |
self.label_4 = QtWidgets.QLabel(self.leftSideWidget) |
225 | 146 |
self.label_4.setObjectName("label_4") |
226 | 147 |
self.horizontalLayout_6.addWidget(self.label_4) |
227 |
self.spinBox_6 = QtWidgets.QSpinBox(self.leftSideWidget) |
|
228 |
self.spinBox_6.setMinimumSize(QtCore.QSize(70, 0)) |
|
229 |
self.spinBox_6.setObjectName("spinBox_6") |
|
230 |
self.horizontalLayout_6.addWidget(self.spinBox_6) |
|
148 |
self.lineEditChar = QtWidgets.QLineEdit(self.leftSideWidget) |
|
149 |
self.lineEditChar.setObjectName("lineEditChar") |
|
150 |
self.horizontalLayout_6.addWidget(self.lineEditChar) |
|
151 |
spacerItem5 = QtWidgets.QSpacerItem(150, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum) |
|
152 |
self.horizontalLayout_6.addItem(spacerItem5) |
|
153 |
self.pushButtonChange = QtWidgets.QPushButton(self.leftSideWidget) |
|
154 |
self.pushButtonChange.setObjectName("pushButtonChange") |
|
155 |
self.horizontalLayout_6.addWidget(self.pushButtonChange) |
|
231 | 156 |
self.verticalLayout_7.addLayout(self.horizontalLayout_6) |
232 | 157 |
spacerItem6 = QtWidgets.QSpacerItem(20, 30, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) |
233 | 158 |
self.verticalLayout_7.addItem(spacerItem6) |
... | ... | |
235 | 160 |
self.verticalLayout_7.addItem(spacerItem7) |
236 | 161 |
self.horizontalLayout_5 = QtWidgets.QHBoxLayout() |
237 | 162 |
self.horizontalLayout_5.setObjectName("horizontalLayout_5") |
238 |
self.pushButton_14 = QtWidgets.QPushButton(self.leftSideWidget)
|
|
163 |
self.pushButtonSave = QtWidgets.QPushButton(self.leftSideWidget)
|
|
239 | 164 |
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Maximum) |
240 | 165 |
sizePolicy.setHorizontalStretch(0) |
241 | 166 |
sizePolicy.setVerticalStretch(0) |
242 |
sizePolicy.setHeightForWidth(self.pushButton_14.sizePolicy().hasHeightForWidth())
|
|
243 |
self.pushButton_14.setSizePolicy(sizePolicy)
|
|
244 |
self.pushButton_14.setMinimumSize(QtCore.QSize(0, 32))
|
|
245 |
self.pushButton_14.setMaximumSize(QtCore.QSize(16777215, 32))
|
|
246 |
self.pushButton_14.setObjectName("pushButton_14")
|
|
247 |
self.horizontalLayout_5.addWidget(self.pushButton_14)
|
|
248 |
self.pushButton_13 = QtWidgets.QPushButton(self.leftSideWidget)
|
|
167 |
sizePolicy.setHeightForWidth(self.pushButtonSave.sizePolicy().hasHeightForWidth())
|
|
168 |
self.pushButtonSave.setSizePolicy(sizePolicy)
|
|
169 |
self.pushButtonSave.setMinimumSize(QtCore.QSize(0, 32))
|
|
170 |
self.pushButtonSave.setMaximumSize(QtCore.QSize(16777215, 32))
|
|
171 |
self.pushButtonSave.setObjectName("pushButtonSave")
|
|
172 |
self.horizontalLayout_5.addWidget(self.pushButtonSave)
|
|
173 |
self.pushButtonCancel = QtWidgets.QPushButton(self.leftSideWidget)
|
|
249 | 174 |
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Maximum) |
250 | 175 |
sizePolicy.setHorizontalStretch(0) |
251 | 176 |
sizePolicy.setVerticalStretch(0) |
252 |
sizePolicy.setHeightForWidth(self.pushButton_13.sizePolicy().hasHeightForWidth())
|
|
253 |
self.pushButton_13.setSizePolicy(sizePolicy)
|
|
254 |
self.pushButton_13.setMinimumSize(QtCore.QSize(0, 32))
|
|
255 |
self.pushButton_13.setMaximumSize(QtCore.QSize(16777215, 32))
|
|
256 |
self.pushButton_13.setObjectName("pushButton_13")
|
|
257 |
self.horizontalLayout_5.addWidget(self.pushButton_13)
|
|
177 |
sizePolicy.setHeightForWidth(self.pushButtonCancel.sizePolicy().hasHeightForWidth())
|
|
178 |
self.pushButtonCancel.setSizePolicy(sizePolicy)
|
|
179 |
self.pushButtonCancel.setMinimumSize(QtCore.QSize(0, 32))
|
|
180 |
self.pushButtonCancel.setMaximumSize(QtCore.QSize(16777215, 32))
|
|
181 |
self.pushButtonCancel.setObjectName("pushButtonCancel")
|
|
182 |
self.horizontalLayout_5.addWidget(self.pushButtonCancel)
|
|
258 | 183 |
self.verticalLayout_7.addLayout(self.horizontalLayout_5) |
259 | 184 |
self.sideWidget.addLayout(self.verticalLayout_7) |
260 | 185 |
self.horizontalLayout_4.addWidget(self.leftSideWidget) |
... | ... | |
267 | 192 |
def retranslateUi(self, TrainingEditorDialog): |
268 | 193 |
_translate = QtCore.QCoreApplication.translate |
269 | 194 |
TrainingEditorDialog.setWindowTitle(_translate("TrainingEditorDialog", "Training Editor")) |
270 |
self.checkBox_2.setText(_translate("TrainingEditorDialog", "CheckBox")) |
|
271 |
self.checkBox.setText(_translate("TrainingEditorDialog", "CheckBox")) |
|
272 |
self.pushButtonZoom.setText(_translate("TrainingEditorDialog", "확대")) |
|
273 |
self.pushButton_5.setText(_translate("TrainingEditorDialog", "PushButton")) |
|
274 |
self.pushButton_6.setText(_translate("TrainingEditorDialog", "PushButton")) |
|
275 |
self.pushButton_7.setText(_translate("TrainingEditorDialog", "PushButton")) |
|
276 |
self.pushButton_8.setText(_translate("TrainingEditorDialog", "PushButton")) |
|
277 |
self.pushButton_9.setText(_translate("TrainingEditorDialog", "PushButton")) |
|
278 |
self.pushButton_10.setText(_translate("TrainingEditorDialog", "PushButton")) |
|
279 |
self.pushButton_12.setText(_translate("TrainingEditorDialog", "Pre")) |
|
280 |
self.label_2.setText(_translate("TrainingEditorDialog", "Boxes")) |
|
281 |
self.pushButton_11.setText(_translate("TrainingEditorDialog", "Next")) |
|
195 |
self.pushButtonZoom.setText(_translate("TrainingEditorDialog", "Zoom")) |
|
196 |
self.pushButtonAdd.setText(_translate("TrainingEditorDialog", "추가")) |
|
197 |
self.pushButtonDelete.setText(_translate("TrainingEditorDialog", "삭제")) |
|
198 |
self.pushButtonMerge.setText(_translate("TrainingEditorDialog", "병합")) |
|
199 |
self.pushButtonSplite.setText(_translate("TrainingEditorDialog", "분할")) |
|
282 | 200 |
self.label_3.setText(_translate("TrainingEditorDialog", "Left")) |
283 | 201 |
self.label_6.setText(_translate("TrainingEditorDialog", "Top")) |
284 | 202 |
self.label_5.setText(_translate("TrainingEditorDialog", "Width")) |
285 | 203 |
self.label_7.setText(_translate("TrainingEditorDialog", "Height")) |
286 |
self.label_4.setText(_translate("TrainingEditorDialog", "TextLabel")) |
|
287 |
self.pushButton_14.setText(_translate("TrainingEditorDialog", "PushButton")) |
|
288 |
self.pushButton_13.setText(_translate("TrainingEditorDialog", "PushButton")) |
|
204 |
self.label_4.setText(_translate("TrainingEditorDialog", "Character")) |
|
205 |
self.pushButtonChange.setText(_translate("TrainingEditorDialog", "문자 변경")) |
|
206 |
self.pushButtonSave.setText(_translate("TrainingEditorDialog", "저장")) |
|
207 |
self.pushButtonCancel.setText(_translate("TrainingEditorDialog", "취소")) |
|
289 | 208 | |
290 | 209 | |
291 | 210 |
if __name__ == "__main__": |
DTI_PID/DTI_PID/TrainingImageListDialog.py | ||
---|---|---|
1 |
import sys |
|
2 |
import os |
|
3 |
from PyQt5.QtCore import * |
|
4 |
from PyQt5.QtGui import * |
|
5 |
from PyQt5.QtWidgets import * |
|
6 |
from AppDocData import AppDocData, Source |
|
7 |
import pytesseract |
|
8 |
import TrainingImageList_UI |
|
9 | ||
10 | ||
11 |
pytesseract.pytesseract.tesseract_cmd = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'Tesseract-OCR', 'tesseract.exe') |
|
12 |
tesseract_cmd = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'Tesseract-OCR', 'tesseract.exe') |
|
13 | ||
14 |
DEFAULT_CONF = """ |
|
15 |
--psm 6 -c tessedit_char_whitelist=ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-~.,/!@#$%&*(){}[]<>:;+=?\\"\\' |
|
16 |
""" |
|
17 | ||
18 |
class QTrainingImageListDialog(QDialog): |
|
19 | ||
20 |
trainingDataNumber = 0 |
|
21 | ||
22 |
def __init__(self, parent): |
|
23 |
QDialog.__init__(self, parent) |
|
24 | ||
25 |
self.ui = TrainingIamgeList_UI.Ui_TraingingImageListDialog() |
|
26 |
self.ui.setupUi(self) |
|
27 | ||
28 |
# for List |
|
29 |
self.ui.tableWidgetList.setSelectionMode(QAbstractItemView.SingleSelection) |
|
30 |
self.ui.tableWidgetList.setColumnCount(3) |
|
31 | ||
32 |
docData = AppDocData.instance() |
|
33 |
dataList = docData.getDrawingFileList() |
|
34 |
self.ui.tableWidgetList.setRowCount(len(dataList)) |
|
35 | ||
36 |
## column header 명 설정 |
|
37 |
headerLabel = docData.getCurrentProject().getName() |
|
38 |
self.ui.tableWidgetList.setHorizontalHeaderLabels(['No.', headerLabel, '작업 상태']) |
|
39 |
self.ui.tableWidgetList.horizontalHeaderItem(1).setToolTip('도면 이름') # header tooltip |
|
40 |
self.ui.tableWidgetList.horizontalHeaderItem(2).setToolTip('작업 상태') # header tooltip |
|
41 |
self.ui.tableWidgetList.horizontalHeaderItem(1).setSizeHint(QSize(30, 30)) |
|
42 |
self.ui.tableWidgetList.horizontalHeader().setSectionResizeMode(0, QHeaderView.ResizeToContents) |
|
43 |
self.ui.tableWidgetList.horizontalHeader().setSectionResizeMode(1, QHeaderView.Stretch) |
|
44 |
self.ui.tableWidgetList.setEditTriggers(QAbstractItemView.NoEditTriggers) |
|
45 |
|
|
46 |
row = 0 |
|
47 |
for data in dataList: |
|
48 |
self.ui.tableWidgetList.setItem(row, 0, QTableWidgetItem(str(row + 1))) |
|
49 |
self.ui.tableWidgetList.setItem(row, 1, QTableWidgetItem(data)) |
|
50 |
row += 1 |
|
51 | ||
52 |
# connect signals and slots |
|
53 |
self.ui.tableWidgetList.cellDoubleClicked.connect(self.listCellDoubleClicked) |
|
54 |
self.ui.pushButtonAddList.clicked.connect(self.addListClicked) |
|
55 |
self.ui.pushButtonMakeTrainingData.clicked.connect(self.makeTrainingDataClicked) |
|
56 | ||
57 |
''' |
|
58 |
@brief make training data(text image + Box file) by button click |
|
59 |
@author euisung |
|
60 |
@date 2018.09.28 |
|
61 |
''' |
|
62 |
def makeTrainingDataClicked(self): |
|
63 |
from TextDetector import TextDetector |
|
64 |
from PIL import Image |
|
65 |
import cv2, math |
|
66 | ||
67 |
try: |
|
68 |
row = self.ui.tableWidgetSelected.selectedIndexes()[0].row() |
|
69 |
col = self.ui.tableWidgetSelected.selectedIndexes()[0].column() |
|
70 |
drawingName = self.ui.tableWidgetSelected.item(row, 1).text() |
|
71 |
except: |
|
72 |
return |
|
73 | ||
74 |
try: |
|
75 |
appDocData = AppDocData.instance() |
|
76 |
project = appDocData.getCurrentProject() |
|
77 |
textDetector = TextDetector() |
|
78 | ||
79 |
drawingPath = os.path.join(project.getDrawingFilePath(), drawingName) |
|
80 |
drawing = Source(Image.open(drawingPath)) |
|
81 | ||
82 |
_imgSrc = cv2.cvtColor(cv2.imread(drawingPath), cv2.COLOR_BGR2GRAY) |
|
83 |
blur = cv2.GaussianBlur(_imgSrc , (5,5),0) |
|
84 |
_imgSrc = cv2.threshold(_imgSrc , 0, 255, cv2.THRESH_BINARY+cv2.THRESH_OTSU)[1] |
|
85 | ||
86 |
textAreas = textDetector.detectTextAreas(_imgSrc , (0,0)) |
|
87 | ||
88 |
areasNumber = len(textAreas) |
|
89 |
print('total text areas : ' + str(areasNumber)) |
|
90 |
maxW, maxH, sumW, sumH, count = 0, 0, 0, 0, 0 |
|
91 |
for textArea in textAreas: |
|
92 |
areaW = textArea.getW() |
|
93 |
areaH = textArea.getH() |
|
94 |
areaA = textArea.getAngle() |
|
95 |
if areaA is 90: |
|
96 |
areaW, areaH = areaH, areaW |
|
97 |
if areaA is not 0 and areaA is not 90: |
|
98 |
continue |
|
99 |
count += 1 |
|
100 |
sumW += areaW |
|
101 |
sumH += areaH |
|
102 |
if maxW < areaW: |
|
103 |
maxW = areaW |
|
104 |
if maxH < areaH: |
|
105 |
maxH = areaH |
|
106 |
|
|
107 |
print('count : ' + str(count)) |
|
108 |
print('max width : ' + str(maxW) + ', max height : ' + str(maxH)) |
|
109 |
argW = sumW / count |
|
110 |
argH = sumH / count |
|
111 |
print('arg width : ' + str(argW) + ', arg height : ' + str(argH)) |
|
112 |
totalArea = math.ceil(argW * argH * count) |
|
113 |
totalBaseWidth = math.ceil(math.sqrt(totalArea)) |
|
114 |
print('total area theory : ' + str(totalArea) + ', total width : ' + str(totalBaseWidth)) |
|
115 | ||
116 |
maxLineH, lineW, totalHeight = 0, 0, 0 |
|
117 |
for index in range(0, areasNumber): |
|
118 |
areaW = textAreas[index].getW() |
|
119 |
areaH = textAreas[index].getH() |
|
120 |
areaA = textAreas[index].getAngle() |
|
121 |
if areaA is 90: |
|
122 |
areaW, areaH = areaH, areaW |
|
123 |
if areaA is not 0 and areaA is not 90: |
|
124 |
continue |
|
125 | ||
126 |
if maxLineH < areaH: |
|
127 |
maxLineH = areaH |
|
128 |
if lineW + areaW < totalBaseWidth: |
|
129 |
lineW += areaW |
|
130 |
else: |
|
131 |
lineW = areaW |
|
132 |
totalHeight += maxLineH |
|
133 |
totalHeight += maxLineH |
|
134 |
print('total area real : ' + str(totalBaseWidth * totalHeight) +', total width : ' + str(totalBaseWidth) + ', total height : ' + str(totalHeight) + ', ratio : ' + str(totalHeight / totalBaseWidth)) |
|
135 | ||
136 |
trainingTextImg = Image.new("RGB", (totalBaseWidth, totalHeight), (256,256,256)) |
|
137 |
maxLineH, lineW, totalHeight, currentX, currentY = 0, 0, 0, 0, 0 |
|
138 |
for index in range(0, areasNumber): |
|
139 |
#print(index) |
|
140 |
areaW = textAreas[index].getW() |
|
141 |
areaH = textAreas[index].getH() |
|
142 |
areaA = textAreas[index].getAngle() |
|
143 | ||
144 |
textAreaImg = drawing.source.crop((textAreas[index].getX(), textAreas[index].getY(), textAreas[index].getX() + areaW, textAreas[index].getY() + areaH)) |
|
145 | ||
146 |
if areaA is 90: |
|
147 |
areaW, areaH = areaH, areaW |
|
148 |
textAreaImg = textAreaImg.transpose(Image.ROTATE_270) |
|
149 |
if areaA is not 0 and areaA is not 90: |
|
150 |
continue |
|
151 | ||
152 |
if maxLineH < areaH: |
|
153 |
maxLineH = areaH |
|
154 |
if lineW + areaW < totalBaseWidth: |
|
155 |
lineW += areaW |
|
156 |
trainingTextImg.paste(textAreaImg, (currentX, currentY, currentX + areaW, currentY + areaH)) |
|
157 |
currentX = lineW |
|
158 |
else: |
|
159 |
lineW = areaW |
|
160 |
totalHeight += maxLineH |
|
161 |
currentX = 0 |
|
162 |
currentY = totalHeight |
|
163 |
trainingTextImg.paste(textAreaImg, (currentX, currentY, currentX + areaW, currentY + areaH)) |
|
164 |
currentX = areaW |
|
165 |
#trainingTextImg.show() |
|
166 |
#trainingTextImg.show() |
|
167 |
boundaryOcrData = pytesseract.image_to_boxes(trainingTextImg, config=DEFAULT_CONF, lang='seed+eng') |
|
168 | ||
169 |
trainingImgPath = os.path.join(project.getTrainingFilePath(), 'seed.seedF.exp0.tif') |
|
170 |
trainingBoxPath = os.path.join(project.getTrainingFilePath(), 'seed.seedF.exp0.box') |
|
171 | ||
172 |
trainingTextImg.save(trainingImgPath, compression='tiff_lzw') |
|
173 |
fw = open(trainingBoxPath, 'w') #파일 있으면 새로 만듬 예외 처리 안됨, 임시 |
|
174 |
fw.write(boundaryOcrData) |
|
175 |
fw.close() |
|
176 |
|
|
177 |
except Exception as ex: |
|
178 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
|
179 |
return |
|
180 | ||
181 |
''' |
|
182 |
@brief add drawing to Selected by button click |
|
183 |
@author euisung |
|
184 |
@date 2018.09.28 |
|
185 |
''' |
|
186 |
def addListClicked(self): |
|
187 |
try: |
|
188 |
row = self.ui.tableWidgetList.selectedIndexes()[0].row() |
|
189 |
col = self.ui.tableWidgetList.selectedIndexes()[0].column() |
|
190 |
self.listCellDoubleClicked(row, col) |
|
191 |
except Exception as ex: |
|
192 |
pass |
|
193 |
return |
|
194 | ||
195 | ||
196 |
''' |
|
197 |
@brief add drawing to Selected by cell double click |
|
198 |
@author euisung |
|
199 |
@date 2018.09.28 |
|
200 |
''' |
|
201 |
def listCellDoubleClicked(self, row, col): |
|
202 |
#print('row : ' + str(row) + ', col : ' + str(col)) |
|
203 |
rowPosition = self.ui.tableWidgetSelected.rowCount() |
|
204 |
self.ui.tableWidgetSelected.setRowCount(rowPosition + 1) |
|
205 | ||
206 |
drawingName = self.ui.tableWidgetList.item(row, 1).text() |
|
207 |
#print(drawingName) |
|
208 |
self.trainingDataNumber = self.trainingDataNumber + 1 |
|
209 |
self.ui.tableWidgetSelected.setItem(rowPosition, 0, QTableWidgetItem(str(self.trainingDataNumber))) |
|
210 |
self.ui.tableWidgetSelected.setItem(rowPosition, 1, QTableWidgetItem(drawingName)) |
|
211 |
self.ui.tableWidgetSelected.setItem(rowPosition, 2, QTableWidgetItem('신규')) |
|
212 | ||
213 |
return |
|
214 | ||
215 | ||
216 |
|
DTI_PID/DTI_PID/TrainingImageList_UI.py | ||
---|---|---|
1 |
# -*- coding: utf-8 -*- |
|
2 | ||
3 |
# Form implementation generated from reading ui file '.\UI\TrainingImageList.ui' |
|
4 |
# |
|
5 |
# Created by: PyQt5 UI code generator 5.11.2 |
|
6 |
# |
|
7 |
# WARNING! All changes made in this file will be lost! |
|
8 | ||
9 |
from PyQt5 import QtCore, QtGui, QtWidgets |
|
10 | ||
11 |
class Ui_TraingingListDialog(object): |
|
12 |
def setupUi(self, TraingingListDialog): |
|
13 |
TraingingListDialog.setObjectName("TraingingListDialog") |
|
14 |
TraingingListDialog.resize(943, 535) |
|
15 |
self.gridLayout = QtWidgets.QGridLayout(TraingingListDialog) |
|
16 |
self.gridLayout.setObjectName("gridLayout") |
|
17 |
self.verticalLayout = QtWidgets.QVBoxLayout() |
|
18 |
self.verticalLayout.setObjectName("verticalLayout") |
|
19 |
self.horizontalLayout_2 = QtWidgets.QHBoxLayout() |
|
20 |
self.horizontalLayout_2.setObjectName("horizontalLayout_2") |
|
21 |
self.verticalLayout_3 = QtWidgets.QVBoxLayout() |
|
22 |
self.verticalLayout_3.setObjectName("verticalLayout_3") |
|
23 |
self.label_2 = QtWidgets.QLabel(TraingingListDialog) |
|
24 |
self.label_2.setAlignment(QtCore.Qt.AlignCenter) |
|
25 |
self.label_2.setObjectName("label_2") |
|
26 |
self.verticalLayout_3.addWidget(self.label_2) |
|
27 |
self.tableWidgetList = QtWidgets.QTableWidget(TraingingListDialog) |
|
28 |
self.tableWidgetList.setColumnCount(1) |
|
29 |
self.tableWidgetList.setObjectName("tableWidgetList") |
|
30 |
self.tableWidgetList.setRowCount(0) |
|
31 |
self.tableWidgetList.verticalHeader().setVisible(False) |
|
32 |
self.verticalLayout_3.addWidget(self.tableWidgetList) |
|
33 |
self.pushButtonAddList = QtWidgets.QPushButton(TraingingListDialog) |
|
34 |
self.pushButtonAddList.setObjectName("pushButtonAddList") |
|
35 |
self.verticalLayout_3.addWidget(self.pushButtonAddList) |
|
36 |
self.pushButtonMakeTrainingData = QtWidgets.QPushButton(TraingingListDialog) |
|
37 |
self.pushButtonMakeTrainingData.setObjectName("pushButtonMakeTrainingData") |
|
38 |
self.verticalLayout_3.addWidget(self.pushButtonMakeTrainingData) |
|
39 |
self.horizontalLayout_2.addLayout(self.verticalLayout_3) |
|
40 |
self.verticalLayout.addLayout(self.horizontalLayout_2) |
|
41 |
self.horizontalLayout = QtWidgets.QHBoxLayout() |
|
42 |
self.horizontalLayout.setObjectName("horizontalLayout") |
|
43 |
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) |
|
44 |
self.horizontalLayout.addItem(spacerItem) |
|
45 |
self.pushButton_2 = QtWidgets.QPushButton(TraingingListDialog) |
|
46 |
self.pushButton_2.setObjectName("pushButton_2") |
|
47 |
self.horizontalLayout.addWidget(self.pushButton_2) |
|
48 |
self.pushButton = QtWidgets.QPushButton(TraingingListDialog) |
|
49 |
self.pushButton.setObjectName("pushButton") |
|
50 |
self.horizontalLayout.addWidget(self.pushButton) |
|
51 |
self.verticalLayout.addLayout(self.horizontalLayout) |
|
52 |
self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1) |
|
53 | ||
54 |
self.retranslateUi(TraingingListDialog) |
|
55 |
QtCore.QMetaObject.connectSlotsByName(TraingingListDialog) |
|
56 | ||
57 |
def retranslateUi(self, TraingingListDialog): |
|
58 |
_translate = QtCore.QCoreApplication.translate |
|
59 |
TraingingListDialog.setWindowTitle(_translate("TraingingListDialog", "Training List")) |
|
60 |
self.label_2.setText(_translate("TraingingListDialog", "List")) |
|
61 |
self.pushButtonAddList.setText(_translate("TraingingListDialog", "추가")) |
|
62 |
self.pushButtonMakeTrainingData.setText(_translate("TraingingListDialog", "학습 데이터 생성")) |
|
63 |
self.pushButton_2.setText(_translate("TraingingListDialog", "PushButton")) |
|
64 |
self.pushButton.setText(_translate("TraingingListDialog", "PushButton")) |
|
65 | ||
66 | ||
67 |
if __name__ == "__main__": |
|
68 |
import sys |
|
69 |
app = QtWidgets.QApplication(sys.argv) |
|
70 |
TraingingListDialog = QtWidgets.QDialog() |
|
71 |
ui = Ui_TraingingListDialog() |
|
72 |
ui.setupUi(TraingingListDialog) |
|
73 |
TraingingListDialog.show() |
|
74 |
sys.exit(app.exec_()) |
|
75 |
DTI_PID/DTI_PID/UI/OcrResultDialog.ui | ||
---|---|---|
27 | 27 |
<string>OCR</string> |
28 | 28 |
</property> |
29 | 29 |
<layout class="QGridLayout" name="gridLayout_2"> |
30 |
<item row="2" column="0">
|
|
30 |
<item row="3" column="0">
|
|
31 | 31 |
<widget class="QDialogButtonBox" name="ocrDialogButtonBox"> |
32 | 32 |
<property name="orientation"> |
33 | 33 |
<enum>Qt::Horizontal</enum> |
... | ... | |
240 | 240 |
</widget> |
241 | 241 |
</widget> |
242 | 242 |
</item> |
243 |
<item row="2" column="0"> |
|
244 |
<widget class="QPushButton" name="pushButtonMakeTrainingImage"> |
|
245 |
<property name="text"> |
|
246 |
<string>OCR 학습 이미지 저장</string> |
|
247 |
</property> |
|
248 |
</widget> |
|
249 |
</item> |
|
243 | 250 |
</layout> |
244 | 251 |
</widget> |
245 | 252 |
<resources> |
DTI_PID/DTI_PID/UI/TrainingEditor.ui | ||
---|---|---|
6 | 6 |
<rect> |
7 | 7 |
<x>0</x> |
8 | 8 |
<y>0</y> |
9 |
<width>1378</width>
|
|
10 |
<height>805</height>
|
|
9 |
<width>1088</width>
|
|
10 |
<height>780</height>
|
|
11 | 11 |
</rect> |
12 | 12 |
</property> |
13 | 13 |
<property name="windowTitle"> |
... | ... | |
19 | 19 |
<item> |
20 | 20 |
<layout class="QHBoxLayout" name="horizontalLayout_2"> |
21 | 21 |
<item> |
22 |
<layout class="QVBoxLayout" name="verticalLayout_2">
|
|
22 |
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
23 | 23 |
<item> |
24 |
<widget class="QCheckBox" name="checkBox_2">
|
|
25 |
<property name="sizePolicy">
|
|
26 |
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
|
27 |
<horstretch>0</horstretch>
|
|
28 |
<verstretch>0</verstretch>
|
|
29 |
</sizepolicy>
|
|
24 |
<widget class="QPushButton" name="pushButtonZoom">
|
|
25 |
<property name="minimumSize">
|
|
26 |
<size> |
|
27 |
<width>64</width>
|
|
28 |
<height>64</height>
|
|
29 |
</size> |
|
30 | 30 |
</property> |
31 | 31 |
<property name="maximumSize"> |
32 | 32 |
<size> |
33 |
<width>16777215</width>
|
|
34 |
<height>32</height>
|
|
33 |
<width>64</width>
|
|
34 |
<height>64</height>
|
|
35 | 35 |
</size> |
36 | 36 |
</property> |
37 | 37 |
<property name="text"> |
38 |
<string>CheckBox</string> |
|
38 |
<string>Zoom</string> |
|
39 |
</property> |
|
40 |
<property name="checkable"> |
|
41 |
<bool>true</bool> |
|
39 | 42 |
</property> |
40 | 43 |
</widget> |
41 | 44 |
</item> |
42 | 45 |
<item> |
43 |
<widget class="QCheckBox" name="checkBox">
|
|
46 |
<widget class="QPushButton" name="pushButtonAdd">
|
|
44 | 47 |
<property name="sizePolicy"> |
45 |
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
|
48 |
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
|
46 | 49 |
<horstretch>0</horstretch> |
47 | 50 |
<verstretch>0</verstretch> |
48 | 51 |
</sizepolicy> |
49 | 52 |
</property> |
53 |
<property name="minimumSize"> |
|
54 |
<size> |
|
55 |
<width>64</width> |
|
56 |
<height>64</height> |
|
57 |
</size> |
|
58 |
</property> |
|
50 | 59 |
<property name="maximumSize"> |
51 | 60 |
<size> |
52 |
<width>16777215</width>
|
|
53 |
<height>32</height>
|
|
61 |
<width>64</width>
|
|
62 |
<height>64</height>
|
|
54 | 63 |
</size> |
55 | 64 |
</property> |
56 | 65 |
<property name="text"> |
57 |
<string>CheckBox</string>
|
|
66 |
<string>추가</string>
|
|
58 | 67 |
</property> |
59 | 68 |
</widget> |
60 | 69 |
</item> |
61 |
</layout> |
|
62 |
</item> |
|
63 |
<item> |
|
64 |
<widget class="QPushButton" name="pushButtonZoom"> |
|
65 |
<property name="sizePolicy"> |
|
66 |
<sizepolicy hsizetype="Maximum" vsizetype="Maximum"> |
|
67 |
<horstretch>0</horstretch> |
|
68 |
<verstretch>0</verstretch> |
|
69 |
</sizepolicy> |
|
70 |
</property> |
|
71 |
<property name="minimumSize"> |
|
72 |
<size> |
|
73 |
<width>64</width> |
|
74 |
<height>64</height> |
|
75 |
</size> |
|
76 |
</property> |
|
77 |
<property name="maximumSize"> |
|
78 |
<size> |
|
79 |
<width>64</width> |
|
80 |
<height>64</height> |
|
81 |
</size> |
|
82 |
</property> |
|
83 |
<property name="toolTip"> |
|
84 |
<string extracomment="축소 : Ctrl + Mouse Wheel Down"/> |
|
85 |
</property> |
|
86 |
<property name="text"> |
|
87 |
<string>확대</string> |
|
88 |
</property> |
|
89 |
<property name="iconSize"> |
|
90 |
<size> |
|
91 |
<width>16</width> |
|
92 |
<height>16</height> |
|
93 |
</size> |
|
94 |
</property> |
|
95 |
<property name="checkable"> |
|
96 |
<bool>true</bool> |
|
97 |
</property> |
|
98 |
</widget> |
|
99 |
</item> |
|
100 |
<item> |
|
101 |
<widget class="QPushButton" name="pushButton_5"> |
|
102 |
<property name="sizePolicy"> |
|
103 |
<sizepolicy hsizetype="Maximum" vsizetype="Maximum"> |
|
104 |
<horstretch>0</horstretch> |
|
105 |
<verstretch>0</verstretch> |
|
106 |
</sizepolicy> |
|
107 |
</property> |
|
108 |
<property name="minimumSize"> |
|
109 |
<size> |
|
110 |
<width>80</width> |
|
111 |
<height>32</height> |
|
112 |
</size> |
|
113 |
</property> |
|
114 |
<property name="maximumSize"> |
|
115 |
<size> |
|
116 |
<width>80</width> |
|
117 |
<height>32</height> |
|
118 |
</size> |
|
119 |
</property> |
|
120 |
<property name="text"> |
|
121 |
<string>PushButton</string> |
|
122 |
</property> |
|
123 |
</widget> |
|
124 |
</item> |
|
125 |
<item> |
|
126 |
<widget class="QPushButton" name="pushButton_6"> |
|
127 |
<property name="sizePolicy"> |
|
128 |
<sizepolicy hsizetype="Maximum" vsizetype="Maximum"> |
|
129 |
<horstretch>0</horstretch> |
|
130 |
<verstretch>0</verstretch> |
|
131 |
</sizepolicy> |
|
132 |
</property> |
|
133 |
<property name="minimumSize"> |
|
134 |
<size> |
|
135 |
<width>80</width> |
|
136 |
<height>32</height> |
|
137 |
</size> |
|
138 |
</property> |
|
139 |
<property name="maximumSize"> |
|
140 |
<size> |
|
141 |
<width>80</width> |
|
142 |
<height>32</height> |
|
143 |
</size> |
|
144 |
</property> |
|
145 |
<property name="text"> |
|
146 |
<string>PushButton</string> |
|
147 |
</property> |
|
148 |
</widget> |
|
149 |
</item> |
|
150 |
<item> |
|
151 |
<widget class="QPushButton" name="pushButton_7"> |
|
152 |
<property name="sizePolicy"> |
|
153 |
<sizepolicy hsizetype="Maximum" vsizetype="Maximum"> |
|
154 |
<horstretch>0</horstretch> |
|
155 |
<verstretch>0</verstretch> |
|
156 |
</sizepolicy> |
|
157 |
</property> |
|
158 |
<property name="minimumSize"> |
|
159 |
<size> |
|
160 |
<width>80</width> |
|
161 |
<height>32</height> |
|
162 |
</size> |
|
163 |
</property> |
|
164 |
<property name="maximumSize"> |
|
165 |
<size> |
|
166 |
<width>80</width> |
|
167 |
<height>32</height> |
|
168 |
</size> |
|
169 |
</property> |
|
170 |
<property name="text"> |
|
171 |
<string>PushButton</string> |
|
172 |
</property> |
|
173 |
</widget> |
|
174 |
</item> |
|
175 |
<item> |
|
176 |
<widget class="QPushButton" name="pushButton_8"> |
|
177 |
<property name="sizePolicy"> |
|
178 |
<sizepolicy hsizetype="Maximum" vsizetype="Maximum"> |
|
179 |
<horstretch>0</horstretch> |
|
180 |
<verstretch>0</verstretch> |
|
181 |
</sizepolicy> |
|
182 |
</property> |
|
183 |
<property name="minimumSize"> |
|
184 |
<size> |
|
185 |
<width>80</width> |
|
186 |
<height>32</height> |
|
187 |
</size> |
|
188 |
</property> |
|
189 |
<property name="maximumSize"> |
|
190 |
<size> |
|
191 |
<width>80</width> |
|
192 |
<height>32</height> |
|
193 |
</size> |
|
194 |
</property> |
|
195 |
<property name="text"> |
|
196 |
<string>PushButton</string> |
|
197 |
</property> |
|
198 |
</widget> |
|
199 |
</item> |
|
200 |
<item> |
|
201 |
<widget class="QPushButton" name="pushButton_9"> |
|
202 |
<property name="sizePolicy"> |
|
203 |
<sizepolicy hsizetype="Maximum" vsizetype="Maximum"> |
|
204 |
<horstretch>0</horstretch> |
|
205 |
<verstretch>0</verstretch> |
|
206 |
</sizepolicy> |
|
207 |
</property> |
|
208 |
<property name="minimumSize"> |
|
209 |
<size> |
|
210 |
<width>80</width> |
|
211 |
<height>32</height> |
|
212 |
</size> |
|
213 |
</property> |
|
214 |
<property name="maximumSize"> |
|
215 |
<size> |
|
216 |
<width>80</width> |
|
217 |
<height>32</height> |
|
218 |
</size> |
|
219 |
</property> |
|
220 |
<property name="text"> |
|
221 |
<string>PushButton</string> |
|
222 |
</property> |
|
223 |
</widget> |
|
224 |
</item> |
|
225 |
<item> |
|
226 |
<widget class="QPushButton" name="pushButton_10"> |
|
227 |
<property name="sizePolicy"> |
|
228 |
<sizepolicy hsizetype="Maximum" vsizetype="Maximum"> |
|
229 |
<horstretch>0</horstretch> |
|
230 |
<verstretch>0</verstretch> |
|
231 |
</sizepolicy> |
|
232 |
</property> |
|
233 |
<property name="minimumSize"> |
|
234 |
<size> |
|
235 |
<width>80</width> |
|
236 |
<height>32</height> |
|
237 |
</size> |
|
238 |
</property> |
|
239 |
<property name="maximumSize"> |
|
240 |
<size> |
|
241 |
<width>80</width> |
|
242 |
<height>32</height> |
|
243 |
</size> |
|
244 |
</property> |
|
245 |
<property name="text"> |
|
246 |
<string>PushButton</string> |
|
247 |
</property> |
|
248 |
</widget> |
|
249 |
</item> |
|
250 |
<item> |
|
251 |
<spacer name="horizontalSpacer"> |
|
252 |
<property name="orientation"> |
|
253 |
<enum>Qt::Horizontal</enum> |
|
254 |
</property> |
|
255 |
<property name="sizeType"> |
|
256 |
<enum>QSizePolicy::Expanding</enum> |
|
257 |
</property> |
|
258 |
<property name="sizeHint" stdset="0"> |
|
259 |
<size> |
|
260 |
<width>20</width> |
|
261 |
<height>20</height> |
|
262 |
</size> |
|
263 |
</property> |
|
264 |
</spacer> |
|
265 |
</item> |
|
266 |
<item> |
|
267 |
<widget class="QPushButton" name="pushButton_12"> |
|
268 |
<property name="sizePolicy"> |
|
269 |
<sizepolicy hsizetype="Maximum" vsizetype="Maximum"> |
|
270 |
<horstretch>0</horstretch> |
|
271 |
<verstretch>0</verstretch> |
|
272 |
</sizepolicy> |
|
273 |
</property> |
|
274 |
<property name="minimumSize"> |
|
275 |
<size> |
|
276 |
<width>35</width> |
|
277 |
<height>64</height> |
|
278 |
</size> |
|
279 |
</property> |
|
280 |
<property name="maximumSize"> |
|
281 |
<size> |
|
282 |
<width>32</width> |
|
283 |
<height>64</height> |
|
284 |
</size> |
|
285 |
</property> |
|
286 |
<property name="text"> |
|
287 |
<string>Pre</string> |
|
288 |
</property> |
|
289 |
</widget> |
|
290 |
</item> |
|
291 |
<item> |
|
292 |
<layout class="QVBoxLayout" name="verticalLayout_3"> |
|
293 | 70 |
<item> |
294 |
<spacer name="horizontalSpacer_2"> |
|
295 |
<property name="orientation"> |
|
296 |
<enum>Qt::Horizontal</enum> |
|
71 |
<widget class="QPushButton" name="pushButtonDelete"> |
|
72 |
<property name="sizePolicy"> |
|
73 |
<sizepolicy hsizetype="Maximum" vsizetype="Maximum"> |
|
74 |
<horstretch>0</horstretch> |
|
75 |
<verstretch>0</verstretch> |
|
76 |
</sizepolicy> |
|
297 | 77 |
</property> |
298 |
<property name="sizeType"> |
|
299 |
<enum>QSizePolicy::Minimum</enum> |
|
78 |
<property name="minimumSize"> |
|
79 |
<size> |
|
80 |
<width>64</width> |
|
81 |
<height>64</height> |
|
82 |
</size> |
|
300 | 83 |
</property> |
301 |
<property name="sizeHint" stdset="0">
|
|
84 |
<property name="maximumSize">
|
|
302 | 85 |
<size> |
303 |
<width>40</width>
|
|
304 |
<height>20</height>
|
|
86 |
<width>64</width>
|
|
87 |
<height>64</height>
|
|
305 | 88 |
</size> |
306 | 89 |
</property> |
307 |
</spacer> |
|
90 |
<property name="text"> |
|
91 |
<string>삭제</string> |
|
92 |
</property> |
|
93 |
</widget> |
|
308 | 94 |
</item> |
309 | 95 |
<item> |
310 |
<widget class="QLineEdit" name="lineEdit_2">
|
|
96 |
<widget class="QPushButton" name="pushButtonMerge">
|
|
311 | 97 |
<property name="sizePolicy"> |
312 |
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
98 |
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
|
313 | 99 |
<horstretch>0</horstretch> |
314 | 100 |
<verstretch>0</verstretch> |
315 | 101 |
</sizepolicy> |
316 | 102 |
</property> |
103 |
<property name="minimumSize"> |
|
104 |
<size> |
|
105 |
<width>64</width> |
|
106 |
<height>64</height> |
|
107 |
</size> |
|
108 |
</property> |
|
317 | 109 |
<property name="maximumSize"> |
318 | 110 |
<size> |
319 |
<width>100</width>
|
|
320 |
<height>16777215</height>
|
|
111 |
<width>64</width>
|
|
112 |
<height>64</height>
|
|
321 | 113 |
</size> |
322 | 114 |
</property> |
115 |
<property name="text"> |
|
116 |
<string>병합</string> |
|
117 |
</property> |
|
323 | 118 |
</widget> |
324 | 119 |
</item> |
325 | 120 |
<item> |
326 |
<widget class="QLabel" name="label_2">
|
|
121 |
<widget class="QPushButton" name="pushButtonSplite">
|
|
327 | 122 |
<property name="sizePolicy"> |
328 |
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
|
123 |
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
|
329 | 124 |
<horstretch>0</horstretch> |
330 | 125 |
<verstretch>0</verstretch> |
331 | 126 |
</sizepolicy> |
332 | 127 |
</property> |
128 |
<property name="minimumSize"> |
|
129 |
<size> |
|
130 |
<width>64</width> |
|
131 |
<height>64</height> |
|
132 |
</size> |
|
133 |
</property> |
|
333 | 134 |
<property name="maximumSize"> |
334 | 135 |
<size> |
335 |
<width>100</width>
|
|
336 |
<height>32</height>
|
|
136 |
<width>64</width>
|
|
137 |
<height>64</height>
|
|
337 | 138 |
</size> |
338 | 139 |
</property> |
339 | 140 |
<property name="text"> |
340 |
<string>Boxes</string> |
|
341 |
</property> |
|
342 |
<property name="alignment"> |
|
343 |
<set>Qt::AlignCenter</set> |
|
141 |
<string>분할</string> |
|
344 | 142 |
</property> |
345 | 143 |
</widget> |
346 | 144 |
</item> |
347 | 145 |
</layout> |
348 | 146 |
</item> |
349 | 147 |
<item> |
350 |
<widget class="QPushButton" name="pushButton_11"> |
|
351 |
<property name="sizePolicy"> |
|
352 |
<sizepolicy hsizetype="Maximum" vsizetype="Maximum"> |
|
353 |
<horstretch>0</horstretch> |
|
354 |
<verstretch>0</verstretch> |
|
355 |
</sizepolicy> |
|
148 |
<spacer name="horizontalSpacer"> |
|
149 |
<property name="orientation"> |
|
150 |
<enum>Qt::Horizontal</enum> |
|
356 | 151 |
</property> |
357 |
<property name="minimumSize"> |
|
358 |
<size> |
|
359 |
<width>35</width> |
|
360 |
<height>64</height> |
|
361 |
</size> |
|
152 |
<property name="sizeType"> |
|
153 |
<enum>QSizePolicy::Expanding</enum> |
|
362 | 154 |
</property> |
363 |
<property name="maximumSize">
|
|
155 |
<property name="sizeHint" stdset="0">
|
|
364 | 156 |
<size> |
365 |
<width>32</width>
|
|
366 |
<height>64</height>
|
|
157 |
<width>20</width>
|
|
158 |
<height>20</height>
|
|
367 | 159 |
</size> |
368 | 160 |
</property> |
369 |
<property name="text"> |
|
370 |
<string>Next</string> |
|
371 |
</property> |
|
372 |
</widget> |
|
161 |
</spacer> |
|
373 | 162 |
</item> |
374 | 163 |
</layout> |
375 | 164 |
</item> |
... | ... | |
553 | 342 |
<item> |
554 | 343 |
<widget class="QLabel" name="label_4"> |
555 | 344 |
<property name="text"> |
556 |
<string>TextLabel</string>
|
|
345 |
<string>Character</string>
|
|
557 | 346 |
</property> |
558 | 347 |
</widget> |
559 | 348 |
</item> |
560 | 349 |
<item> |
561 |
<widget class="QSpinBox" name="spinBox_6"> |
|
562 |
<property name="minimumSize"> |
|
350 |
<widget class="QLineEdit" name="lineEditChar"/> |
|
351 |
</item> |
|
352 |
<item> |
|
353 |
<spacer name="horizontalSpacer_5"> |
|
354 |
<property name="orientation"> |
|
355 |
<enum>Qt::Horizontal</enum> |
|
356 |
</property> |
|
357 |
<property name="sizeType"> |
|
358 |
<enum>QSizePolicy::Maximum</enum> |
|
359 |
</property> |
|
360 |
<property name="sizeHint" stdset="0"> |
|
563 | 361 |
<size> |
564 |
<width>70</width>
|
|
565 |
<height>0</height> |
|
362 |
<width>150</width>
|
|
363 |
<height>20</height>
|
|
566 | 364 |
</size> |
567 | 365 |
</property> |
366 |
</spacer> |
|
367 |
</item> |
|
368 |
<item> |
|
369 |
<widget class="QPushButton" name="pushButtonChange"> |
|
370 |
<property name="text"> |
|
371 |
<string>문자 변경</string> |
|
372 |
</property> |
|
568 | 373 |
</widget> |
569 | 374 |
</item> |
570 | 375 |
</layout> |
... | ... | |
604 | 409 |
<item> |
605 | 410 |
<layout class="QHBoxLayout" name="horizontalLayout_5"> |
606 | 411 |
<item> |
607 |
<widget class="QPushButton" name="pushButton_14">
|
|
412 |
<widget class="QPushButton" name="pushButtonSave">
|
|
608 | 413 |
<property name="sizePolicy"> |
609 | 414 |
<sizepolicy hsizetype="Minimum" vsizetype="Maximum"> |
610 | 415 |
<horstretch>0</horstretch> |
... | ... | |
624 | 429 |
</size> |
625 | 430 |
</property> |
626 | 431 |
<property name="text"> |
627 |
<string>PushButton</string>
|
|
432 |
<string>저장</string>
|
|
628 | 433 |
</property> |
629 | 434 |
</widget> |
630 | 435 |
</item> |
631 | 436 |
<item> |
632 |
<widget class="QPushButton" name="pushButton_13">
|
|
437 |
<widget class="QPushButton" name="pushButtonCancel">
|
|
633 | 438 |
<property name="sizePolicy"> |
634 | 439 |
<sizepolicy hsizetype="Minimum" vsizetype="Maximum"> |
635 | 440 |
<horstretch>0</horstretch> |
... | ... | |
649 | 454 |
</size> |
650 | 455 |
</property> |
651 | 456 |
<property name="text"> |
652 |
<string>PushButton</string>
|
|
457 |
<string>취소</string>
|
|
653 | 458 |
</property> |
654 | 459 |
</widget> |
655 | 460 |
</item> |
DTI_PID/DTI_PID/UI/TrainingImageList.ui | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<ui version="4.0"> |
|
3 |
<class>TraingingListDialog</class> |
|
4 |
<widget class="QDialog" name="TraingingListDialog"> |
|
5 |
<property name="geometry"> |
|
6 |
<rect> |
|
7 |
<x>0</x> |
|
8 |
<y>0</y> |
|
9 |
<width>943</width> |
|
10 |
<height>535</height> |
|
11 |
</rect> |
|
12 |
</property> |
|
13 |
<property name="windowTitle"> |
|
14 |
<string>Training List</string> |
|
15 |
</property> |
|
16 |
<layout class="QGridLayout" name="gridLayout"> |
|
17 |
<item row="0" column="0"> |
|
18 |
<layout class="QVBoxLayout" name="verticalLayout"> |
|
19 |
<item> |
|
20 |
<layout class="QHBoxLayout" name="horizontalLayout_2"> |
|
21 |
<item> |
|
22 |
<layout class="QVBoxLayout" name="verticalLayout_3"> |
|
23 |
<item> |
|
24 |
<widget class="QLabel" name="label_2"> |
|
25 |
<property name="text"> |
|
26 |
<string>List</string> |
|
27 |
</property> |
|
28 |
<property name="alignment"> |
|
29 |
<set>Qt::AlignCenter</set> |
|
30 |
</property> |
|
31 |
</widget> |
|
32 |
</item> |
|
33 |
<item> |
|
34 |
<widget class="QTableWidget" name="tableWidgetList"> |
|
35 |
<property name="columnCount"> |
|
36 |
<number>1</number> |
|
37 |
</property> |
|
38 |
<attribute name="verticalHeaderVisible"> |
|
39 |
<bool>false</bool> |
|
40 |
</attribute> |
|
41 |
<column/> |
|
42 |
</widget> |
|
43 |
</item> |
|
44 |
<item> |
|
45 |
<widget class="QPushButton" name="pushButtonAddList"> |
|
46 |
<property name="text"> |
|
47 |
<string>추가</string> |
|
48 |
</property> |
|
49 |
</widget> |
|
50 |
</item> |
|
51 |
<item> |
|
52 |
<widget class="QPushButton" name="pushButtonMakeTrainingData"> |
|
53 |
<property name="text"> |
|
54 |
<string>학습 데이터 생성</string> |
|
55 |
</property> |
|
56 |
</widget> |
|
57 |
</item> |
|
58 |
</layout> |
|
59 |
</item> |
|
60 |
</layout> |
|
61 |
</item> |
|
62 |
<item> |
|
63 |
<layout class="QHBoxLayout" name="horizontalLayout"> |
|
64 |
<item> |
|
65 |
<spacer name="horizontalSpacer"> |
|
66 |
<property name="orientation"> |
|
67 |
<enum>Qt::Horizontal</enum> |
|
68 |
</property> |
|
69 |
<property name="sizeHint" stdset="0"> |
|
70 |
<size> |
|
71 |
<width>40</width> |
|
72 |
<height>20</height> |
|
73 |
</size> |
|
74 |
</property> |
|
75 |
</spacer> |
|
76 |
</item> |
|
77 |
<item> |
|
78 |
<widget class="QPushButton" name="pushButton_2"> |
|
79 |
<property name="text"> |
|
80 |
<string>PushButton</string> |
|
81 |
</property> |
|
82 |
</widget> |
|
83 |
</item> |
|
84 |
<item> |
|
85 |
<widget class="QPushButton" name="pushButton"> |
|
86 |
<property name="text"> |
|
87 |
<string>PushButton</string> |
|
88 |
</property> |
|
89 |
</widget> |
|
90 |
</item> |
|
91 |
</layout> |
|
92 |
</item> |
|
93 |
</layout> |
|
94 |
</item> |
|
95 |
</layout> |
|
96 |
</widget> |
|
97 |
<resources/> |
|
98 |
<connections/> |
|
99 |
</ui> |
내보내기 Unified diff