1577 |
1577 |
symGray = cv2.flip(symGray, 1)
|
1578 |
1578 |
|
1579 |
1579 |
symbolRotatedAngle = 0
|
|
1580 |
#for rc in range((symbolRotateCount + 1) * 2): # Rotation count를 사용자 기준으로 받아서 1을 더한 후 사용
|
1580 |
1581 |
for rc in range(symbolRotateCount + 1): # Rotation count를 사용자 기준으로 받아서 1을 더한 후 사용
|
1581 |
1582 |
sw, sh = symGray.shape[::-1]
|
1582 |
1583 |
roiw = (roiItemEp[0] - roiItemSp[0])
|
1583 |
1584 |
roih = (roiItemEp[1] - roiItemSp[1])
|
1584 |
1585 |
|
|
1586 |
# get Rotated Original Point
|
|
1587 |
originalPoint = Worker.getCalculatedOriginalPoint(additionalSymbol, symbolOriginalPoint,
|
|
1588 |
symbolRotatedAngle, sw, sh, sow, soh, flipped)
|
|
1589 |
connectionPoint = Worker.getCalculatedConnectionPoint(symbolConnectionPoint, symbolRotatedAngle, sw,
|
|
1590 |
sh, sow, soh, flipped)
|
|
1591 |
|
1585 |
1592 |
# Case : symbol is bigger than roi
|
1586 |
1593 |
if roiw < sw or roih < sh:
|
1587 |
1594 |
symGray = cv2.rotate(symGray, cv2.ROTATE_90_CLOCKWISE)
|
1588 |
1595 |
symbolRotatedAngle = (symbolRotatedAngle + 90) % 360
|
|
1596 |
#cX, cY = originalPoint[0], originalPoint[0]
|
|
1597 |
#M = cv2.getRotationMatrix2D((cX, cY), 45, 1.0)
|
|
1598 |
#symGray = cv2.warpAffine(symGray, M, (sw, sh))
|
|
1599 |
#symbolRotatedAngle = (symbolRotatedAngle + 45) % 360
|
1589 |
1600 |
|
1590 |
1601 |
if baseSymbol is not None and additionalSymbol is not None:
|
1591 |
1602 |
additionalSymbol = Worker.getRotatedChildInfo(additionalSymbol)
|
1592 |
1603 |
continue
|
1593 |
1604 |
|
1594 |
|
# get Rotated Original Point
|
1595 |
|
originalPoint = Worker.getCalculatedOriginalPoint(additionalSymbol, symbolOriginalPoint,
|
1596 |
|
symbolRotatedAngle, sw, sh, sow, soh, flipped)
|
1597 |
|
connectionPoint = Worker.getCalculatedConnectionPoint(symbolConnectionPoint, symbolRotatedAngle, sw,
|
1598 |
|
sh, sow, soh, flipped)
|
1599 |
|
|
1600 |
1605 |
# For OPC
|
1601 |
1606 |
drawing_area = app_doc_data.getArea('Drawing')
|
1602 |
1607 |
if drawing_area is not None and (symbolType == "Piping OPC\'s" or symbolType == "Instrument OPC\'s"):
|
... | ... | |
1777 |
1782 |
# rotate symbol
|
1778 |
1783 |
symGray = cv2.rotate(symGray, cv2.ROTATE_90_CLOCKWISE)
|
1779 |
1784 |
symbolRotatedAngle = (symbolRotatedAngle + 90) % 360
|
|
1785 |
#cX, cY = originalPoint[0], originalPoint[0]
|
|
1786 |
#M = cv2.getRotationMatrix2D((cX, cY), 45, 1.0)
|
|
1787 |
#symGray = cv2.warpAffine(symGray, M, (sw, sh))
|
|
1788 |
#symbolRotatedAngle = (symbolRotatedAngle + 45) % 360
|
1780 |
1789 |
|
1781 |
1790 |
if additionalSymbol is not None:
|
1782 |
1791 |
additionalSymbol = Worker.getRotatedChildInfo(additionalSymbol)
|
... | ... | |
1924 |
1933 |
# 검은색 점을 찾는 범위
|
1925 |
1934 |
search_length = 10
|
1926 |
1935 |
# Line 최소 Length
|
1927 |
|
checkLineLength = 20;
|
|
1936 |
checkLineLength = 20
|
1928 |
1937 |
# Line 최대 Width
|
1929 |
|
line_width = 8;
|
|
1938 |
line_width = 18
|
1930 |
1939 |
# flange min length
|
1931 |
1940 |
flange_min = 30
|
1932 |
1941 |
# flange max length
|
1933 |
1942 |
flange_max = 50
|
1934 |
1943 |
# 임시
|
1935 |
|
temp_count = 0;
|
|
1944 |
temp_count = 0
|
1936 |
1945 |
find_list_x = []
|
1937 |
1946 |
find_list_y = []
|
1938 |
1947 |
for i in loopRange:
|
... | ... | |
2045 |
2054 |
c_x, c_y, c_w, c_h = cv2.boundingRect(contour)
|
2046 |
2055 |
area = cv2.contourArea(contour)
|
2047 |
2056 |
if c_x <= x and c_x + c_w >= x and c_y <= y and c_y + c_h >= y:
|
2048 |
|
if flange_count * flange_max >= area:
|
|
2057 |
if flange_count * flange_max * 2 >= area:
|
2049 |
2058 |
#not_image[y, x] = 0
|
2050 |
2059 |
#from PIL import Image
|
2051 |
2060 |
#Image.fromarray(not_image).show()
|
... | ... | |
2430 |
2439 |
symGray = cv2.flip(symGray, 1)
|
2431 |
2440 |
|
2432 |
2441 |
symbolRotatedAngle = 0
|
|
2442 |
#for rc in range((symbolRotateCount + 1) * 2):
|
2433 |
2443 |
for rc in range(symbolRotateCount + 1):
|
2434 |
2444 |
sw, sh = symGray.shape[::-1]
|
2435 |
2445 |
|
... | ... | |
2442 |
2452 |
if r_w < sw or r_h < sh:
|
2443 |
2453 |
symGray = cv2.rotate(symGray, cv2.ROTATE_90_CLOCKWISE)
|
2444 |
2454 |
symbolRotatedAngle = (symbolRotatedAngle + 90) % 360
|
|
2455 |
#cX, cY = originalPoint[0], originalPoint[0]
|
|
2456 |
#M = cv2.getRotationMatrix2D((cX, cY), 45, 1.0)
|
|
2457 |
#symGray = cv2.warpAffine(symGray, M, (sw, sh))
|
|
2458 |
#symbolRotatedAngle = (symbolRotatedAngle + 45) % 360
|
2445 |
2459 |
continue
|
2446 |
2460 |
|
2447 |
2461 |
tmRes = cv2.matchTemplate(roiItem, symGray, cv2.TM_CCOEFF_NORMED)
|
... | ... | |
2455 |
2469 |
|
2456 |
2470 |
symGray = cv2.rotate(symGray, cv2.ROTATE_90_CLOCKWISE)
|
2457 |
2471 |
symbolRotatedAngle = (symbolRotatedAngle + 90) % 360
|
|
2472 |
#cX, cY = originalPoint[0], originalPoint[0]
|
|
2473 |
#M = cv2.getRotationMatrix2D((cX, cY), 45, 1.0)
|
|
2474 |
#symGray = cv2.warpAffine(symGray, M, (sw, sh))
|
|
2475 |
#symbolRotatedAngle = (symbolRotatedAngle + 45) % 360
|
2458 |
2476 |
|
2459 |
2477 |
if searchedInfos:
|
2460 |
2478 |
searchedInfos = sorted(searchedInfos, key=lambda param: param[0], reverse=True)
|