개정판 81d7b9b1
issue #663: line type test
Change-Id: I2ce3adfd18d8ddb20c991ca1ebe5ad0e5b14fc8d
DTI_PID/DTI_PID/RecognitionDialog.py | ||
---|---|---|
1276 | 1276 |
worker.displayLog.emit(MessageType.Error, message) |
1277 | 1277 |
# up to here |
1278 | 1278 |
|
1279 |
|
|
1280 | 1279 |
# detect flange |
1281 | 1280 |
try: |
1282 | 1281 |
for sym in symbols: |
... | ... | |
1317 | 1316 |
|
1318 | 1317 |
# change line type using visual pattern |
1319 | 1318 |
try: |
1320 |
Worker.changeVisualLineType(app_doc_data.lines, worker) |
|
1321 |
#pass |
|
1319 |
lines = [] |
|
1320 |
for sym in symbols: |
|
1321 |
if sym.conn_type: |
|
1322 |
for index in range(len(sym.conn_type)): |
|
1323 |
if sym.conn_type[index] != 'Secondary' and sym.conn_type[index] != 'Primary': |
|
1324 |
item = sym.connectors[index].connectedItem |
|
1325 |
if item and type(item) is QEngineeringLineItem: |
|
1326 |
if item in lines: |
|
1327 |
continue |
|
1328 |
else: |
|
1329 |
run = [item] |
|
1330 |
Worker.find_connected_line(run, item) |
|
1331 |
lines.extend(run) |
|
1332 |
|
|
1333 |
Worker.changeVisualLineType(lines, worker) |
|
1322 | 1334 |
|
1323 | 1335 |
except Exception as ex: |
1324 | 1336 |
message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \ |
... | ... | |
1413 | 1425 |
# detemine line type : broken |
1414 | 1426 |
for line in lines: |
1415 | 1427 |
rect = line.boundingRect() |
1416 |
image_line = image[round(rect.y() - 3):round(rect.y() + rect.height() + 3), round(rect.x() - 3):round(rect.x() + rect.width() + 3)]
|
|
1428 |
image_line = image[round(rect.y() - 1):round(rect.y() + rect.height() + 1), round(rect.x() - 1):round(rect.x() + rect.width() + 1)]
|
|
1417 | 1429 |
contours, _ = cv2.findContours(image_line, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) |
1418 | 1430 |
|
1419 | 1431 |
# skip piping line |
내보내기 Unified diff