Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@GenevieveBuckley
Created June 19, 2018 08:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GenevieveBuckley/39ea07e341d143c6f814f73696f6bfc7 to your computer and use it in GitHub Desktop.
Save GenevieveBuckley/39ea07e341d143c6f814f73696f6bfc7 to your computer and use it in GitHub Desktop.
Edge enhancement - sum of the absolute image gradient for all orientations.
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