Skip to content

Instantly share code, notes, and snippets.

@chelseatroy
Created January 11, 2019 05:04
Show Gist options
  • Save chelseatroy/7a418b982caa29fb7fe6df88f91bd422 to your computer and use it in GitHub Desktop.
Save chelseatroy/7a418b982caa29fb7fe6df88f91bd422 to your computer and use it in GitHub Desktop.
Examples for Symmetry
def horizontal_asymmetry(image):
left, right = np.hsplit(image, 2)
right_flipped = np.flip(right, axis=1)
return np.sum(left - right_flipped) ** 2
def vertical_asymmetry(image):
top, bottom = np.vsplit(image, 2)
bottom_flipped = np.flip(bottom, axis=0)
return np.sum(top - bottom_flipped) ** 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment