Skip to content
This repository has been archived by the owner on Dec 12, 2023. It is now read-only.

Update color_diff.py #61

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion colormath/color_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,33 @@ def delta_e_cie1994(color1, color2, K_L=1, K_C=1, K_H=1, K_1=0.045, K_2=0.015):
color1_vector, color2_matrix, K_L=K_L, K_C=K_C, K_H=K_H, K_1=K_1, K_2=K_2)[0]
return numpy.asscalar(delta_e)


# noinspection PyPep8Naming
def delta_e_cie2000(color1, color2, Kl=1, Kc=1, Kh=1):
"""
Calculates the Delta E (CIE2000) of two colors.
"""
from warnings import warn
warn("The current form of this class being depreciated in favor of not passing in arguments for Kl, Kc, and Kh when unity 1 is used. For applications wishing to retain the ability to change Kl, Kc, and/or Kh from default value of 1 see delta_e_cie_2000_nonunity. In a future release, the updated format as seen in delta_e_cie2000_update will be used")
color1_vector = _get_lab_color1_vector(color1)
color2_matrix = _get_lab_color2_matrix(color2)
delta_e = color_diff_matrix.delta_e_cie2000(
color1_vector, color2_matrix, Kl=Kl, Kc=Kc, Kh=Kh)[0]
return numpy.asscalar(delta_e)

def delta_e_cie2000_update (color1, color2):
"""
Calculates the Delta E (CIE2000) of two colors.
"""
color1_vector = _get_lab_color1_vector(color1)
color2_matrix = _get_lab_color2_matrix(color2)
delta_e = color_diff_matrix.delta_e_cie2000(
color1_vector, color2_matrix, Kl=1, Kc=1, Kh=1)[0]
return numpy.asscalar(delta_e)
# noinspection PyPep8Naming
def delta_e_cie2000_nonunity(color1, color2, Kl, Kc, Kh):
"""
Calculates the Delta E (CIE2000) of two colors.
"""

color1_vector = _get_lab_color1_vector(color1)
color2_matrix = _get_lab_color2_matrix(color2)
Expand Down