Created
November 19, 2019 11:45
-
-
Save grasses/2d039588ba382d75423f5b667b247462 to your computer and use it in GitHub Desktop.
High-Pass Filter
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
import numpy as np, scipy | |
def high_pass_filter(image): | |
kernel_5x5 = (1.0/12) * np.array([ | |
[-1, 2, -2, 2, -1], | |
[2, -6, 8, -6, 2], | |
[-2, 8, -12, 8, -2], | |
[2, -6, 8, -6, 2], | |
[-1, 2, -2, 2, -1] | |
], dtype=np.float32) | |
return scipy.ndimage.convolve(image, kernel_5x5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment