-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblend.py
More file actions
35 lines (24 loc) · 658 Bytes
/
blend.py
File metadata and controls
35 lines (24 loc) · 658 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import cv2
import numpy as np
import matplotlib.pyplot as plt
img1 = cv2.imread('./resources/blending1.jpg')
img2 = cv2.imread('./resources/opencv.jpg')
img3 = img1 + img2
plt.subplot(231).imshow(img1, 'gray')
plt.title('Origin1')
plt.axis('off')
plt.subplot(232).imshow(img2, 'gray')
plt.title('Origin2')
plt.axis('off')
plt.subplot(233).imshow(img3, 'gray')
plt.title('Plus Directly')
plt.axis('off')
img4 = cv2.add(img1, img2)
plt.subplot(234).imshow(img4, 'gray')
plt.title('Cv2 Add')
plt.axis('off')
img5 = cv2.addWeighted(img1, 0.5, img2, 0.5, 0)
plt.subplot(235).imshow(img5, 'gray')
plt.title('Cv2 addWeighted')
plt.axis('off')
plt.show()