Created
June 19, 2018 08:22
-
-
Save GenevieveBuckley/39ea07e341d143c6f814f73696f6bfc7 to your computer and use it in GitHub Desktop.
Edge enhancement - sum of the absolute image gradient for all orientations.
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
def gradient_of_image(image): | |
"""Direction agnostic.""" | |
grad = np.gradient(image) # gradients for individual directions | |
grad = np.stack(grad, axis=-1) # from list of arrays to single numpy array | |
gradient_image = np.sum(abs(grad), axis=-1) | |
return gradient_image |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment