개정판 d8a53b03
dev issue #507 : dev opc detect
Change-Id: Ib16a83e63cf85f08e1c7360a13b61c87d27f4fbc
DTI_PID/DTI_PID/RecognitionDialog.py | ||
---|---|---|
914 | 914 |
sh, sow, soh) |
915 | 915 |
|
916 | 916 |
## For OPC |
917 |
worker.detectOPCOnPid() |
|
917 |
if symbolType == "Piping OPC\'s" or symbolType == "Instrument OPC\'s": |
|
918 |
worker.detectOPCOnPid(roiItem, symGray) |
|
918 | 919 |
|
919 | 920 |
## Template Matching |
920 | 921 |
tmRes = cv2.matchTemplate(roiItem, symGray, cv2.TM_CCOEFF_NORMED) |
... | ... | |
1071 | 1072 |
return [] |
1072 | 1073 |
|
1073 | 1074 |
@staticmethod |
1074 |
def detectOPCOnPid(): |
|
1075 |
def detectOPCOnPid(src, symGray): |
|
1076 |
not_src = cv2.bitwise_not(src) |
|
1077 |
symbol = cv2.copyMakeBorder(symGray, 1, 1, 1, 1, cv2.BORDER_CONSTANT, value=255) |
|
1078 |
not_symbol = cv2.bitwise_not(symbol) |
|
1079 |
symbol_contours, symbol_hierachy = cv2.findContours(not_symbol, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) |
|
1080 |
if symbol_hierachy[0][0][0] != -1: |
|
1081 |
return None |
|
1075 | 1082 |
|
1076 | 1083 |
return |
1077 | 1084 |
|
내보내기 Unified diff