mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
14 lines
261 B
Python
14 lines
261 B
Python
import math
|
|
|
|
def manhattan(a, b):
|
|
s = 0
|
|
for i in range(0, min(len(a), len(b))):
|
|
s += abs(a[i] - b[i])
|
|
return s
|
|
|
|
def euclidean(a, b):
|
|
s = 0
|
|
for i in range(0, min(len(a), len(b))):
|
|
s += (a[i] - b[i])**2
|
|
return math.sqrt(s)
|