I am using python to create a gaussian filter of size 5x5. I saw this post here where they talk about a similar thing but I didn\'t find the exact way to get equivalent python c
Using Gaussian PDF and assuming space invariant blur
def gaussian_kernel(sigma, size):
mu = np.floor([size / 2, size / 2])
size = int(size)
kernel = np.zeros((size, size))
for i in range(size):
for j in range(size):
kernel[i, j] = np.exp(-(0.5/(sigma*sigma)) * (np.square(i-mu[0]) +
np.square(j-mu[0]))) / np.sqrt(2*math.pi*sigma*sigma)```
kernel = kernel/np.sum(kernel)
return kernel