Last active
July 27, 2023 20:58
-
-
Save mocquin/5d54b18886d1f9b6e26b08c038d69b99 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
N = 15 | |
kernel = np.ones((N, N))/N**2 | |
fig, axes = plt.subplots(2, 2) | |
p_reflect = PeriodicArray(scipy.ndimage.convolve(img, kernel, mode='reflect')) | |
p_wrap = PeriodicArray(scipy.ndimage.convolve(img, kernel, mode='wrap')) | |
p_nearest = PeriodicArray(scipy.ndimage.convolve(img, kernel, mode='nearest')) | |
p_constant = PeriodicArray(scipy.ndimage.convolve(img, kernel, mode='constant')) | |
p_reflect.plot(axes[0,0]); axes[0,0].set_title("mode='reflect'") | |
p_wrap.plot(axes[0,1]); axes[0,1].set_title("mode='wrap'") | |
p_nearest.plot(axes[1,0]); axes[1,0].set_title("mode='nearest'") | |
p_constant.plot(axes[1,1]); axes[1,1].set_title("mode='constant'") | |
fig.tight_layout() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment