개정판 da9a1532
issue #655: chart at first
DTI_PID/DTI_PID/TrainingImageListDialog.py | ||
---|---|---|
85 | 85 |
|
86 | 86 |
os.environ['TESSDATA_PREFIX'] = os.path.join(os.getenv('ALLUSERSPROFILE'), 'Digital PID', 'Tesseract-OCR', 'tessdata') |
87 | 87 |
|
88 |
appDocData = AppDocData.instance() |
|
89 |
project = appDocData.getCurrentProject() |
|
90 |
dataList = appDocData.getTrainingFileList() |
|
91 |
self.charList = [] |
|
92 |
for charCounts in defaultCharList: |
|
93 |
charCount = [charCounts[0], charCounts[1]] |
|
94 |
self.charList.append(charCount) |
|
95 |
for data in dataList: |
|
96 |
if data.find('.boxS') is not -1: |
|
97 |
boxPath = os.path.join(project.getTrainingFilePath(), data) |
|
98 |
fw = open(boxPath, 'r', encoding='utf8') |
|
99 |
boxContent = fw.read() |
|
100 |
lines = boxContent.split('\n') |
|
101 |
for line in lines: |
|
102 |
if not line: continue |
|
103 |
char,min_x,min_y,max_x,max_y = line.split(' ') |
|
104 |
|
|
105 |
matches = [_char for _char in self.charList if _char[0] == char] |
|
106 |
if matches: |
|
107 |
matches[0][1] = matches[0][1] + 1 |
|
108 |
else: |
|
109 |
self.charList.append([char, 1]) |
|
110 |
fw.close() |
|
111 |
self.makeChart() |
|
112 |
|
|
88 | 113 |
def __del__(self): |
89 | 114 |
# Restore sys.stdout |
90 | 115 |
#sys.stdout = sys.__stdout__ |
... | ... | |
218 | 243 |
cursor.insertText(str(self.process.readAll())) |
219 | 244 |
self.ui.textEditConsole.ensureCursorVisible() |
220 | 245 |
|
221 |
|
|
222 | 246 |
''' |
223 | 247 |
@brief make training data by button click |
224 | 248 |
@author euisung |
... | ... | |
477 | 501 |
chart.legend().setAlignment(Qt.AlignBottom) |
478 | 502 |
|
479 | 503 |
chartView = QChartView(chart) |
504 |
#chartView.setMinimumHeight(500) |
|
480 | 505 |
if self.ui.splitter.replaceWidget(1, chartView) is None: |
481 | 506 |
self.ui.splitter.addWidget(chartView) |
507 |
self.ui.splitter.widget(1).resize(self.ui.splitter.widget(1).width(), 110) |
|
508 |
|
|
509 |
|
|
482 | 510 |
|
483 | 511 |
''' |
484 | 512 |
@brief delete Mid Process File |
내보내기 Unified diff