-
Notifications
You must be signed in to change notification settings - Fork 2
/
set2q12.py
39 lines (30 loc) · 1.05 KB
/
set2q12.py
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
35
36
37
38
39
import matplotlib.pyplot as plt
import imageio
from scipy import ndimage
from skimage import feature
import numpy as np
im = imageio.imread('wirebond_mask.tif')
asd=np.array([2,2])
plt.figure(1)
plt.imshow(im,cmap='gray'),plt.title ('Original Image')
#Horizontal Line
sob=([-1,-2,-1],[0,0,0],[1,2,1])
pre=([-1,-1,-1],[0,0,0],[1,1,1])
rob=([-1,0],[0,1])
loag=([0,0,-1,0,0],[0,-1,2,-1,0],[-1,2,16,-2,-1],[0,-1,-2,-1,0],[0,0,-1,0,0])
can=feature.canny(im,sigma=3)
out1=ndimage.filters.convolve(im,sob)
out2=ndimage.filters.convolve(im,pre)
out3=ndimage.filters.convolve(im,rob)
out4=ndimage.filters.convolve(im,loag)
out5=ndimage.filters.convolve(im,can)
plt.figure(2)
plt.imshow((out1),cmap='gray'),plt.title ('Sobel Edge Detection')
plt.figure(3)
plt.imshow((out2),cmap='gray'),plt.title ('Prewitt Edge Detection')
plt.figure(4)
plt.imshow((out3),cmap='gray'),plt.title ('Roberts Edge Detection')
plt.figure(5)
plt.imshow((out4),cmap='gray'),plt.title ('Laplacian of Gaussian Edge Detection')
plt.figure(5)
plt.imshow((out4),cmap='gray'),plt.title ('Canny Edge Detection')