Skip to content

Instantly share code, notes, and snippets.

@guissalustiano
Last active July 28, 2020 06:46
Show Gist options
  • Select an option

  • Save guissalustiano/a6e2eb02e68b7f48dd6a6075c4dd58d6 to your computer and use it in GitHub Desktop.

Select an option

Save guissalustiano/a6e2eb02e68b7f48dd6a6075c4dd58d6 to your computer and use it in GitHub Desktop.
def gaussian_kernel(size, sigma=1):
center = size//2
x, y = np.mgrid[-center:center+1, -center:center+1]
return np.exp(-((x**2 + y**2) / (2*sigma**2)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment