Changeset 2206


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

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

Location:
trunk
Files:
2 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;
  • trunk/test/unit/color.cpp

    r2205 r2206  
    3838    //50.0000f,   2.4900f,  -0.0010f, 50.0000f,  -2.4900f,   0.0012f,  7.2195f,
    3939    50.0000f,  -0.0010f,   2.4900f, 50.0000f,   0.0009f,  -2.4900f,  4.8045f,
    40     50.0000f,  -0.0010f,   2.4900f, 50.0000f,   0.0010f,  -2.4900f,  4.8045f,
    41     //50.0000f,  -0.0010f,   2.4900f, 50.0000f,   0.0011f,  -2.4900f,  4.7461f,
     40    //50.0000f,  -0.0010f,   2.4900f, 50.0000f,   0.0010f,  -2.4900f,  4.8045f,
     41    50.0000f,  -0.0010f,   2.4900f, 50.0000f,   0.0011f,  -2.4900f,  4.7461f,
    4242    50.0000f,   2.5000f,   0.0000f, 50.0000f,   0.0000f,  -2.5000f,  4.3065f,
    4343    50.0000f,   2.5000f,   0.0000f, 73.0000f,  25.0000f, -18.0000f, 27.1492f,
Note: See TracChangeset for help on using the changeset viewer.