simplify euclidian distance formula

This commit is contained in:
Gordon Shumway 2019-06-28 21:03:37 -04:00 committed by GitHub
parent df30ddcdb8
commit d79856abec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 3 deletions

View File

@ -542,9 +542,7 @@ class ASCII(callbacks.Plugin):
def distance(self, c1, c2, speed):
if speed == 'fast':
(r1,g1,b1) = (c1[0], c1[1], c1[2])
(r2,g2,b2) = (c2[0], c2[1], c2[2])
delta_e = math.sqrt((r1 - r2)**2 + (g1 - g2) ** 2 + (b1 - b2) **2)
delta_e = math.sqrt((c1[0] - c2[0]) **2 + (c1[1] - c2[1]) ** 2 + (c1[2] - c2[2]) **2)
elif speed == 'slow':
delta_e = self.ciede2000(c1, c2)
return delta_e