728x90
반응형
2장의 이미지 중 1장의 이미지 위에 다른 한장의 이미지를 투명하게 투영시키기
import cv2
import numpy as np
Draw_img = cv2.imread('2.png')
Draw_img2 = np.zeros((Draw_img.shape[0], Draw_img.shape[1], 3), dtype='uint8')
#사각형 그리기
cv2.rectangle(Draw_img2, (300,300), (800,800), (100,255,255), -1)
a = 0.1
Draw_img = cv2.addWeighted(Draw_img2, a, Draw_img, 1, 0)
Draw_img = cv2.resize(Draw_img, (255, 600))
cv2.imshow("test", Draw_img)
cv2.waitKey(0)
a값이 0에 가까울수록 투명해지고 1에 가까울수록 불투명 해짐
참조
728x90
반응형
'Python > Opencv' 카테고리의 다른 글
Python Opencv 이미지 붙이기(cv2.vconcat cv2.hconcat) (0) | 2022.10.27 |
---|
댓글