Changeset 2206 for trunk/src


Ignore:
Timestamp:
Jan 6, 2013, 10:36:32 PM (8 years ago)
Author:
sam
Message:

color: fix a mistake in the CIEDE2000 color-difference formula.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/image/color/cie1931.cpp

    r2205 r2206  
    2828{
    2929    float const pi = 3.141592653589793f;
    30 
    31     float const deg2rad = 6.28318530718f / 360.f;
    32     float const rad2deg = 360.f / 6.28318530718f;
    3330
    3431    float C1 = length(lab1.yz);
     
    6562    else if (abs(hp1 - hp2) > pi && hp1 + hp2 < 2.f * pi)
    6663        Hp_ = 0.5f * (hp1 + hp2) + pi;
    67     else if (abs(hp1 - hp2) > 180.f)
     64    else if (abs(hp1 - hp2) > pi)
    6865        Hp_ = 0.5f * (hp1 + hp2) - pi;
    6966    else
     
    7976    float SH = 1.f + 0.015f * Cp_ * T;
    8077    float RT = -2.f * sqrt(pow(Cp_, 7.f) / (pow(Cp_, 7.f) + pow(25.f, 7.f)))
    81                     * sin(60.f * deg2rad * exp(-pow((Hp_ * rad2deg - 275.f) / 25.f, 2.f)));
     78                    * sin(pi / 3.f * exp(-pow((Hp_ * 180.f / pi - 275.f) / 25.f, 2.f)));
    8279
    8380    dLp /= SL;
Note: See TracChangeset for help on using the changeset viewer.