Skip to content

Commit d5cfb02

Browse files
authored
Add files via upload
1 parent 6e6a187 commit d5cfb02

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# -*- coding: utf-8 -*-
2+
#By:Eastmount CSDN 2020-12-22
3+
import cv2
4+
import numpy as np
5+
6+
#读取原始图像
7+
src = cv2.imread('scenery.png')
8+
9+
#图像灰度处理
10+
gray = cv2.cvtColor(src,cv2.COLOR_BGR2GRAY)
11+
12+
#自定义卷积核
13+
kernel = np.array([[-1,-1,-1],[-1,10,-1],[-1,-1,-1]])
14+
#kernel = np.array([[0,-1,0],[-1,5,-1],[0,-1,0]])
15+
16+
#图像浮雕效果
17+
output = cv2.filter2D(gray, -1, kernel)
18+
19+
#显示图像
20+
cv2.imshow('Original Image', src)
21+
cv2.imshow('Emboss_1',output)
22+
23+
#等待显示
24+
cv2.waitKey()
25+
cv2.destroyAllWindows()

0 commit comments

Comments
 (0)