From 8a972bef9ef8760e8045ebee95f78ec0706d50c5 Mon Sep 17 00:00:00 2001 From: Desmis Date: Mon, 16 Mar 2020 17:58:35 +0100 Subject: [PATCH] Itcwb - Use standard observer 10 by default - create option itcwb_stdobserver10 --- rtengine/colortemp.cc | 22 ++++++++++++++++++++-- rtengine/rawimagesource.cc | 3 ++- rtengine/settings.h | 3 ++- rtgui/options.cc | 8 +++++++- 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/rtengine/colortemp.cc b/rtengine/colortemp.cc index 0f85feba0..5061e9021 100644 --- a/rtengine/colortemp.cc +++ b/rtengine/colortemp.cc @@ -33,7 +33,7 @@ namespace rtengine { -static const double cie_colour_match_jd[97][3] = {//350nm to 830nm 5 nm J.Desmis 2° Standard Observer. +static const double cie_colour_match_jd2[97][3] = {//350nm to 830nm 5 nm J.Desmis 2° Standard Observer. {0.0000000, 0.000000, 0.000000}, {0.0000000, 0.000000, 0.000000}, {0.0001299, 0.0003917, 0.0006061}, {0.0002321, 0.000006965, 0.001086}, {0.0004149, 0.00001239, 0.001946}, {0.0007416, 0.00002202, 0.003846}, {0.001368, 0.000039, 0.006450001}, {0.002236, 0.000064, 0.01054999}, {0.004243, 0.000120, 0.02005001}, @@ -70,7 +70,7 @@ static const double cie_colour_match_jd[97][3] = {//350nm to 830nm 5 nm J.Desm }; -static const double cie_colour_match_jd10[97][3] = {//350nm to 830nm 5 nm J.Desmis 10° Standard Observer. +static double cie_colour_match_jd[97][3] = {//350nm to 830nm 5 nm J.Desmis 10° Standard Observer. {0.000000000000, 0.000000000000, 0.000000000000}, {0.000000000000, 0.000000000000, 0.000000000000}, {0.000000122200, 0.000000013398, 0.000000535027}, @@ -169,6 +169,8 @@ static const double cie_colour_match_jd10[97][3] = {//350nm to 830nm 5 nm J.De {0.000001553140, 0.000000629700, 0.000000000000} }; + + ColorTemp::ColorTemp (double t, double g, double e, const std::string &m) : temp(t), green(g), equal(e), method(m) { clip (temp, green, equal); @@ -3757,6 +3759,22 @@ void ColorTemp::tempxy(bool separated, int repref, float **Tx, float **Ty, float Refxyz[i].Zref = 0.f; } + if (settings->verbose) { + if (settings->itcwb_stdobserver10 == false) { + printf("Use standard observer 2°\n"); + } else { + printf("Use standard observer 10°\n"); + } + } + + if (settings->itcwb_stdobserver10 == false) { + for (int i = 0; i < 97; i++) { + cie_colour_match_jd[i][0] = cie_colour_match_jd2[i][0]; + cie_colour_match_jd[i][1] = cie_colour_match_jd2[i][1];; + cie_colour_match_jd[i][2] = cie_colour_match_jd2[i][2]; + } + } + if (separated) { const double tempw = Txyz[repref].Tem; diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index f08609f5e..392c81de1 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -4459,7 +4459,7 @@ void RawImageSource::ItcWB(bool extra, double &tempref, double &greenref, double You can used it in images :flowers, landscape, portrait, skin, where illuminants are "normal" (daylight, blackbody) You must avoid when illuminant is non standard (fluorescent, LED...) and also, when the subject is lost in the image (some target to generate profiles). - You can change 4 parameters in option.cc + You can change parameters in option.cc Itcwb_thres : 34 by default ==> number of color used in final algorithm - between 10 and max 55 Itcwb_sort : false by default, can improve algorithm if true, ==> sort value in something near chroma order, instead of histogram number Itcwb_greenrange : 0 amplitude of green variation - between 0 to 2 @@ -4467,6 +4467,7 @@ void RawImageSource::ItcWB(bool extra, double &tempref, double &greenref, double Itcwb_forceextra : false - if true force algorithm "extra" ("extra" is used when camera wbsettings are wrong) to all images Itcwb_sizereference : 3 by default, can be set to 5 ==> size of reference color compare to size of histogram real color itcwb_delta : 1 by default can be set between 0 to 5 ==> delta temp to build histogram xy - if camera temp is not probably good + itcwb_stdobserver10 : true by default - use standard observer 10°, false = standard observer 2° */ // BENCHFUN diff --git a/rtengine/settings.h b/rtengine/settings.h index 38e66c8ac..4d3131695 100644 --- a/rtengine/settings.h +++ b/rtengine/settings.h @@ -7,8 +7,8 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * * RawTherapee is distributed in the hope that it will be useful, +itcw * * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. @@ -88,6 +88,7 @@ public: bool itcwb_forceextra; int itcwb_sizereference; int itcwb_delta; + bool itcwb_stdobserver10; enum class ThumbnailInspectorMode { diff --git a/rtgui/options.cc b/rtgui/options.cc index 3cf0a9497..4a21fd8c0 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -597,7 +597,8 @@ void Options::setDefaults() rtSettings.itcwb_forceextra = true; rtSettings.itcwb_sizereference = 3;//between 1 and 5 rtSettings.itcwb_delta = 1;//between 0 and 5 - + rtSettings.itcwb_stdobserver10 = true; + rtSettings.protectred = 60; rtSettings.protectredh = 0.3; rtSettings.CRI_color = 0; @@ -1513,6 +1514,10 @@ void Options::readFromFile(Glib::ustring fname) rtSettings.itcwb_forceextra = keyFile.get_boolean("Color Management", "Itcwb_forceextra"); } + if (keyFile.has_key("Color Management", "Itcwb_stdobserver10")) { + rtSettings.itcwb_stdobserver10 = keyFile.get_boolean("Color Management", "Itcwb_stdobserver10"); + } + if (keyFile.has_key("Color Management", "Itcwb_greenrange")) { rtSettings.itcwb_greenrange = keyFile.get_integer("Color Management", "Itcwb_greenrange"); } @@ -2201,6 +2206,7 @@ void Options::saveToFile(Glib::ustring fname) keyFile.set_boolean("Color Management", "Itcwb_forceextra", rtSettings.itcwb_forceextra); keyFile.set_integer("Color Management", "Itcwb_sizereference", rtSettings.itcwb_sizereference); keyFile.set_integer("Color Management", "Itcwb_delta", rtSettings.itcwb_delta); + keyFile.set_boolean("Color Management", "Itcwb_stdobserver10", rtSettings.itcwb_stdobserver10); //keyFile.set_double ("Color Management", "Colortoningab", rtSettings.colortoningab); //keyFile.set_double ("Color Management", "Decaction", rtSettings.decaction);