개정판 db81d269
issue #655: triple and charlist
DTI_PID/DTI_PID/TrainingImageListDialog.py | ||
---|---|---|
186 | 186 |
drawingPath = os.path.join(project.getTrainingFilePath(), hasBox) |
187 | 187 |
drawing = Image.open(drawingPath) |
188 | 188 |
listHasBoxImage.append(drawing) |
189 |
#listHasBoxImage.append(drawing)
|
|
190 |
#listHasBoxImage.append(drawing)
|
|
189 |
listHasBoxImage.insert(0, drawing)
|
|
190 |
listHasBoxImage.insert(round(len(listHasBoxImage) / 2), drawing)
|
|
191 | 191 |
#listHasBoxImage.append(drawing) |
192 | 192 |
#listHasBoxImage.append(drawing) |
193 | 193 |
boxPath = os.path.join(project.getTrainingFilePath(), data) |
... | ... | |
195 | 195 |
boxContent = fw.read() |
196 | 196 |
fw.close() |
197 | 197 |
listBoxes.append(boxContent) |
198 |
#listBoxes.append(boxContent)
|
|
199 |
#listBoxes.append(boxContent)
|
|
198 |
listBoxes.insert(0, boxContent)
|
|
199 |
listBoxes.insert(round(len(listBoxes) / 2), boxContent)
|
|
200 | 200 |
#listBoxes.append(boxContent) |
201 | 201 |
#listBoxes.append(boxContent) |
202 | 202 |
|
... | ... | |
302 | 302 |
boxes = outBox.split('\n') |
303 | 303 |
boxes = boxes[:-1] |
304 | 304 |
maxBoxWidth, maxBoxHeight = 0, 0 |
305 |
charList = [['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],['a',0]] |
|
305 | 306 |
for box in boxes: |
306 | 307 |
boxComponent = box.split(' ') |
307 | 308 |
boxWidth = abs(int(boxComponent[3]) - int(boxComponent[1])) |
... | ... | |
310 | 311 |
maxBoxWidth = boxWidth |
311 | 312 |
if boxHeight > maxBoxHeight: |
312 | 313 |
maxBoxHeight = boxHeight |
313 |
maxBoxHeight += 2 |
|
314 |
|
|
315 |
for index in range(len(charList)): |
|
316 |
if charList[index][0] == boxComponent[0]: |
|
317 |
charList[index][1] += 1 |
|
318 |
break |
|
319 |
elif index is len(charList) - 1: |
|
320 |
charList.append([boxComponent[0], 1]) |
|
321 |
for index in range(len(charList)): |
|
322 |
charList[index][1] = int(charList[index][1] / 3) |
|
323 |
print(charList) |
|
324 |
maxBoxWidth += 1 |
|
325 |
maxBoxHeight += 3 |
|
314 | 326 |
|
315 | 327 |
countOfOneSide = math.ceil(math.sqrt(len(boxes))) |
316 | 328 |
totalGridWidth = maxBoxWidth * countOfOneSide |
내보내기 Unified diff