All comparison updates

This commit is contained in:
mmcwilliams 2023-11-10 12:10:20 -05:00
parent 983494a2a1
commit 642d53fb42
2 changed files with 8 additions and 1 deletions

View File

@ -141,6 +141,13 @@ def weighted_euclidean_distance (r1, g1, b1, r2, g2, b2) :
#print(type(r1))
return sqrt( ((r2-r1) * R)**2 + ((g2-g1) * G)**2 + ((b2-b1) * B)**2 )
def to_luma (color, space) :
color = [float(i) for i in list(color)]
if space == 'RGB' :
return rgb_to_luma(color[0], color[1], color[2])
elif space == 'BGR' :
return rgb_to_luma(color[2], color[1], color[0])
def rgb_to_luma (r, g, b) :
R = 0.2126
G = 0.7152

View File

@ -59,7 +59,7 @@ class ComparisonComparison:
else :
closest, dist = closest_color_euclidean(colors, cccompare)
colors = remove_from_list(colors, closest)
colors = remove_from_list(colors, c losest)
ccbgr = convert_color(cc, 'RGB', 'BGR')
chosenbgr = convert_color(closest, space, 'BGR')