def Lab_to_LCHab(cobj, *args, **kwargs):
"""
Convert from CIE Lab to LCH(ab).
"""
lch_l = cobj.lab_l
lch_c = math.sqrt(math.pow(float(cobj.lab_a), 2) + math.pow(float(cobj.lab_b), 2))
lch_h = math.atan2(float(cobj.lab_b), float(cobj.lab_a))
if lch_h > 0:
lch_h = (lch_h / math.pi) * 180
else:
lch_h = 360 - (math.fabs(lch_h) / math.pi) * 180
return LCHabColor(
lch_l, lch_c, lch_h, observer=cobj.observer, illuminant=cobj.illuminant)
# noinspection PyPep8Naming,PyUnusedLocal
评论列表
文章目录