# Spatial filtering to image algorithm doesn't work

I’m trying to make spatial filtering algorithm by python with numpy.
The code below works as I predicted. But the output image is not what I want.

```import matplotlib.pyplot as plt
import scipy.misc as misc
import numpy as np

class Image:

def __init__(self, img):
self.img = img

# convolute
def convolution(self, h, w, kernel):
height_length = int(kernel.shape[0]/2)
width_length = int(kernel.shape[1]/2)

target_area = self.img[h-height_length : h+height_length+1, w-width_length : w+width_length+1]
r,g,b = target_area[...,0], target_area[...,1], target_area[...,2]
return (np.sum(r*kernel), np.sum(g*kernel), np.sum(b*kernel))

# stride
def stride(self, kernel):
height_length = int(kernel.shape[0]/2)
width_length = int(kernel.shape[1]/2)
new_img = []
for h in range(height_length, self.img.shape[0]-height_length):
columns = np.empty([0,3], float)
for w in range(width_length, self.img.shape[1]-width_length):
columns = np.vstack([columns, np.asarray([self.convolution(h,w,kernel)])])

new_img.append(columns)

return np.asarray(new_img)

raccoon = misc.face()
img = Image(raccoon)
test = img.stride(np.asarray([[1/9,1/9,1/9],[1/9,1/9,1/9],[1/9,1/9,1/9]]))
plt.imshow(test)
```

The code above shows the following image.

In my prediction, this average filtering kernel just makes the source image blur. But actually it makes just noise.
I just adjust convolution to R, G, B layers.
Is there any wrong point about code or my thinking?
I hope the solution. Thanks.