Skip to content

Instantly share code, notes, and snippets.

@harveyslash
Created September 25, 2017 01:07
Show Gist options
  • Save harveyslash/5e8a1c2109573e73cd3cf8740bd092da to your computer and use it in GitHub Desktop.
Save harveyslash/5e8a1c2109573e73cd3cf8740bd092da to your computer and use it in GitHub Desktop.
def calculate_distance(self,ax,ay,bx,by):
patch_a = self.get_patch_for_coords(self.a_padded,ax,ay)
patch_b = self.get_patch_for_coords(self.b_padded,bx,by)
diff = patch_a - patch_b
distances = np.linalg.norm(diff,axis=0,ord=2)
average = np.sum(distances)/(distances.size)
return average
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment