Skip to content

Commit d1dc044

Browse files
authored
Create blog05-image01.py
1 parent be019c1 commit d1dc044

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

blog05-add/blog05-image01.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#encoding:utf-8
2+
import cv2
3+
import numpy as np
4+
import matplotlib.pyplot as plt
5+
6+
#读取图片
7+
img = cv2.imread('lena-hd.png')
8+
test = img
9+
10+
#方法一:Numpy加法运算
11+
result1 = img + test
12+
13+
#方法二:OpenCV加法运算
14+
result2 = cv2.add(img, test)
15+
16+
#显示图像
17+
cv2.imshow("original", img)
18+
cv2.imshow("result1", result1)
19+
cv2.imshow("result2", result2)
20+
21+
#等待显示
22+
cv2.waitKey(0)
23+
cv2.destroyAllWindows()

0 commit comments

Comments
 (0)