Python/Pycharm OPEN-CV Blending

2023. 9. 29. 18:19파이썬/OpenCV

leopard.jpg
0.07MB
wolf.jpg
0.08MB

import cv2
import matplotlib.pyplot as plt

src1 =cv2.imread('./leopard.jpg')
print(src1.shape)
src2 =cv2.imread('./wolf.jpg')
print(src2.shape)

src1=cv2.resize(src1,(640,359))

dst1=src1 + src2
dst2=src1 - src2

img = {'src1':src1,'src2':src2,
       'dst1':dst1,'dst2':dst2}

for i, (k, v) in enumerate(img.items()):
    plt.subplot(2, 2, i+1)
    plt.imshow(v[:, :, ::-1])
    plt.title(k)
plt.show()

dst1 = cv2.add(src1,src2,(50,50,50))
cv2.imshow('img',dst1)

cv2.waitKey()

 

최종 합성(dst1)

728x90