Module Expr Str ImportFrom alias Import alias identifier ImportFrom alias alias FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign TupleStore NameStore NameStore NameStore SubscriptLoad Call AttributeLoad NameLoad attr NameLoad Num Slice Num Assign TupleStore NameStore NameStore NameStore SubscriptLoad Call AttributeLoad NameLoad attr NameLoad Num Slice Num Return Call AttributeLoad NameLoad attr BinOpAdd BinOpAdd BinOpPow BinOpSub NameLoad NameLoad Num BinOpPow BinOpSub NameLoad NameLoad Num BinOpPow BinOpSub NameLoad NameLoad Num decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults Num Num Num Num Num body Expr Str Assign TupleStore NameStore NameStore SubscriptLoad Call AttributeLoad NameLoad attr Call NameLoad NameLoad Num Slice Num Assign TupleStore NameStore NameStore SubscriptLoad Call AttributeLoad NameLoad attr Call NameLoad NameLoad Num Slice Num Assign NameStore BinOpSub NameLoad NameLoad Assign NameStore BinOpSub NameLoad NameLoad Assign NameStore Call NameLoad NameLoad NameLoad Assign NameStore Num Assign NameStore BinOpAdd Num BinOpMult NameLoad NameLoad Assign NameStore BinOpAdd Num BinOpMult NameLoad NameLoad Assign NameStore BinOpPow BinOpDiv NameLoad BinOpMult NameLoad NameLoad Num AugAssignAdd NameStore BinOpPow BinOpDiv NameLoad BinOpMult NameLoad NameLoad Num AugAssignAdd NameStore BinOpDiv NameLoad BinOpPow BinOpMult NameLoad NameLoad Num Return Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults Num Num Num body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore NameLoad If BoolOpAnd CompareEq AttributeLoad NameLoad attr Num CompareEq AttributeLoad NameLoad attr Num body Assign NameStore NameLoad If CompareEq AttributeLoad NameLoad attr Num body Assign NameStore SubscriptLoad NameLoad ExtSlice Index NameLoad Slice If CompareEq AttributeLoad NameLoad attr Num body Assign NameStore SubscriptLoad NameLoad ExtSlice Index NameLoad Slice Assign TupleStore NameStore NameStore NameStore SubscriptLoad Call AttributeLoad NameLoad attr NameLoad Num Slice Num Assign TupleStore NameStore NameStore NameStore SubscriptLoad Call AttributeLoad NameLoad attr NameLoad Num Slice Num Assign NameStore BinOpMult Num BinOpAdd Call AttributeLoad NameLoad attr NameLoad NameLoad Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore BinOpPow NameLoad Num Assign NameStore BinOpMult Num BinOpSub Num Call AttributeLoad NameLoad attr BinOpDiv NameLoad BinOpAdd NameLoad BinOpPow Num Num Assign NameStore BinOpAdd Num NameLoad Assign TupleStore NameStore NameStore Call NameLoad BinOpMult NameLoad NameLoad NameLoad Assign TupleStore NameStore NameStore Call NameLoad BinOpMult NameLoad NameLoad NameLoad Assign NameStore BinOpMult Num BinOpAdd NameLoad NameLoad Assign NameStore BinOpPow BinOpSub NameLoad Num Num Assign NameStore BinOpAdd Num BinOpDiv BinOpMult Num NameLoad Call AttributeLoad NameLoad attr BinOpAdd Num NameLoad Assign NameStore BinOpDiv BinOpSub NameLoad NameLoad BinOpMult NameLoad NameLoad Assign NameStore BinOpMult Num BinOpAdd NameLoad NameLoad Assign NameStore BinOpAdd Num BinOpMult Num NameLoad Assign NameStore BinOpDiv BinOpSub NameLoad NameLoad BinOpMult NameLoad NameLoad Assign NameStore BinOpSub NameLoad NameLoad Assign NameStore BinOpAdd NameLoad NameLoad Assign NameStore BinOpMult NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr AugAssignSub SubscriptStore NameLoad Index CompareGt NameLoad AttributeLoad NameLoad attr BinOpMult Num AttributeLoad NameLoad attr AugAssignAdd SubscriptStore NameLoad Index CompareLt NameLoad UnaryOpUSub AttributeLoad NameLoad attr BinOpMult Num AttributeLoad NameLoad attr Assign SubscriptStore NameLoad Index CompareEq NameLoad Num Num Assign NameStore BinOpMult BinOpMult Num Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr BinOpDiv NameLoad Num Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr CompareNotEq NameLoad Num CompareGt Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr AugAssignAdd SubscriptStore NameLoad Index BinOpMult NameLoad CompareLt NameLoad BinOpMult Num AttributeLoad NameLoad attr BinOpMult Num AttributeLoad NameLoad attr AugAssignSub SubscriptStore NameLoad Index BinOpMult NameLoad CompareGtE NameLoad BinOpMult Num AttributeLoad NameLoad attr BinOpMult Num AttributeLoad NameLoad attr AugAssignMult SubscriptStore NameLoad Index CompareEq NameLoad Num Num AugAssignMult NameStore Num Assign NameStore BinOpSub BinOpAdd BinOpAdd BinOpSub Num BinOpMult Num Call AttributeLoad NameLoad attr BinOpSub NameLoad Call AttributeLoad NameLoad attr Num BinOpMult Num Call AttributeLoad NameLoad attr BinOpMult Num NameLoad BinOpMult Num Call AttributeLoad NameLoad attr BinOpAdd BinOpMult Num NameLoad Call AttributeLoad NameLoad attr Num BinOpMult Num Call AttributeLoad NameLoad attr BinOpSub BinOpMult Num NameLoad Call AttributeLoad NameLoad attr Num Assign NameStore BinOpAdd Num BinOpMult BinOpMult Num NameLoad NameLoad Assign NameStore BinOpDiv NameLoad BinOpMult NameLoad NameLoad Assign NameStore BinOpPow NameLoad Num Assign NameStore BinOpMult Num Call AttributeLoad NameLoad attr BinOpDiv NameLoad BinOpAdd NameLoad BinOpPow Num Num Assign NameStore BinOpMult Call AttributeLoad NameLoad attr Num Call AttributeLoad NameLoad attr UnaryOpUSub BinOpPow BinOpDiv BinOpSub Call AttributeLoad NameLoad attr NameLoad Num Num Num Assign NameStore BinOpMult BinOpMult BinOpMult UnaryOpUSub Call AttributeLoad NameLoad attr BinOpMult Num NameLoad NameLoad NameLoad NameLoad Assign NameStore BinOpPow NameLoad Num AugAssignAdd NameStore BinOpPow NameLoad Num AugAssignAdd NameStore BinOpPow NameLoad Num AugAssignAdd NameStore NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad If NameLoad body Assign NameStore SubscriptLoad NameLoad Index Num Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults Num Num body Expr Str Assign TupleStore NameStore NameStore NameStore SubscriptLoad Call AttributeLoad NameLoad attr Call NameLoad NameLoad Num Slice Num Assign TupleStore NameStore NameStore NameStore SubscriptLoad Call AttributeLoad NameLoad attr Call NameLoad NameLoad Num Slice Num Assign NameStore BinOpSub NameLoad NameLoad Assign NameStore BinOpSub NameLoad NameLoad Assign NameStore Call NameLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr CompareGtE Call AttributeLoad NameLoad attr NameLoad Num CompareLtE Call AttributeLoad NameLoad attr NameLoad Num BinOpAdd Num BinOpMult Num Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr BinOpAdd NameLoad Call AttributeLoad NameLoad attr Num BinOpAdd Num BinOpMult Num Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr BinOpAdd NameLoad Call AttributeLoad NameLoad attr Num Assign NameStore BinOpPow NameLoad Num Assign NameStore Call AttributeLoad NameLoad attr BinOpDiv NameLoad BinOpAdd NameLoad Num Assign NameStore Call AttributeLoad NameLoad attr CompareLt NameLoad Num Num BinOpDiv BinOpMult Num NameLoad BinOpAdd Num BinOpMult Num NameLoad Assign NameStore BinOpAdd Num BinOpDiv BinOpMult Num NameLoad BinOpAdd Num BinOpMult Num NameLoad Assign NameStore BinOpMult NameLoad BinOpSub BinOpAdd BinOpMult NameLoad NameLoad Num NameLoad Assign NameStore BinOpPow BinOpDiv NameLoad BinOpMult NameLoad NameLoad Num AugAssignAdd NameStore BinOpPow BinOpDiv NameLoad BinOpMult NameLoad NameLoad Num AugAssignAdd NameStore BinOpDiv NameLoad BinOpPow NameLoad Num Return Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign TupleStore NameStore NameStore SubscriptLoad Call AttributeLoad NameLoad attr NameLoad Num Slice Num Num Assign TupleStore NameStore NameStore SubscriptLoad Call AttributeLoad NameLoad attr NameLoad Num Slice Num Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore BinOpSub BinOpMult NameLoad NameLoad BinOpAdd BinOpMult NameLoad NameLoad BinOpMult NameLoad NameLoad Return BinOpMult Num NameLoad decorator_list
N/A N/A 
Functions for calculating the "distance" between colors.

Implicit in these definitions of "distance" is the notion of "Just Noticeable
Distance" (JND).  This represents the distance between colors where a human can
perceive different colors.  Humans are more sensitive to certain colors than
others, which different deltaE metrics correct for with varying degrees of
sophistication.

The literature often mentions 1 as the minimum distance for visual
differentiation, but more recent studies (Mahy 1994) peg JND at 2.3

The delta-E notation comes from the German word for "Sensation" (Empfindung).

Reference
---------
http://en.wikipedia.org/wiki/Color_difference

 __future__ division N/A numpy np color.colorconv lab2lch _cart2polar_2pi deltaE_cie76 N/A N/A lab1 lab2 N/A N/A N/A Euclidean distance between two points in Lab color space

    Parameters
    ----------
    lab1 : array_like
        reference color (Lab colorspace)
    lab2 : array_like
        comparison color (Lab colorspace)

    Returns
    -------
    dE : array_like
        distance between colors `lab1` and `lab2`

    References
    ----------
    .. [1] http://en.wikipedia.org/wiki/Color_difference
    .. [2] A. R. Robertson, "The CIE 1976 color-difference formulae,"
           Color Res. Appl. 2, 7-11 (1977).
     N/A lab1 N/A N/A np asarray lab1 N/A lab2 N/A N/A np asarray lab2 N/A N/A L1 a1 b1 N/A N/A N/A np rollaxis lab1 -1 N/A 3 N/A N/A L2 a2 b2 N/A N/A N/A np rollaxis lab2 -1 N/A 3 N/A N/A N/A np sqrt N/A N/A N/A N/A L2 L1 2 N/A N/A a2 a1 2 N/A N/A b2 b1 2 N/A deltaE_ciede94 N/A N/A lab1 lab2 kH kC kL k1 k2 N/A 1 1 1 0.045 0.015 N/A N/A Color difference according to CIEDE 94 standard

    Accommodates perceptual non-uniformities through the use of application
    specific scale factors (`kH`, `kC`, `kL`, `k1`, and `k2`).

    Parameters
    ----------
    lab1 : array_like
        reference color (Lab colorspace)
    lab2 : array_like
        comparison color (Lab colorspace)
    kH : float, optional
        Hue scale
    kC : float, optional
        Chroma scale
    kL : float, optional
        Lightness scale
    k1 : float, optional
        first scale parameter
    k2 : float, optional
        second scale parameter

    Returns
    -------
    dE : array_like
        color difference between `lab1` and `lab2`

    Notes
    -----
    deltaE_ciede94 is not symmetric with respect to lab1 and lab2.  CIEDE94
    defines the scales for the lightness, hue, and chroma in terms of the first
    color.  Consequently, the first color should be regarded as the "reference"
    color.

    `kL`, `k1`, `k2` depend on the application and default to the values
    suggested for graphic arts

    ==========  ==============  ==========
    Parameter    Graphic Arts    Textiles
    ==========  ==============  ==========
    `kL`         1.000           2.000
    `k1`         0.045           0.048
    `k2`         0.015           0.014
    ==========  ==============  ==========

    References
    ----------
    .. [1] http://en.wikipedia.org/wiki/Color_difference
    .. [2] http://www.brucelindbloom.com/index.html?Eqn_DeltaE_CIE94.html
     N/A N/A L1 C1 N/A N/A N/A np rollaxis N/A lab2lch lab1 -1 N/A 2 N/A N/A L2 C2 N/A N/A N/A np rollaxis N/A lab2lch lab2 -1 N/A 2 N/A dL N/A L1 L2 N/A dC N/A C1 C2 N/A dH2 N/A get_dH2 lab1 lab2 N/A SL 1 N/A SC N/A 1 N/A k1 C1 N/A SH N/A 1 N/A k2 C1 N/A dE2 N/A N/A dL N/A kL SL 2 N/A dE2 N/A N/A dC N/A kC SC 2 N/A dE2 N/A dH2 N/A N/A kH SH 2 N/A N/A N/A np sqrt dE2 N/A deltaE_ciede2000 N/A N/A lab1 lab2 kL kC kH N/A 1 1 1 N/A N/A Color difference as given by the CIEDE 2000 standard.

    CIEDE 2000 is a major revision of CIDE94.  The perceptual calibration is
    largely based on experience with automotive paint on smooth surfaces.

    Parameters
    ----------
    lab1 : array_like
        reference color (Lab colorspace)
    lab2 : array_like
        comparison color (Lab colorspace)
    kL : float (range), optional
        lightness scale factor, 1 for "acceptably close"; 2 for "imperceptible"
        see deltaE_cmc
    kC : float (range), optional
        chroma scale factor, usually 1
    kH : float (range), optional
        hue scale factor, usually 1

    Returns
    -------
    deltaE : array_like
        The distance between `lab1` and `lab2`

    Notes
    -----
    CIEDE 2000 assumes parametric weighting factors for the lightness, chroma,
    and hue (`kL`, `kC`, `kH` respectively).  These default to 1.

    References
    ----------
    .. [1] http://en.wikipedia.org/wiki/Color_difference
    .. [2] http://www.ece.rochester.edu/~gsharma/ciede2000/ciede2000noteCRNA.pdf
           (doi:10.1364/AO.33.008069)
    .. [3] M. Melgosa, J. Quesada, and E. Hita, "Uniformity of some recent
           color metrics tested with an accurate color-difference tolerance
           dataset," Appl. Opt. 33, 8069-8077 (1994).
     N/A lab1 N/A N/A np asarray lab1 N/A lab2 N/A N/A np asarray lab2 N/A unroll False N/A N/A N/A N/A lab1 ndim 1 N/A N/A lab2 ndim 1 N/A N/A unroll True N/A N/A N/A lab1 ndim 1 N/A N/A lab1 N/A lab1 N/A N/A None N/A N/A N/A N/A lab2 ndim 1 N/A N/A lab2 N/A lab2 N/A N/A None N/A N/A N/A L1 a1 b1 N/A N/A N/A np rollaxis lab1 -1 N/A 3 N/A N/A L2 a2 b2 N/A N/A N/A np rollaxis lab2 -1 N/A 3 N/A Cbar N/A 0.5 N/A N/A N/A np hypot a1 b1 N/A N/A np hypot a2 b2 N/A c7 N/A Cbar 7 N/A G N/A 0.5 N/A 1 N/A N/A np sqrt N/A c7 N/A c7 N/A 25 7 N/A scale N/A 1 G N/A N/A C1 h1 N/A _cart2polar_2pi N/A a1 scale b1 N/A N/A C2 h2 N/A _cart2polar_2pi N/A a2 scale b2 N/A Lbar N/A 0.5 N/A L1 L2 N/A tmp N/A N/A Lbar 50 2 N/A SL N/A 1 N/A N/A 0.015 tmp N/A N/A np sqrt N/A 20 tmp N/A L_term N/A N/A L2 L1 N/A kL SL N/A Cbar N/A 0.5 N/A C1 C2 N/A SC N/A 1 N/A 0.045 Cbar N/A C_term N/A N/A C2 C1 N/A kC SC N/A h_diff N/A h2 h1 N/A h_sum N/A h1 h2 N/A CC N/A C1 C2 N/A dH N/A N/A h_diff copy N/A N/A dH N/A N/A h_diff N/A np pi N/A 2 N/A np pi N/A N/A dH N/A N/A h_diff N/A N/A np pi N/A 2 N/A np pi N/A N/A dH N/A N/A CC 0.0 0.0 N/A dH_term N/A N/A 2 N/A N/A np sqrt CC N/A N/A np sin N/A dH 2 N/A Hbar N/A N/A h_sum copy N/A mask N/A N/A np logical_and N/A CC 0.0 N/A N/A N/A np abs h_diff N/A np pi N/A N/A Hbar N/A N/A mask N/A h_sum N/A 2 N/A np pi N/A 2 N/A np pi N/A N/A Hbar N/A N/A mask N/A h_sum N/A 2 N/A np pi N/A 2 N/A np pi N/A N/A Hbar N/A N/A CC 0.0 2 N/A Hbar 0.5 N/A T N/A N/A N/A N/A 1 N/A 0.17 N/A N/A np cos N/A Hbar N/A N/A np deg2rad 30 N/A 0.24 N/A N/A np cos N/A 2 Hbar N/A 0.32 N/A N/A np cos N/A N/A 3 Hbar N/A N/A np deg2rad 6 N/A 0.2 N/A N/A np cos N/A N/A 4 Hbar N/A N/A np deg2rad 63 N/A SH N/A 1 N/A N/A 0.015 Cbar T N/A H_term N/A dH_term N/A kH SH N/A c7 N/A Cbar 7 N/A Rc N/A 2 N/A N/A np sqrt N/A c7 N/A c7 N/A 25 7 N/A dtheta N/A N/A N/A np deg2rad 30 N/A N/A np exp N/A N/A N/A N/A N/A N/A np rad2deg Hbar 275 25 2 N/A R_term N/A N/A N/A N/A N/A N/A np sin N/A 2 dtheta Rc C_term H_term N/A dE2 N/A L_term 2 N/A dE2 N/A C_term 2 N/A dE2 N/A H_term 2 N/A dE2 R_term N/A ans N/A N/A np sqrt dE2 N/A unroll N/A N/A ans N/A ans N/A 0 N/A ans N/A deltaE_cmc N/A N/A lab1 lab2 kL kC N/A 1 1 N/A N/A Color difference from the  CMC l:c standard.

    This color difference was developed by the Colour Measurement Committee
    (CMC) of the Society of Dyers and Colourists (United Kingdom). It is
    intended for use in the textile industry.

    The scale factors `kL`, `kC` set the weight given to differences in
    lightness and chroma relative to differences in hue.  The usual values are
    ``kL=2``, ``kC=1`` for "acceptability" and ``kL=1``, ``kC=1`` for
    "imperceptibility".  Colors with ``dE > 1`` are "different" for the given
    scale factors.

    Parameters
    ----------
    lab1 : array_like
        reference color (Lab colorspace)
    lab2 : array_like
        comparison color (Lab colorspace)

    Returns
    -------
    dE : array_like
        distance between colors `lab1` and `lab2`

    Notes
    -----
    deltaE_cmc the defines the scales for the lightness, hue, and chroma
    in terms of the first color.  Consequently
    ``deltaE_cmc(lab1, lab2) != deltaE_cmc(lab2, lab1)``

    References
    ----------
    .. [1] http://en.wikipedia.org/wiki/Color_difference
    .. [2] http://www.brucelindbloom.com/index.html?Eqn_DeltaE_CIE94.html
    .. [3] F. J. J. Clarke, R. McDonald, and B. Rigg, "Modification to the
           JPC79 colour-difference formula," J. Soc. Dyers Colour. 100, 128-132
           (1984).
     N/A N/A L1 C1 h1 N/A N/A N/A np rollaxis N/A lab2lch lab1 -1 N/A 3 N/A N/A L2 C2 h2 N/A N/A N/A np rollaxis N/A lab2lch lab2 -1 N/A 3 N/A dC N/A C1 C2 N/A dL N/A L1 L2 N/A dH2 N/A get_dH2 lab1 lab2 N/A T N/A N/A np where N/A N/A np logical_and N/A N/A N/A np rad2deg h1 164 N/A N/A N/A np rad2deg h1 345 N/A 0.56 N/A 0.2 N/A N/A np abs N/A N/A np cos N/A h1 N/A N/A np deg2rad 168 N/A 0.36 N/A 0.4 N/A N/A np abs N/A N/A np cos N/A h1 N/A N/A np deg2rad 35 N/A c1_4 N/A C1 4 N/A F N/A N/A np sqrt N/A c1_4 N/A c1_4 1900 N/A SL N/A N/A np where N/A L1 16 0.511 N/A N/A 0.040975 L1 N/A 1.0 N/A 0.01765 L1 N/A SC N/A 0.638 N/A N/A 0.0638 C1 N/A 1.0 N/A 0.0131 C1 N/A SH N/A SC N/A N/A N/A F T 1 F N/A dE2 N/A N/A dL N/A kL SL 2 N/A dE2 N/A N/A dC N/A kC SC 2 N/A dE2 N/A dH2 N/A SH 2 N/A N/A N/A np sqrt dE2 N/A get_dH2 N/A N/A lab1 lab2 N/A N/A N/A squared hue difference term occurring in deltaE_cmc and deltaE_ciede94

    Despite its name, "dH" is not a simple difference of hue values.  We avoid
    working directly with the hue value, since differencing angles is
    troublesome.  The hue term is usually written as:
        c1 = sqrt(a1**2 + b1**2)
        c2 = sqrt(a2**2 + b2**2)
        term = (a1-a2)**2 + (b1-b2)**2 - (c1-c2)**2
        dH = sqrt(term)

    However, this has poor roundoff properties when a or b is dominant.
    Instead, ab is a vector with elements a and b.  The same dH term can be
    re-written as:
        |ab1-ab2|**2 - (|ab1| - |ab2|)**2
    and then simplified to:
        2*|ab1|*|ab2| - 2*dot(ab1, ab2)
     N/A lab1 N/A N/A np asarray lab1 N/A lab2 N/A N/A np asarray lab2 N/A N/A a1 b1 N/A N/A N/A np rollaxis lab1 -1 N/A 1 3 N/A N/A a2 b2 N/A N/A N/A np rollaxis lab2 -1 N/A 1 3 N/A C1 N/A N/A np hypot a1 b1 N/A C2 N/A N/A np hypot a2 b2 N/A term N/A N/A C1 C2 N/A N/A a1 a2 N/A b1 b2 N/A N/A 2 term N/A