개정판 f7b7778a
issue #655:1120
DTI_PID/DTI_PID/TrainingImageListDialog.py | ||
---|---|---|
28 | 28 |
|
29 | 29 |
# for reset chart |
30 | 30 |
defaultCharList = [['0',0],['1',0],['2',0],['3',0],['4',0],['5',0],['6',0],['7',0],['8',0],['9',0],['a',0],['b',0],['c',0],['d',0],['e',0],['f',0],['g',0],['h',0],['i',0],['j',0],['k',0],['l',0],['m',0],['n',0],['o',0],['p',0],['q',0],['r',0],['s',0],['t',0],['u',0],['w',0],['x',0],['y',0],['z',0],['A',0],['B',0],['C',0],['D',0],['E',0],['F',0],['G',0],['H',0],['I',0],['J',0],['K',0],['L',0],['M',0],['N',0],['O',0],['P',0],['Q',0],['R',0],['S',0],['T',0],['U',0],['V',0],['W',0],['X',0],['Y',0],['Z',0]] |
31 |
#// for remove noise |
|
32 |
#noisePassList = ['.', '\"', '\'', ',', '`', '-', '+'] |
|
31 | 33 |
|
32 | 34 |
class EmittingStream(QObject): |
33 | 35 |
""" |
... | ... | |
331 | 333 |
""" |
332 | 334 |
x = loc[0] + int((grid_size[0] - box_image.width)*0.5)#space |
333 | 335 |
y = loc[1] + int((grid_size[1] - box_image.height)*0.5)#grid_size[1] - (space + box_image.height) |
336 |
# //remove noise |
|
337 |
''' |
|
338 |
if self.isNoisable(boxes[index][0]): |
|
339 |
image, contours, hierarchy = cv2.findContours(mask, cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE) |
|
340 |
for contour in contours: |
|
341 |
# remove too big one |
|
342 |
[x, y, w, h] = cv2.boundingRect(contour) |
|
343 |
if (w > maxTextSize and h > maxTextSize): continue |
|
344 |
|
|
345 |
area = cv2.contourArea(contour, True) |
|
346 |
if area >= 0: |
|
347 |
cv2.drawContours(contourImg, [contour], -1, (0,0,0), -1) |
|
348 |
cv2.drawContours(contourImg, [contour], -1, (255,255,255), 1) |
|
349 |
else: |
|
350 |
cv2.drawContours(contourImg, [contour], -1, (255,255,255), -1) |
|
351 |
else: |
|
352 |
train_image.paste(box_image, (x, y, x + box_image.width, y + box_image.height)) |
|
353 |
''' |
|
334 | 354 |
train_image.paste(box_image, (x, y, x + box_image.width, y + box_image.height)) |
335 | 355 |
out_boxes.append([boxes[index][0], |
336 | 356 |
str(x - 1), str(train_image.height - y - box_image.height - 1), |
... | ... | |
475 | 495 |
self.deleteMidProcessFile() |
476 | 496 |
os.chdir(originPath) |
477 | 497 |
|
498 |
''' |
|
499 |
def isNoisable(self, char): |
|
500 |
''' |
|
501 |
@brief return True if char need noise reduce process |
|
502 |
@author euisung |
|
503 |
@date 2018.11.20 |
|
504 |
''' |
|
505 |
for passChar in noisePassList: |
|
506 |
if char == passChar: |
|
507 |
return False |
|
508 |
return True |
|
509 |
''' |
|
510 |
|
|
478 | 511 |
def makeChart(self): |
479 | 512 |
''' |
480 | 513 |
@brief make chart for trained charaters |
... | ... | |
506 | 539 |
self.ui.splitter.addWidget(chartView) |
507 | 540 |
self.ui.splitter.widget(1).resize(self.ui.splitter.widget(1).width(), 110) |
508 | 541 |
|
509 |
|
|
510 |
|
|
511 | 542 |
''' |
512 | 543 |
@brief delete Mid Process File |
513 | 544 |
@author euisung |
내보내기 Unified diff