Skip to content

deltaCIEDE2000_ fix into the MCC module #2845

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion modules/mcc/src/distance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ double deltaCIEDE2000_(const Vec3d& lab1, const Vec3d& lab2, const double& kL,
double sC = 1.0 + 0.045 * C_bar_apo;
double sH = 1.0 + 0.015 * C_bar_apo * T;
double sL = 1.0 + ((0.015 * pow(l_bar_apo - 50.0, 2.0)) / sqrt(20.0 + pow(l_bar_apo - 50.0, 2.0)));
double RT = -2.0 * G * sin(toRad(60.0) * exp(-pow((H_bar_apo - toRad(275.0)) / toRad(25.0), 2.0)));
double R_C = 2.0 * sqrt(pow(C_bar_apo, 7.0) / (pow(C_bar_apo, 7.0) + pow(25, 7)));
double RT = -sin(toRad(60.0) * exp(-pow((H_bar_apo - toRad(275.0)) / toRad(25.0), 2.0))) * R_C;
double res = (pow(delta_L_apo / (kL * sL), 2.0) + pow(delta_C_apo / (kC * sC), 2.0) + pow(delta_H_apo / (kH * sH), 2.0) + RT * (delta_C_apo / (kC * sC)) * (delta_H_apo / (kH * sH)));
return res > 0 ? sqrt(res) : 0;
}
Expand Down
6 changes: 3 additions & 3 deletions modules/mcc/test/test_ccm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ TEST(CV_ccmRunColorCorrection, test_model)


Mat ccm = (Mat_<double>(3, 3) <<
0.37408717, 0.02066172, 0.05796725,
0.12684056, 0.77364991, -0.01566532,
-0.27464866, 0.00652140, 2.74593262);
0.37406520, 0.02066507, 0.05804047,
0.12719672, 0.77389268, -0.01569404,
-0.27627010, 0.00603427, 2.74272981);
ASSERT_MAT_NEAR(model.getCCM(), ccm, 1e-4);
}
TEST(CV_ccmRunColorCorrection, test_masks_weights_1)
Expand Down