Here's my code:
from matplotlib.pyplot import imread
import matplotlib.pyplot as plt
from scipy.ndimage.filters import convolve
k3 = np.array([ [-1, -1, -1], [-1, 8, -1], [-1, -1, -1] ])
img = imread("lena.jpg")
channels = []
for channel in range(3):
res = convolve(img[:,:,channel], k3)
channels.append(res)
img = np.dstack((channels[0], channels[1], channels[2]))
plt.imshow(img)
plt.show()
k3 filter suppose to be an edge detection filter. Instead, I'm getting a weird image looks like white noise.
Why?
Here's the output: