개정판 99e0f49b
issue #655: box debug
DTI_PID/DTI_PID/Shapes/TrainingBoxItem.py | ||
---|---|---|
94 | 94 |
|
95 | 95 |
self.textShowBox = QGraphicsTextItem(self.char) |
96 | 96 |
self.textShowBox.setDefaultTextColor(Qt.green) |
97 |
self.textShowBox.setPos(self.rect().x() + round(self.rect().width() / 2), self.rect().y() - round(self.rect().height() / 2))
|
|
97 |
self.textShowBox.setPos(self.rect().x() + round(self.rect().width() / 3), self.rect().y() - round(self.rect().height() / 2))
|
|
98 | 98 |
self.textShowBox.setParentItem(self) |
99 | 99 |
|
100 |
self.scene.addItem(self.textShowBox) |
|
100 |
#self.scene.addItem(self.textShowBox)
|
|
101 | 101 |
except Exception as ex: |
102 | 102 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
103 | 103 |
|
DTI_PID/DTI_PID/TrainingEditorDialog.py | ||
---|---|---|
250 | 250 |
if spinBoxName == 'spinBoxLeft': |
251 | 251 |
spinBoxValue = self.ui.spinBoxLeft.value() |
252 | 252 |
items[0].setRect(QRectF(spinBoxValue, rect.y(), rect.width(), rect.height())) |
253 |
items[0].textShowBox.setPos(items[0].rect().x() + round(items[0].rect().width() / 2), items[0].rect().y() - round(items[0].rect().height() / 2))
|
|
253 |
items[0].textShowBox.setPos(items[0].rect().x() + round(items[0].rect().width() / 3), items[0].rect().y() - round(items[0].rect().height() / 2))
|
|
254 | 254 |
elif spinBoxName == 'spinBoxTop': |
255 | 255 |
spinBoxValue = self.ui.spinBoxTop.value() |
256 | 256 |
items[0].setRect(QRectF(rect.x(), spinBoxValue, rect.width(), rect.height())) |
257 |
items[0].textShowBox.setPos(items[0].rect().x() + round(items[0].rect().width() / 2), items[0].rect().y() - round(items[0].rect().height() / 2))
|
|
257 |
items[0].textShowBox.setPos(items[0].rect().x() + round(items[0].rect().width() / 3), items[0].rect().y() - round(items[0].rect().height() / 2))
|
|
258 | 258 |
elif spinBoxName == 'spinBoxWidth': |
259 | 259 |
spinBoxValue = self.ui.spinBoxWidth.value() |
260 | 260 |
items[0].setRect(QRectF(rect.x(), rect.y(), spinBoxValue, rect.height())) |
261 |
items[0].textShowBox.setPos(items[0].rect().x() + round(items[0].rect().width() / 2), items[0].rect().y() - round(items[0].rect().height() / 2))
|
|
261 |
items[0].textShowBox.setPos(items[0].rect().x() + round(items[0].rect().width() / 3), items[0].rect().y() - round(items[0].rect().height() / 2))
|
|
262 | 262 |
elif spinBoxName == 'spinBoxHeight': |
263 | 263 |
spinBoxValue = self.ui.spinBoxHeight.value() |
264 | 264 |
items[0].setRect(QRectF(rect.x(), rect.y(), rect.width(), spinBoxValue)) |
265 |
items[0].textShowBox.setPos(items[0].rect().x() + round(items[0].rect().width() / 2), items[0].rect().y() - round(items[0].rect().height() / 2))
|
|
266 |
|
|
265 |
items[0].textShowBox.setPos(items[0].rect().x() + round(items[0].rect().width() / 3), items[0].rect().y() - round(items[0].rect().height() / 2))
|
|
266 |
|
|
267 | 267 |
rect = items[0].rect() |
268 | 268 |
bound.setRect(rect) |
269 |
rectSide = QRectF(rect.x() -3, rect.y() -3, rect.width() +6, rect.height() +6)
|
|
269 |
rectSide = QRectF(rect.x() - 3, rect.y() - 3, rect.width() + 6, rect.height() + 6)
|
|
270 | 270 |
self.graphicsViewZoomDrawing.fitInView(rectSide) |
271 | 271 |
self.graphicsViewTrainingDrawing.scene.update() |
272 | 272 |
|
DTI_PID/DTI_PID/tesseract_ocr_module.py | ||
---|---|---|
159 | 159 |
|
160 | 160 |
return retImg |
161 | 161 |
|
162 |
|
|
163 | 162 |
''' |
164 | 163 |
@history 2018.06.14 Jeongwoo Add try-except. If exception occured, return None |
165 | 164 |
''' |
... | ... | |
199 | 198 |
|
200 | 199 |
return img |
201 | 200 |
|
202 |
|
|
203 | 201 |
''' |
204 | 202 |
@history 2018.06.14 Jeongwoo Add try-except. If exception occured, return None |
205 | 203 |
''' |
... | ... | |
243 | 241 |
cv2.waitKey(0) |
244 | 242 |
return img |
245 | 243 |
|
246 |
|
|
247 | 244 |
def imageToString(img, conf): |
248 | 245 |
im = Image.fromarray(img) |
249 | 246 |
conf = 'hocr' |
... | ... | |
264 | 261 |
2018.06.20 Jeongwoo Remove variable [lastCharHeight] / Change variable [cey], [ch] / Change method to calculate text line height |
265 | 262 |
2018.10.19 euisung verifing doesn't used |
266 | 263 |
''' |
264 |
''' |
|
267 | 265 |
def getTextInfoInSymbol(img, startPoint, flag = FLAG_IMAGE_TO_BOXES, conf = DEFAULT_CONF): |
268 | 266 |
try: |
269 | 267 |
docData = AppDocData.instance() |
... | ... | |
347 | 345 |
return textInfoList |
348 | 346 |
except Exception as ex: |
349 | 347 |
return None |
350 |
|
|
348 |
''' |
|
351 | 349 |
''' |
352 | 350 |
@brief Get info about each character |
353 | 351 |
@author Jeongwoo |
... | ... | |
356 | 354 |
2018.06.20 Jeongwoo Remove variable [lastCharHeight] / Change variable [cey], [ch] |
357 | 355 |
2018.10.19 euisung verifing doesn't used |
358 | 356 |
''' |
357 |
''' |
|
359 | 358 |
def getCharactersInfo(img, startPoint, flag = FLAG_IMAGE_TO_BOXES, conf = DEFAULT_CONF): |
360 | 359 |
docData = AppDocData.instance() |
361 | 360 |
configs = docData.getConfigs('Text Size', 'Min Text Size') |
... | ... | |
387 | 386 |
textInfoList.append(ti.TextInfo(char, startPoint[0]+csx, startPoint[1]+csy, cw, ch, 0)) |
388 | 387 |
|
389 | 388 |
return textInfoList |
389 |
''' |
내보내기 Unified diff