-
Notifications
You must be signed in to change notification settings - Fork 0
/
kernels
29 lines (22 loc) · 673 Bytes
/
kernels
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
import cv2
import matplotlib.pyplot as plt
import numpy as np
def main():
path = "C:\\Users\\edkni\\Downloads\\image_processing_files\\Dataset\\"
imgpath = path + "4.2.07.tiff"
img = cv2.imread(imgpath,1)
img = cv2.cvtColor(img,cv2.COLOR_BGR2RGB)
k = np.array(([0,-1,0],[-1,5,-1],[0,-1,0]),np.float32)
# k = np.array(np.ones((7,7),np.float32))/49
print(k)
print(type(k))
output = cv2.filter2D(img,-1,k)
plt.subplot(1,2,1)
plt.imshow(img)
plt.title('Original Image')
plt.subplot(1,2,2)
plt.imshow(output)
plt.title('Filtered Image')
plt.show()
if __name__ == "__main__":
main()