Ejemplo n.º 1
0
def peak_chroma_color_scipy():
    """
    Most intensely chromatic color:
    #0000ff
    L 32.310726263632034
    a 0.79175287142984774
    b -1.0784594584851654
    chroma: 1.3378890973099862
    """

    import scipy.optimize
    import math

    guess = (33, 0.7, -0.9)

    def f(x):
        l, a, b = x
        return -lab_chroma(l, a, b)

    l, a, b = scipy.optimize.fmin(f, guess, xtol=1e-5)
    return Color.NewFromLab(l, a, b), lab_chroma(l, a, b)
Ejemplo n.º 2
0
 def f(x):
     l, a, b = x
     return -lab_chroma(l, a, b)