From dd070dbd3d251be0ef1d6dea0a81ce95fac0d125 Mon Sep 17 00:00:00 2001 From: Desmis Date: Wed, 29 Apr 2020 11:11:08 +0200 Subject: [PATCH 1/6] Added Damper to wavelet local contrast and gradient --- rtdata/languages/default | 4 ++- rtengine/iplocallab.cc | 64 ++++++++++++++++++++++++++++++---------- rtengine/procevents.h | 2 ++ rtengine/procparams.cc | 8 +++++ rtengine/procparams.h | 2 ++ rtengine/refreshmap.cc | 4 ++- rtgui/locallabtools.h | 2 ++ rtgui/locallabtools2.cc | 30 +++++++++++++++++++ rtgui/paramsedited.cc | 14 +++++++++ rtgui/paramsedited.h | 2 ++ 10 files changed, 114 insertions(+), 18 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 185a2d993..25277d06d 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1157,6 +1157,8 @@ HISTORY_MSG_916;Local - Residual wavelet shadows HISTORY_MSG_917;Local - Residual wavelet shadows threshold HISTORY_MSG_918;Local - Residual wavelet highlights HISTORY_MSG_919;Local - Residual wavelet highlights threshold +HISTORY_MSG_920;Local - Wavelet sigma LC +HISTORY_MSG_921;Local - Wavelet Graduated sigma LC2 HISTORY_MSG_CAT02PRESET;Cat02 automatic preset HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction @@ -2330,7 +2332,7 @@ TP_LOCALLAB_CLARICRES;Merge Chroma TP_LOCALLAB_CLARIFRA;Clarity & Sharp mask - Blend & Soft images TP_LOCALLAB_CLARILRES;Merge Luma TP_LOCALLAB_CLARISOFT;Soft radius -TP_LOCALLAB_CLARISOFT_TOOLTIP;Enabled for Clarity & Sharp mask.\nContrast by level.\nLevel Dynamic Range Compression.\nDirectional contrast.\nGraduated filter local contrast +TP_LOCALLAB_CLARISOFT_TOOLTIP;Enabled for Clarity and Sharp mask if Merge Luma different from zero.\n\nEnabled for all wavelets pyramid modules.\nDisabled if Soft radius = 0 TP_LOCALLAB_CLARITYML;Clarity TP_LOCALLAB_CLARI_TOOLTIP;Under or equal level wavelet 4, 'Sharp mask' is enabled.\nAbove level wavelet 5 'Clarity' is enabled.\nUsefull if you use 'Level dynamic Range Compression' TP_LOCALLAB_CLIPTM;Clip Restored datas (gain) diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index 5aeedcee5..df7d46581 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -450,6 +450,8 @@ struct local_params { float sigmadr; float sigmabl; float sigmaed; + float sigmalc; + float sigmalc2; float residsha; float residshathr; float residhi; @@ -1245,6 +1247,8 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.sigmadr = locallab.spots.at(sp).sigmadr; lp.sigmabl = locallab.spots.at(sp).sigmabl; lp.sigmaed = locallab.spots.at(sp).sigmaed; + lp.sigmalc = locallab.spots.at(sp).sigmalc; + lp.sigmalc2 = locallab.spots.at(sp).sigmalc2; lp.residsha = locallab.spots.at(sp).residsha; lp.residshathr = locallab.spots.at(sp).residshathr; lp.residhi = locallab.spots.at(sp).residhi; @@ -7810,7 +7814,7 @@ void ImProcFunctions::wavcontrast4(struct local_params& lp, float ** tmp, float } } } - +//printf("lp.sigmalc2 = %f\n", lp.sigmalc2); float mean[10]; float meanN[10]; float sigma[10]; @@ -7839,15 +7843,21 @@ void ImProcFunctions::wavcontrast4(struct local_params& lp, float ** tmp, float int W_L = wdspot->level_W(level); int H_L = wdspot->level_H(level); float **wav_L = wdspot->level_coeffs(level); + float effect = lp.sigmalc2; + float offs = 1.f; + float mea[10]; + float beta = 1.f; + calceffect(level, mean, sigma, mea, effect, offs); + if (MaxP[level] > 0.f && mean[level] != 0.f && sigma[level] != 0.f) { float insigma = 0.666f; //SD float logmax = log(MaxP[level]); //log Max - float rapX = (mean[level] + sigma[level]) / MaxP[level]; //rapport between sD / max + float rapX = (mean[level] + lp.sigmalc2 * sigma[level]) / MaxP[level]; //rapport between sD / max float inx = log(insigma); float iny = log(rapX); float rap = inx / iny; //koef - float asig = 0.166f / sigma[level]; + float asig = 0.166f / (sigma[level] * lp.sigmalc2); float bsig = 0.5f - asig * mean[level]; float amean = 0.5f / mean[level]; @@ -7857,11 +7867,36 @@ void ImProcFunctions::wavcontrast4(struct local_params& lp, float ** tmp, float for (int y = 0; y < H_L; y++) { for (int x = 0; x < W_L; x++) { + float WavCL = std::fabs(wav_L[dir][y * W_L + x]); + + if (WavCL < mea[0]) { + beta = 0.05f; + } else if (WavCL < mea[1]) { + beta = 0.2f; + } else if (WavCL < mea[2]) { + beta = 0.7f; + } else if (WavCL < mea[3]) { + beta = 1.f; //standard + } else if (WavCL < mea[4]) { + beta = 1.f; + } else if (WavCL < mea[5]) { + beta = 0.8f; //+sigma + } else if (WavCL < mea[6]) { + beta = 0.6f; + } else if (WavCL < mea[7]) { + beta = 0.5f; + } else if (WavCL < mea[8]) { + beta = 0.4f; // + 2 sigma + } else if (WavCL < mea[9]) { + beta = 0.3f; + } else { + beta = 0.1f; + } float absciss; float &val = wav_L[dir][y * W_L + x]; - if (fabsf(val) >= (mean[level] + sigma[level])) { //for max + if (fabsf(val) >= (mean[level] + lp.sigmalc2 * sigma[level])) { //for max float valcour = xlogf(fabsf(val)); float valc = valcour - logmax; float vald = valc * rap; @@ -7890,20 +7925,17 @@ void ImProcFunctions::wavcontrast4(struct local_params& lp, float ** tmp, float } } - float kc = 0.5f * klev * factorwav[y][x] * absciss; + float kc = 0.8f * klev * factorwav[y][x] * absciss; float reduceeffect = kc <= 0.f ? 1.f : 1.5f; float kinterm = 1.f + reduceeffect * kc; kinterm = kinterm <= 0.f ? 0.01f : kinterm; - - val *= kinterm; + val *= (1.f + (kinterm - 1.f) * beta); } } } } } - - } //declare a and b if need @@ -8557,11 +8589,11 @@ void ImProcFunctions::wavcontrast4(struct local_params& lp, float ** tmp, float if (MaxP[level] > 0.f && mean[level] != 0.f && sigma[level] != 0.f) { float insigma = 0.666f; //SD float logmax = log(MaxP[level]); //log Max - float rapX = (mean[level] + sigma[level]) / MaxP[level]; //rapport between sD / max + float rapX = (mean[level] + lp.sigmalc * sigma[level]) / MaxP[level]; //rapport between sD / max float inx = log(insigma); float iny = log(rapX); float rap = inx / iny; //koef - float asig = 0.166f / sigma[level]; + float asig = 0.166f / (sigma[level] * lp.sigmalc); float bsig = 0.5f - asig * mean[level]; float amean = 0.5f / mean[level]; @@ -8574,7 +8606,7 @@ void ImProcFunctions::wavcontrast4(struct local_params& lp, float ** tmp, float float absciss; float &val = wav_L[dir][i]; - if (fabsf(val) >= (mean[level] + sigma[level])) { //for max + if (fabsf(val) >= (mean[level] + lp.sigmalc * sigma[level])) { //for max float valcour = xlogf(fabsf(val)); float valc = valcour - logmax; float vald = valc * rap; @@ -13035,7 +13067,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o float thr = 0.001f; int flag = 0; - + if (maxlvl <= 4) { mL0 = 0.f; mC0 = 0.f; @@ -13053,7 +13085,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o mL0 = mL = mC0 = mC = 0.f; } - if (exec || compreena || comprena || levelena || lp.wavgradl) { + if (exec || compreena || comprena || levelena || blurena || lp.wavgradl || locwavCurve || lp.edgwena) { bool origl = false; // origlc = false; LabImage *mergfile = origl ? tmpres.get() : tmp1.get(); @@ -13069,7 +13101,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o tmp1->b[x][y] = CLIPC((1.f + mC0) * mergfile->b[x][y] - mC * tmpresid->b[x][y]); } - if (softr != 0.f && (compreena || comprena || levelena || lp.wavgradl || fabs(mL) > 0.001f)) { + if (softr != 0.f && (compreena || locwavCurve || comprena || blurena || levelena || lp.wavgradl || lp.edgwena || fabs(mL) > 0.001f)) { softproc(tmpres.get(), tmp1.get(), softr, bfh, bfw, 0.0001, 0.00001, thr, sk, multiThread, flag); } } @@ -13094,7 +13126,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o JaggedArray loctemp(bfw, bfh); if (call == 2) { //call from simpleprocess - printf("bfw=%i bfh=%i\n", bfw, bfh); + // printf("bfw=%i bfh=%i\n", bfw, bfh); if (bfw < mSPsharp || bfh < mSPsharp) { printf("too small RT-spot - minimum size 39 * 39\n"); diff --git a/rtengine/procevents.h b/rtengine/procevents.h index 5584ac9f8..c1df2bfd6 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -942,6 +942,8 @@ enum ProcEventCode { Evlocallabresidshathr = 916, Evlocallabresidhi = 917, Evlocallabresidhithr = 918, + Evlocallabsigmalc = 919, + Evlocallabsigmalc2 = 920, NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 60333b2f6..3f5744e11 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -3336,6 +3336,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : lcamount(0.0), lcdarkness(1.0), lclightness(1.0), + sigmalc(1.0), levelwav(4), residcont(0.0), residsha(0.0), @@ -3359,6 +3360,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : clarilres(0.0), claricres(0.0), clarisoft(1.0), + sigmalc2(1.0), strwav(0.0), angwav(0.0), strengthw(0.0), @@ -3953,6 +3955,7 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && lcamount == other.lcamount && lcdarkness == other.lcdarkness && lclightness == other.lclightness + && sigmalc == other.sigmalc && levelwav == other.levelwav && residcont == other.residcont && residsha == other.residsha @@ -3976,6 +3979,7 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && clarilres == other.clarilres && claricres == other.claricres && clarisoft == other.clarisoft + && sigmalc2 == other.sigmalc2 && strwav == other.strwav && angwav == other.angwav && strengthw == other.strengthw @@ -5397,6 +5401,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || spot_edited->lcamount, "Locallab", "Lcamount_" + index_str, spot.lcamount, keyFile); saveToKeyfile(!pedited || spot_edited->lcdarkness, "Locallab", "Lcdarkness_" + index_str, spot.lcdarkness, keyFile); saveToKeyfile(!pedited || spot_edited->lclightness, "Locallab", "Lclightness_" + index_str, spot.lclightness, keyFile); + saveToKeyfile(!pedited || spot_edited->sigmalc, "Locallab", "Sigmalc_" + index_str, spot.sigmalc, keyFile); saveToKeyfile(!pedited || spot_edited->levelwav, "Locallab", "Levelwav_" + index_str, spot.levelwav, keyFile); saveToKeyfile(!pedited || spot_edited->residcont, "Locallab", "Residcont_" + index_str, spot.residcont, keyFile); saveToKeyfile(!pedited || spot_edited->residsha, "Locallab", "Residsha_" + index_str, spot.residsha, keyFile); @@ -5420,6 +5425,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || spot_edited->clarilres, "Locallab", "ClariLres_" + index_str, spot.clarilres, keyFile); saveToKeyfile(!pedited || spot_edited->claricres, "Locallab", "ClariCres_" + index_str, spot.claricres, keyFile); saveToKeyfile(!pedited || spot_edited->clarisoft, "Locallab", "Clarisoft_" + index_str, spot.clarisoft, keyFile); + saveToKeyfile(!pedited || spot_edited->sigmalc2, "Locallab", "Sigmalc2_" + index_str, spot.sigmalc2, keyFile); saveToKeyfile(!pedited || spot_edited->strwav, "Locallab", "Strwav_" + index_str, spot.strwav, keyFile); saveToKeyfile(!pedited || spot_edited->angwav, "Locallab", "Angwav_" + index_str, spot.angwav, keyFile); saveToKeyfile(!pedited || spot_edited->strengthw, "Locallab", "Strengthw_" + index_str, spot.strengthw, keyFile); @@ -7050,6 +7056,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Lcamount_" + index_str, pedited, spot.lcamount, spotEdited.lcamount); assignFromKeyfile(keyFile, "Locallab", "Lcdarkness_" + index_str, pedited, spot.lcdarkness, spotEdited.lcdarkness); assignFromKeyfile(keyFile, "Locallab", "Lclightness_" + index_str, pedited, spot.lclightness, spotEdited.lclightness); + assignFromKeyfile(keyFile, "Locallab", "Sigmalc_" + index_str, pedited, spot.sigmalc, spotEdited.sigmalc); assignFromKeyfile(keyFile, "Locallab", "Levelwav_" + index_str, pedited, spot.levelwav, spotEdited.levelwav); assignFromKeyfile(keyFile, "Locallab", "Residcont_" + index_str, pedited, spot.residcont, spotEdited.residcont); assignFromKeyfile(keyFile, "Locallab", "Residsha_" + index_str, pedited, spot.residsha, spotEdited.residsha); @@ -7073,6 +7080,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "ClariLres_" + index_str, pedited, spot.clarilres, spotEdited.clarilres); assignFromKeyfile(keyFile, "Locallab", "ClariCres_" + index_str, pedited, spot.claricres, spotEdited.claricres); assignFromKeyfile(keyFile, "Locallab", "Clarisoft_" + index_str, pedited, spot.clarisoft, spotEdited.clarisoft); + assignFromKeyfile(keyFile, "Locallab", "Sigmalc2_" + index_str, pedited, spot.sigmalc2, spotEdited.sigmalc2); assignFromKeyfile(keyFile, "Locallab", "Strwav_" + index_str, pedited, spot.strwav, spotEdited.strwav); assignFromKeyfile(keyFile, "Locallab", "Angwav_" + index_str, pedited, spot.angwav, spotEdited.angwav); assignFromKeyfile(keyFile, "Locallab", "Strengthw_" + index_str, pedited, spot.strengthw, spotEdited.strengthw); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 2ec4b7f90..8441545b8 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1290,6 +1290,7 @@ struct LocallabParams { double lcamount; double lcdarkness; double lclightness; + double sigmalc; int levelwav; double residcont; double residsha; @@ -1313,6 +1314,7 @@ struct LocallabParams { double clarilres; double claricres; double clarisoft; + double sigmalc2; double strwav; double angwav; double strengthw; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 3fd6cebc9..036222438 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -945,7 +945,9 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, // Evlocallabresidsha LUMINANCECURVE, // Evlocallabresidshathr LUMINANCECURVE, // Evlocallabresidhi - LUMINANCECURVE // Evlocallabresidhithr + LUMINANCECURVE, // Evlocallabresidhithr + LUMINANCECURVE, // Evlocallabsigmalc + LUMINANCECURVE // Evlocallabsigmalc2 }; diff --git a/rtgui/locallabtools.h b/rtgui/locallabtools.h index 9446a38ac..23dedb3c0 100644 --- a/rtgui/locallabtools.h +++ b/rtgui/locallabtools.h @@ -881,6 +881,7 @@ private: Adjuster* const lcamount; Adjuster* const lcdarkness; Adjuster* const lclightness; + Adjuster* const sigmalc; CurveEditorGroup* const LocalcurveEditorwav; FlatCurveEditor* const wavshape; Adjuster* const levelwav; @@ -902,6 +903,7 @@ private: MyExpander* const expcontrastpyr; Gtk::Frame* const gradwavFrame; Gtk::CheckButton* const wavgradl; + Adjuster* const sigmalc2; Adjuster* const strwav; Adjuster* const angwav; Gtk::Frame* const edgFrame; diff --git a/rtgui/locallabtools2.cc b/rtgui/locallabtools2.cc index 55c4ec127..291bd7c88 100644 --- a/rtgui/locallabtools2.cc +++ b/rtgui/locallabtools2.cc @@ -2002,6 +2002,7 @@ LocallabContrast::LocallabContrast(): lcamount(Gtk::manage(new Adjuster(M("TP_LOCALCONTRAST_AMOUNT"), 0, 1.0, 0.01, 0))), lcdarkness(Gtk::manage(new Adjuster(M("TP_LOCALCONTRAST_DARKNESS"), 0, 3.0, 0.01, 1.0))), lclightness(Gtk::manage(new Adjuster(M("TP_LOCALCONTRAST_LIGHTNESS"), 0, 3.0, 0.01, 1.0))), + sigmalc(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SIGMAWAV"), 0.2, 2.5, 0.01, 1.))), LocalcurveEditorwav(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_WAV"))), wavshape(static_cast(LocalcurveEditorwav->addCurve(CT_Flat, "", nullptr, false, false))), levelwav(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LEVELWAV"), 1, 9, 1, 4))), @@ -2023,6 +2024,7 @@ LocallabContrast::LocallabContrast(): expcontrastpyr(Gtk::manage(new MyExpander(false, Gtk::manage(new Gtk::HBox())))), gradwavFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_GRADWAVFRA")))), wavgradl(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_GRALWFRA")))), + sigmalc2(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SIGMAWAV"), 0.2, 2.5, 0.01, 1.))), strwav(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GRADSTR"), -4.0, 4.0, 0.05, 0.))), angwav(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GRADANG"), -180, 180, 0.1, 0.))), edgFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_EDGSHARPFRA")))), @@ -2115,6 +2117,7 @@ LocallabContrast::LocallabContrast(): lcdarkness->setAdjusterListener(this); lclightness->setAdjusterListener(this); + sigmalc->setAdjusterListener(this); LocalcurveEditorwav->setCurveListener(this); @@ -2184,6 +2187,7 @@ LocallabContrast::LocallabContrast(): wavgradlConn = wavgradl->signal_toggled().connect(sigc::mem_fun(*this, &LocallabContrast::wavgradlChanged)); + sigmalc2->setAdjusterListener(this); strwav->setAdjusterListener(this); angwav->setAdjusterListener(this); @@ -2413,6 +2417,7 @@ LocallabContrast::LocallabContrast(): pack_start(*lcamount); pack_start(*lcdarkness); pack_start(*lclightness); + pack_start(*sigmalc); pack_start(*LocalcurveEditorwav, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor // pack_start(*levelwav); pack_start(*csThreshold); @@ -2442,6 +2447,7 @@ LocallabContrast::LocallabContrast(): ToolParamBlock* const blurcontBox = Gtk::manage(new ToolParamBlock()); gradwavFrame->set_label_widget(*wavgradl); ToolParamBlock* const gradwavBox = Gtk::manage(new ToolParamBlock()); + gradwavBox->pack_start(*sigmalc2); gradwavBox->pack_start(*strwav); gradwavBox->pack_start(*angwav); gradwavFrame->add(*gradwavBox); @@ -2642,6 +2648,7 @@ void LocallabContrast::read(const rtengine::procparams::ProcParams* pp, const Pa lcamount->setValue(pp->locallab.spots.at(index).lcamount); lcdarkness->setValue(pp->locallab.spots.at(index).lcdarkness); lclightness->setValue(pp->locallab.spots.at(index).lclightness); + sigmalc->setValue(pp->locallab.spots.at(index).sigmalc); wavshape->setCurve(pp->locallab.spots.at(index).locwavcurve); levelwav->setValue((double)pp->locallab.spots.at(index).levelwav); csThreshold->setValue(pp->locallab.spots.at(index).csthreshold); @@ -2657,6 +2664,7 @@ void LocallabContrast::read(const rtengine::procparams::ProcParams* pp, const Pa clarisoft->setValue(pp->locallab.spots.at(index).clarisoft); origlc->set_active(pp->locallab.spots.at(index).origlc); wavgradl->set_active(pp->locallab.spots.at(index).wavgradl); + sigmalc2->setValue(pp->locallab.spots.at(index).sigmalc2); strwav->setValue(pp->locallab.spots.at(index).strwav); angwav->setValue(pp->locallab.spots.at(index).angwav); wavedg->set_active(pp->locallab.spots.at(index).wavedg); @@ -2761,6 +2769,7 @@ void LocallabContrast::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pp->locallab.spots.at(index).lcamount = lcamount->getValue(); pp->locallab.spots.at(index).lcdarkness = lcdarkness->getValue(); pp->locallab.spots.at(index).lclightness = lclightness->getValue(); + pp->locallab.spots.at(index).sigmalc = sigmalc->getValue(); pp->locallab.spots.at(index).locwavcurve = wavshape->getCurve(); pp->locallab.spots.at(index).levelwav = levelwav->getIntValue(); pp->locallab.spots.at(index).csthreshold = csThreshold->getValue(); @@ -2776,6 +2785,7 @@ void LocallabContrast::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pp->locallab.spots.at(index).clarisoft = clarisoft->getValue(); pp->locallab.spots.at(index).origlc = origlc->get_active(); pp->locallab.spots.at(index).wavgradl = wavgradl->get_active(); + pp->locallab.spots.at(index).sigmalc2 = sigmalc2->getValue(); pp->locallab.spots.at(index).strwav = strwav->getValue(); pp->locallab.spots.at(index).angwav = angwav->getValue(); pp->locallab.spots.at(index).wavedg = wavedg->get_active(); @@ -2856,6 +2866,7 @@ void LocallabContrast::setDefaults(const rtengine::procparams::ProcParams* defPa lcamount->setDefault(defSpot.lcamount); lcdarkness->setDefault(defSpot.lcdarkness); lclightness->setDefault(defSpot.lclightness); + sigmalc->setDefault(defSpot.sigmalc); levelwav->setDefault((double)defSpot.levelwav); csThreshold->setDefault(defSpot.csthreshold); residcont->setDefault(defSpot.residcont); @@ -2868,6 +2879,7 @@ void LocallabContrast::setDefaults(const rtengine::procparams::ProcParams* defPa clarilres->setDefault(defSpot.clarilres); claricres->setDefault(defSpot.claricres); clarisoft->setDefault(defSpot.clarisoft); + sigmalc2->setDefault(defSpot.sigmalc2); strwav->setDefault(defSpot.strwav); angwav->setDefault(defSpot.angwav); strengthw->setDefault(defSpot.strengthw); @@ -2931,6 +2943,13 @@ void LocallabContrast::adjusterChanged(Adjuster* a, double newval) } } + if (a == sigmalc) { + if (listener) { + listener->panelChanged(Evlocallabsigmalc, + sigmalc->getTextValue() + " (" + escapeHtmlChars(spotName) + ")"); + } + } + if (a == levelwav) { if (listener) { listener->panelChanged(Evlocallablevelwav, @@ -3008,6 +3027,13 @@ void LocallabContrast::adjusterChanged(Adjuster* a, double newval) } } + if (a == sigmalc2) { + if (listener) { + listener->panelChanged(Evlocallabsigmalc2, + sigmalc2->getTextValue() + " (" + escapeHtmlChars(spotName) + ")"); + } + } + if (a == strwav) { if (listener) { listener->panelChanged(Evlocallabstrwav, @@ -3540,6 +3566,7 @@ void LocallabContrast::updateContrastGUI1() lcamount->show(); lcdarkness->show(); lclightness->show(); + sigmalc->hide(); LocalcurveEditorwav->hide(); levelwav->hide(); csThreshold->hide(); @@ -3551,6 +3578,7 @@ void LocallabContrast::updateContrastGUI1() residhithr->hide(); shresFrame->hide(); clariFrame->hide(); + sigmalc2->hide(); strwav->hide(); angwav->hide(); strengthw->hide(); @@ -3586,6 +3614,7 @@ void LocallabContrast::updateContrastGUI1() lcamount->hide(); lcdarkness->hide(); lclightness->hide(); + sigmalc->show(); LocalcurveEditorwav->show(); levelwav->show(); csThreshold->show(); @@ -3597,6 +3626,7 @@ void LocallabContrast::updateContrastGUI1() residhithr->show(); shresFrame->show(); clariFrame->show(); + sigmalc2->show(); strwav->show(); angwav->show(); strengthw->show(); diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index d9feb9134..af45f9335 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -1318,6 +1318,7 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).lcamount = locallab.spots.at(j).lcamount && pSpot.lcamount == otherSpot.lcamount; locallab.spots.at(j).lcdarkness = locallab.spots.at(j).lcdarkness && pSpot.lcdarkness == otherSpot.lcdarkness; locallab.spots.at(j).lclightness = locallab.spots.at(j).lclightness && pSpot.lclightness == otherSpot.lclightness; + locallab.spots.at(j).sigmalc = locallab.spots.at(j).sigmalc && pSpot.sigmalc == otherSpot.sigmalc; locallab.spots.at(j).levelwav = locallab.spots.at(j).levelwav && pSpot.levelwav == otherSpot.levelwav; locallab.spots.at(j).residcont = locallab.spots.at(j).residcont && pSpot.residcont == otherSpot.residcont; locallab.spots.at(j).residsha = locallab.spots.at(j).residsha && pSpot.residsha == otherSpot.residsha; @@ -1341,6 +1342,7 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).clarilres = locallab.spots.at(j).clarilres && pSpot.clarilres == otherSpot.clarilres; locallab.spots.at(j).claricres = locallab.spots.at(j).claricres && pSpot.claricres == otherSpot.claricres; locallab.spots.at(j).clarisoft = locallab.spots.at(j).clarisoft && pSpot.clarisoft == otherSpot.clarisoft; + locallab.spots.at(j).sigmalc2 = locallab.spots.at(j).sigmalc2 && pSpot.sigmalc2 == otherSpot.sigmalc2; locallab.spots.at(j).strwav = locallab.spots.at(j).strwav && pSpot.strwav == otherSpot.strwav; locallab.spots.at(j).angwav = locallab.spots.at(j).angwav && pSpot.angwav == otherSpot.angwav; locallab.spots.at(j).strengthw = locallab.spots.at(j).strengthw && pSpot.strengthw == otherSpot.strengthw; @@ -4198,6 +4200,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).lclightness = mods.locallab.spots.at(i).lclightness; } + if (locallab.spots.at(i).sigmalc) { + toEdit.locallab.spots.at(i).sigmalc = mods.locallab.spots.at(i).sigmalc; + } + if (locallab.spots.at(i).levelwav) { toEdit.locallab.spots.at(i).levelwav = mods.locallab.spots.at(i).levelwav; } @@ -4291,6 +4297,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).clarisoft = mods.locallab.spots.at(i).clarisoft; } + if (locallab.spots.at(i).sigmalc2) { + toEdit.locallab.spots.at(i).sigmalc2 = mods.locallab.spots.at(i).sigmalc2; + } + if (locallab.spots.at(i).strwav) { toEdit.locallab.spots.at(i).strwav = mods.locallab.spots.at(i).strwav; } @@ -5998,6 +6008,7 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : lcamount(v), lcdarkness(v), lclightness(v), + sigmalc(v), levelwav(v), residcont(v), residsha(v), @@ -6021,6 +6032,7 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : clarilres(v), claricres(v), clarisoft(v), + sigmalc2(v), strwav(v), angwav(v), strengthw(v), @@ -6437,6 +6449,7 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) lcamount = v; lcdarkness = v; lclightness = v; + sigmalc = v; levelwav = v; residcont = v; residsha = v; @@ -6460,6 +6473,7 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) clarilres = v; claricres = v; clarisoft = v; + sigmalc2 = v; strwav = v; angwav = v; strengthw = v; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index d11569ab7..5a1c40c4c 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -718,6 +718,7 @@ public: bool lcamount; bool lcdarkness; bool lclightness; + bool sigmalc; bool levelwav; bool residcont; bool residsha; @@ -741,6 +742,7 @@ public: bool clarilres; bool claricres; bool clarisoft; + bool sigmalc2; bool strwav; bool angwav; bool strengthw; From b1c43b32f88934ecaad5aadb56c41796a659995e Mon Sep 17 00:00:00 2001 From: Desmis Date: Thu, 30 Apr 2020 08:29:21 +0200 Subject: [PATCH 2/6] Enable Help Local adjustment with Rawpedia fr --- rtdata/languages/default | 1 + rtgui/rtwindow.cc | 15 +++++++++++++++ rtgui/rtwindow.h | 1 + 3 files changed, 17 insertions(+) diff --git a/rtdata/languages/default b/rtdata/languages/default index 25277d06d..e1897f99d 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1335,6 +1335,7 @@ IPTCPANEL_TITLE;Title IPTCPANEL_TITLEHINT;Enter a short verbal and human readable name for the image, this may be the file name. IPTCPANEL_TRANSREFERENCE;Job ID IPTCPANEL_TRANSREFERENCEHINT;Enter a number or identifier needed for workflow control or tracking. +LOCAL_HELP;Help Local Adjustments MAIN_BUTTON_FULLSCREEN;Fullscreen MAIN_BUTTON_ICCPROFCREATOR;ICC Profile Creator MAIN_BUTTON_NAVNEXT_TOOLTIP;Navigate to the next image relative to image opened in the Editor.\nShortcut: Shift-F4\n\nTo navigate to the next image relative to the currently selected thumbnail in the File Browser or Filmstrip:\nShortcut: F4 diff --git a/rtgui/rtwindow.cc b/rtgui/rtwindow.cc index a543c383c..9163a1162 100644 --- a/rtgui/rtwindow.cc +++ b/rtgui/rtwindow.cc @@ -385,6 +385,13 @@ RTWindow::RTWindow () iccProfileCreator->set_tooltip_markup (M ("MAIN_BUTTON_ICCPROFCREATOR")); iccProfileCreator->signal_clicked().connect ( sigc::mem_fun (*this, &RTWindow::showICCProfileCreator) ); + Gtk::Button* helpBtnloc = Gtk::manage (new Gtk::Button ()); + setExpandAlignProperties (helpBtnloc, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); + helpBtnloc->set_relief(Gtk::RELIEF_NONE); + helpBtnloc->set_image (*Gtk::manage (new RTImage ("questionmark.png"))); + helpBtnloc->set_tooltip_markup (M ("LOCAL_HELP")); + helpBtnloc->signal_clicked().connect (sigc::mem_fun (*this, &RTWindow::showRawPedialoc)); + Gtk::Button* helpBtn = Gtk::manage (new Gtk::Button ()); setExpandAlignProperties (helpBtn, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); helpBtn->set_relief(Gtk::RELIEF_NONE); @@ -420,6 +427,7 @@ RTWindow::RTWindow () actionGrid->set_orientation (Gtk::ORIENTATION_VERTICAL); actionGrid->attach_next_to (prProgBar, Gtk::POS_BOTTOM, 1, 1); actionGrid->attach_next_to (*iccProfileCreator, Gtk::POS_BOTTOM, 1, 1); + actionGrid->attach_next_to (*helpBtnloc, Gtk::POS_BOTTOM, 1, 1); actionGrid->attach_next_to (*helpBtn, Gtk::POS_BOTTOM, 1, 1); actionGrid->attach_next_to (*preferences, Gtk::POS_BOTTOM, 1, 1); actionGrid->attach_next_to (*btn_fullscreen, Gtk::POS_BOTTOM, 1, 1); @@ -429,6 +437,7 @@ RTWindow::RTWindow () actionGrid->set_orientation (Gtk::ORIENTATION_HORIZONTAL); actionGrid->attach_next_to (prProgBar, Gtk::POS_RIGHT, 1, 1); actionGrid->attach_next_to (*iccProfileCreator, Gtk::POS_RIGHT, 1, 1); + actionGrid->attach_next_to (*helpBtnloc, Gtk::POS_RIGHT, 1, 1); actionGrid->attach_next_to (*helpBtn, Gtk::POS_RIGHT, 1, 1); actionGrid->attach_next_to (*preferences, Gtk::POS_RIGHT, 1, 1); actionGrid->attach_next_to (*btn_fullscreen, Gtk::POS_RIGHT, 1, 1); @@ -927,6 +936,12 @@ void RTWindow::showRawPedia() gtk_show_uri(nullptr, "https://rawpedia.rawtherapee.com/", GDK_CURRENT_TIME, &gerror); } +void RTWindow::showRawPedialoc() +{ + GError* gerror = nullptr; + gtk_show_uri(nullptr, "https://rawpedia.rawtherapee.com/Local_Adjustments/fr", GDK_CURRENT_TIME, &gerror); +} + void RTWindow::showICCProfileCreator () { ICCProfileCreator *iccpc = new ICCProfileCreator (this); diff --git a/rtgui/rtwindow.h b/rtgui/rtwindow.h index 2d4e390e8..948fddff5 100644 --- a/rtgui/rtwindow.h +++ b/rtgui/rtwindow.h @@ -91,6 +91,7 @@ public: void on_mainNB_switch_page (Gtk::Widget* widget, guint page_num); void showRawPedia(); + void showRawPedialoc(); void showICCProfileCreator (); void showPreferences (); void on_realize () override; From 62fe43fa1614944edefb5cecde0c8d5206136438 Mon Sep 17 00:00:00 2001 From: Desmis Date: Thu, 30 Apr 2020 08:46:26 +0200 Subject: [PATCH 3/6] Fixed bad behavior slider strength in Soft Light --- rtgui/locallabtools.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rtgui/locallabtools.cc b/rtgui/locallabtools.cc index 289387759..ec46ca8e4 100644 --- a/rtgui/locallabtools.cc +++ b/rtgui/locallabtools.cc @@ -4925,7 +4925,8 @@ void LocallabSoft::read(const rtengine::procparams::ProcParams* pp, const Params streng->setValue((double)pp->locallab.spots.at(index).streng); } else { softMethod->set_active(0); - streng->setValue(1.); + // streng->setValue(1.); + streng->setValue((double)pp->locallab.spots.at(index).streng); } sensisf->setValue((double)pp->locallab.spots.at(index).sensisf); From 0196b31bf5e3c1fff11c6b5a953ff735d3722690 Mon Sep 17 00:00:00 2001 From: Desmis Date: Fri, 1 May 2020 08:34:11 +0200 Subject: [PATCH 4/6] Change some default sliders settings wavelet --- rtdata/languages/default | 1 + rtengine/iplocallab.cc | 4 ++-- rtengine/procparams.cc | 4 ++-- rtgui/locallabtools2.cc | 11 ++++++++--- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index e1897f99d..ce27e20ae 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -2325,6 +2325,7 @@ TP_LOCALLAB_CHROMACBDL;Chroma TP_LOCALLAB_CHROMACB_TOOLTIP;Acts as an amplifier-reducer action compare to sliders of luminance.\nUnder 100 reduce, above 100 amplifie TP_LOCALLAB_CHROMALEV;Chroma levels TP_LOCALLAB_CHROMABLU;Chroma levels +TP_LOCALLAB_CHROMABLU_TOOLTIP;Acts as an amplifier-reducer action compare to settings of luma.\nUnder 1 reduce, above 1 amplifie TP_LOCALLAB_CHROMASKCOL;Chroma mask TP_LOCALLAB_CHROMASK_TOOLTIP;You can use this slider to desaturated background (inverse mask - curve near 0).\nAlso to attenuate or enhance the action of a mask on the chroma TP_LOCALLAB_CHRRT;Chroma diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index df7d46581..93c92b5f2 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -8704,7 +8704,7 @@ void ImProcFunctions::wavcontrast4(struct local_params& lp, float ** tmp, float return; } - if (wavcurvelev && radlevblur > 0.f) { + if (wavcurvelev && radlevblur > 0.f && chromablu > 0.f) { wavcont(lp, tmp, *wdspota, templevela, level_bl, maxlvl, loclevwavCurve, loclevwavutili, loccompwavCurve, loccompwavutili, loccomprewavCurve, loccomprewavutili, radlevblur, 1, chromablu, 0.f, 0.f, 0.f); } @@ -8759,7 +8759,7 @@ void ImProcFunctions::wavcontrast4(struct local_params& lp, float ** tmp, float return; } - if (wavcurvelev && radlevblur > 0.f) { + if (wavcurvelev && radlevblur > 0.f && chromablu > 0.f) { wavcont(lp, tmp, *wdspotb, templevelb, level_bl, maxlvl, loclevwavCurve, loclevwavutili, loccompwavCurve, loccompwavutili, loccomprewavCurve, loccomprewavutili, radlevblur, 1, chromablu, 0.f, 0.f, 0.f); } diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 3f5744e11..522f65aa9 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -3353,7 +3353,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : sigmadr(1.0), threswav(1.4), chromalev(1.0), - chromablu(1.0), + chromablu(0.0), sigmadc(1.0), deltad(0.0), fatres(0.0), @@ -3372,7 +3372,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : thigw(0.0), edgw(60.0), basew(10.0), - sensilc(30), + sensilc(50), fftwlc(false), blurlc(true), wavblur(false), diff --git a/rtgui/locallabtools2.cc b/rtgui/locallabtools2.cc index 291bd7c88..a3a16647a 100644 --- a/rtgui/locallabtools2.cc +++ b/rtgui/locallabtools2.cc @@ -2015,7 +2015,7 @@ LocallabContrast::LocallabContrast(): residshathr(Gtk::manage(new Adjuster(M("TP_LOCALLAB_RESIDSHATHR"), 0., 100., 1., 30.))), residhi(Gtk::manage(new Adjuster(M("TP_LOCALLAB_RESIDHI"), -100., 100., 1., 0.))), residhithr(Gtk::manage(new Adjuster(M("TP_LOCALLAB_RESIDHITHR"), 0., 100., 1., 70.))), - sensilc(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSIS"), 0, 100, 1, 30))), + sensilc(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSIS"), 0, 100, 1, 50))), clariFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_CLARIFRA")))), clarilres(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CLARILRES"), -20., 100., 0.5, 0.))), claricres(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CLARICRES"), -20., 100., 0.5, 0.))), @@ -2050,7 +2050,7 @@ LocallabContrast::LocallabContrast(): wavblur(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_BLURLEVELFRA")))), levelblur(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LEVELBLUR"), 0., 100., 0.5, 0.))), sigmabl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SIGMAWAV"), 0.2, 2.5, 0.01, 1.))), - chromablu(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHROMABLU"), 0.01, 5., 0.01, 1.))), + chromablu(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHROMABLU"), 0.0, 5., 0.1, 0.))), LocalcurveEditorwavlev(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_WAVLEV"))), wavshapelev(static_cast(LocalcurveEditorwavlev->addCurve(CT_Flat, "", nullptr, false, false))), residblur(Gtk::manage(new Adjuster(M("TP_LOCALLAB_RESIDBLUR"), 0., 100., 0.5, 0.))), @@ -2060,7 +2060,7 @@ LocallabContrast::LocallabContrast(): wavcont(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_CONTFRA")))), sigma(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SIGMAWAV"), 0.2, 2.5, 0.01, 1.))), offset(Gtk::manage(new Adjuster(M("TP_LOCALLAB_OFFSETWAV"), 0.33, 1.66, 0.01, 1., Gtk::manage(new RTImage("circle-black-small.png")), Gtk::manage(new RTImage("circle-white-small.png"))))), - chromalev(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHROMALEV"), 0.01, 5., 0.01, 1.))), + chromalev(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHROMALEV"), 0.1, 5., 0.1, 1.))), LocalcurveEditorwavcon(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_WAVCON"))), wavshapecon(static_cast(LocalcurveEditorwavcon->addCurve(CT_Flat, "", nullptr, false, false))), compreFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_COMPREFRA")))), @@ -2278,6 +2278,11 @@ LocallabContrast::LocallabContrast(): chromalev->setAdjusterListener(this); + if (showtooltip) { + chromalev->set_tooltip_text(M("TP_LOCALLAB_CHROMABLU_TOOLTIP")); + chromablu->set_tooltip_text(M("TP_LOCALLAB_CHROMABLU_TOOLTIP")); + } + LocalcurveEditorwavcon->setCurveListener(this); wavshapecon->setIdentityValue(0.); From 778e9af9b7670bd346ed70f719956f9da6c0c958 Mon Sep 17 00:00:00 2001 From: Desmis Date: Sat, 2 May 2020 11:13:48 +0200 Subject: [PATCH 5/6] Added checkbutton in settings forced change in BW --- rtdata/languages/default | 2 ++ rtengine/iplocallab.cc | 7 ++++++- rtengine/procevents.h | 1 + rtengine/procparams.cc | 4 ++++ rtengine/procparams.h | 1 + rtengine/refreshmap.cc | 3 ++- rtgui/controlspotpanel.cc | 36 ++++++++++++++++++++++++++++++++++++ rtgui/controlspotpanel.h | 5 +++++ rtgui/locallab.cc | 4 ++++ rtgui/paramsedited.cc | 7 +++++++ rtgui/paramsedited.h | 1 + 11 files changed, 69 insertions(+), 2 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index ce27e20ae..b17eb315a 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1159,6 +1159,7 @@ HISTORY_MSG_918;Local - Residual wavelet highlights HISTORY_MSG_919;Local - Residual wavelet highlights threshold HISTORY_MSG_920;Local - Wavelet sigma LC HISTORY_MSG_921;Local - Wavelet Graduated sigma LC2 +HISTORY_MSG_922;Local - changes In Black and White HISTORY_MSG_CAT02PRESET;Cat02 automatic preset HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction @@ -2301,6 +2302,7 @@ TP_LOCALLAB_BLMED;Median TP_LOCALLAB_BLMETHOD_TOOLTIP;Normal - direct blur and noise with all settings.\nInverse - Inverse blur and noise without scope and without enhanced algorithm.\nSymmetric - inverse blur and noise with all settings. Be careful some results may be curious TP_LOCALLAB_BLNORM;Normal TP_LOCALLAB_BLSYM;Symmetric +TP_LOCALLAB_BLWH;All changes forced in Black and White TP_LOCALLAB_SPOTNAME;New Spot TP_LOCALLAB_BLUFR;Smooth - Blur - Grain - Denoise TP_LOCALLAB_BLUMETHOD_TOOLTIP;To blur the background and isolate the foreground:\n*Blur the background by a RT-spot fully covering the image (high values for scope and transition) - normal or inverse.\n*Isolate the foreground by one or more excluding RT-spot with the tools you want (increse scope), you can use a mask to enhance and amplify the effects.\n\nThis module can be used in additional noise reduction,including "median" and "Guided filter" diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index 93c92b5f2..9eb147fcd 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -456,6 +456,7 @@ struct local_params { float residshathr; float residhi; float residhithr; + bool blwh; }; @@ -1253,6 +1254,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.residshathr = locallab.spots.at(sp).residshathr; lp.residhi = locallab.spots.at(sp).residhi; lp.residhithr = locallab.spots.at(sp).residhithr; + lp.blwh = locallab.spots.at(sp).blwh; } @@ -6467,7 +6469,6 @@ void ImProcFunctions::transit_shapedetect2(int call, int senstype, const LabImag int bfwr = bfw; bool reduH = false; bool reduW = false; - if (lp.blurcolmask >= 0.25f && lp.fftColorMask && call == 2) { optfft(N_fftwsize, bfh, bfw, bfhr, bfwr, reduH, reduW, lp, original->H, original->W, xstart, ystart, xend, yend, cx, cy); } @@ -6739,6 +6740,10 @@ void ImProcFunctions::transit_shapedetect2(int call, int senstype, const LabImag cla = bufexpfin->a[y][x] - original->a[y + ystart][x + xstart]; clb = bufexpfin->b[y][x] - original->b[y + ystart][x + xstart]; } + if(lp.blwh) { + cla = 0.f; + clb = 0.f; + } // const float previewint = settings->previewselection; diff --git a/rtengine/procevents.h b/rtengine/procevents.h index c1df2bfd6..05f438827 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -944,6 +944,7 @@ enum ProcEventCode { Evlocallabresidhithr = 918, Evlocallabsigmalc = 919, Evlocallabsigmalc2 = 920, + Evlocallabblwh = 921, NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 522f65aa9..ac2c2d5b7 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2530,6 +2530,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : transitweak(1.0), transitgrad(0.0), avoid(false), + blwh(false), recurs(false), laplac(false), deltae(true), @@ -3642,6 +3643,7 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && transitweak == other.transitweak && transitgrad == other.transitgrad && avoid == other.avoid + && blwh == other.blwh && recurs == other.recurs && laplac == other.laplac && deltae == other.deltae @@ -5085,6 +5087,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || spot_edited->transitweak, "Locallab", "Transitweak_" + index_str, spot.transitweak, keyFile); saveToKeyfile(!pedited || spot_edited->transitgrad, "Locallab", "Transitgrad_" + index_str, spot.transitgrad, keyFile); saveToKeyfile(!pedited || spot_edited->avoid, "Locallab", "Avoid_" + index_str, spot.avoid, keyFile); + saveToKeyfile(!pedited || spot_edited->blwh, "Locallab", "Blwh_" + index_str, spot.blwh, keyFile); saveToKeyfile(!pedited || spot_edited->recurs, "Locallab", "Recurs_" + index_str, spot.recurs, keyFile); saveToKeyfile(!pedited || spot_edited->laplac, "Locallab", "Laplac_" + index_str, spot.laplac, keyFile); saveToKeyfile(!pedited || spot_edited->deltae, "Locallab", "Deltae_" + index_str, spot.deltae, keyFile); @@ -6677,6 +6680,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Transitweak_" + index_str, pedited, spot.transitweak, spotEdited.transitweak); assignFromKeyfile(keyFile, "Locallab", "Transitgrad_" + index_str, pedited, spot.transitgrad, spotEdited.transitgrad); assignFromKeyfile(keyFile, "Locallab", "Avoid_" + index_str, pedited, spot.avoid, spotEdited.avoid); + assignFromKeyfile(keyFile, "Locallab", "Blwh_" + index_str, pedited, spot.blwh, spotEdited.blwh); assignFromKeyfile(keyFile, "Locallab", "Recurs_" + index_str, pedited, spot.recurs, spotEdited.recurs); assignFromKeyfile(keyFile, "Locallab", "Laplac_" + index_str, pedited, spot.laplac, spotEdited.laplac); assignFromKeyfile(keyFile, "Locallab", "Deltae_" + index_str, pedited, spot.deltae, spotEdited.deltae); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 8441545b8..f86ba6656 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -985,6 +985,7 @@ struct LocallabParams { double transitweak; double transitgrad; bool avoid; + bool blwh; bool recurs; bool laplac; bool deltae; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 036222438..8b706cb17 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -947,7 +947,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, // Evlocallabresidhi LUMINANCECURVE, // Evlocallabresidhithr LUMINANCECURVE, // Evlocallabsigmalc - LUMINANCECURVE // Evlocallabsigmalc2 + LUMINANCECURVE, // Evlocallabsigmalc2 + LUMINANCECURVE // Evlocallabblwh }; diff --git a/rtgui/controlspotpanel.cc b/rtgui/controlspotpanel.cc index 0c1d81250..e7e4b3203 100644 --- a/rtgui/controlspotpanel.cc +++ b/rtgui/controlspotpanel.cc @@ -78,6 +78,7 @@ ControlSpotPanel::ControlSpotPanel(): lumask_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LUMASK"), 0, 30, 1, 10))), avoid_(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_AVOID")))), + blwh_(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_BLWH")))), recurs_(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_RECURS")))), laplac_(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_LAPLACC")))), deltae_(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_DELTAEC")))), @@ -357,6 +358,10 @@ ControlSpotPanel::ControlSpotPanel(): sigc::mem_fun(*this, &ControlSpotPanel::avoidChanged)); pack_start(*avoid_); + blwhConn_ = blwh_->signal_toggled().connect( + sigc::mem_fun(*this, &ControlSpotPanel::blwhChanged)); + pack_start(*blwh_); + recursConn_ = recurs_->signal_toggled().connect( sigc::mem_fun(*this, &ControlSpotPanel::recursChanged)); @@ -757,6 +762,7 @@ void ControlSpotPanel::load_ControlSpot_param() balanh_->setValue((double)row[spots_.balanh]); colorde_->setValue((double)row[spots_.colorde]); avoid_->set_active(row[spots_.avoid]); + blwh_->set_active(row[spots_.blwh]); recurs_->set_active(row[spots_.recurs]); laplac_->set_active(row[spots_.laplac]); deltae_->set_active(row[spots_.deltae]); @@ -1307,6 +1313,31 @@ void ControlSpotPanel::avoidChanged() } } +void ControlSpotPanel::blwhChanged() +{ + // printf("blwhChanged\n"); + + // Get selected control spot + const auto s = treeview_->get_selection(); + + if (!s->count_selected_rows()) { + return; + } + + const auto iter = s->get_selected(); + Gtk::TreeModel::Row row = *iter; + row[spots_.blwh] = blwh_->get_active(); + + // Raise event + if (listener) { + if (blwh_->get_active()) { + listener->panelChanged(Evlocallabblwh, M("GENERAL_ENABLED")); + } else { + listener->panelChanged(Evlocallabblwh, M("GENERAL_DISABLED")); + } + } +} + void ControlSpotPanel::recursChanged() { // printf("recursChanged\n"); @@ -1467,6 +1498,7 @@ void ControlSpotPanel::disableParamlistener(bool cond) balanh_->block(cond); colorde_->block(cond); avoidConn_.block(cond); + blwhConn_.block(cond); recursConn_.block(cond); laplacConn_.block(cond); deltaeConn_.block(cond); @@ -1506,6 +1538,7 @@ void ControlSpotPanel::setParamEditable(bool cond) balanh_->set_sensitive(cond); colorde_->set_sensitive(cond); avoid_->set_sensitive(cond); + blwh_->set_sensitive(cond); recurs_->set_sensitive(cond); laplac_->set_sensitive(cond); deltae_->set_sensitive(cond); @@ -2156,6 +2189,7 @@ ControlSpotPanel::SpotRow* ControlSpotPanel::getSpot(const int index) r->scopemask = row[spots_.scopemask]; r->lumask = row[spots_.lumask]; r->avoid = row[spots_.avoid]; + r->blwh = row[spots_.blwh]; r->recurs = row[spots_.recurs]; r->laplac = row[spots_.laplac]; r->deltae = row[spots_.deltae]; @@ -2270,6 +2304,7 @@ void ControlSpotPanel::addControlSpot(SpotRow* newSpot) row[spots_.balanh] = newSpot->balanh; row[spots_.colorde] = newSpot->colorde; row[spots_.avoid] = newSpot->avoid; + row[spots_.blwh] = newSpot->blwh; row[spots_.recurs] = newSpot->recurs; row[spots_.laplac] = newSpot->laplac; row[spots_.deltae] = newSpot->deltae; @@ -2379,6 +2414,7 @@ ControlSpotPanel::ControlSpots::ControlSpots() add(balanh); add(colorde); add(avoid); + add(blwh); add(recurs); add(laplac); add(deltae); diff --git a/rtgui/controlspotpanel.h b/rtgui/controlspotpanel.h index 0ae41e91b..02a4758c1 100644 --- a/rtgui/controlspotpanel.h +++ b/rtgui/controlspotpanel.h @@ -64,6 +64,7 @@ public: double balanh; double colorde; bool avoid; + bool blwh; bool recurs; bool laplac; bool deltae; @@ -208,6 +209,7 @@ private: void adjusterChanged(Adjuster* a, double newval); void avoidChanged(); + void blwhChanged(); void recursChanged(); void laplacChanged(); void deltaeChanged(); @@ -262,6 +264,7 @@ private: Gtk::TreeModelColumn balanh; Gtk::TreeModelColumn colorde; Gtk::TreeModelColumn avoid; + Gtk::TreeModelColumn blwh; Gtk::TreeModelColumn recurs; Gtk::TreeModelColumn laplac; Gtk::TreeModelColumn deltae; @@ -346,6 +349,8 @@ private: Gtk::CheckButton* const avoid_; sigc::connection avoidConn_; + Gtk::CheckButton* const blwh_; + sigc::connection blwhConn_; Gtk::CheckButton* const recurs_; sigc::connection recursConn_; Gtk::CheckButton* const laplac_; diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index e329bdbf9..cb13f78be 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -303,6 +303,7 @@ void Locallab::read(const rtengine::procparams::ProcParams* pp, const ParamsEdit r->balanh = pp->locallab.spots.at(i).balanh; r->colorde = pp->locallab.spots.at(i).colorde; r->avoid = pp->locallab.spots.at(i).avoid; + r->blwh = pp->locallab.spots.at(i).blwh; r->recurs = pp->locallab.spots.at(i).recurs; r->laplac = pp->locallab.spots.at(i).laplac; r->deltae = pp->locallab.spots.at(i).deltae; @@ -471,6 +472,7 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited r->balanh = newSpot->balanh; r->colorde = newSpot->colorde; r->avoid = newSpot->avoid; + r->blwh = newSpot->blwh; r->recurs = newSpot->recurs; r->laplac = newSpot->laplac; r->deltae = newSpot->deltae; @@ -755,6 +757,7 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited r->balanh = newSpot->balanh; r->colorde = newSpot->colorde; r->avoid = newSpot->avoid; + r->blwh = newSpot->blwh; r->recurs = newSpot->recurs; r->laplac = newSpot->laplac; r->deltae = newSpot->deltae; @@ -896,6 +899,7 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited pp->locallab.spots.at(pp->locallab.selspot).balanh = r->balanh; pp->locallab.spots.at(pp->locallab.selspot).colorde = r->colorde; pp->locallab.spots.at(pp->locallab.selspot).avoid = r->avoid; + pp->locallab.spots.at(pp->locallab.selspot).blwh = r->blwh; pp->locallab.spots.at(pp->locallab.selspot).recurs = r->recurs; pp->locallab.spots.at(pp->locallab.selspot).laplac = r->laplac; pp->locallab.spots.at(pp->locallab.selspot).deltae = r->deltae; diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index af45f9335..c41e89bba 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -1009,6 +1009,7 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).transitweak = locallab.spots.at(j).transitweak && pSpot.transitweak == otherSpot.transitweak; locallab.spots.at(j).transitgrad = locallab.spots.at(j).transitgrad && pSpot.transitgrad == otherSpot.transitgrad; locallab.spots.at(j).avoid = locallab.spots.at(j).avoid && pSpot.avoid == otherSpot.avoid; + locallab.spots.at(j).blwh = locallab.spots.at(j).blwh && pSpot.blwh == otherSpot.blwh; locallab.spots.at(j).recurs = locallab.spots.at(j).recurs && pSpot.recurs == otherSpot.recurs; locallab.spots.at(j).laplac = locallab.spots.at(j).laplac && pSpot.laplac == otherSpot.laplac; locallab.spots.at(j).deltae = locallab.spots.at(j).deltae && pSpot.deltae == otherSpot.deltae; @@ -3008,6 +3009,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).avoid = mods.locallab.spots.at(i).avoid; } + if (locallab.spots.at(i).blwh) { + toEdit.locallab.spots.at(i).blwh = mods.locallab.spots.at(i).blwh; + } + if (locallab.spots.at(i).recurs) { toEdit.locallab.spots.at(i).recurs = mods.locallab.spots.at(i).recurs; } @@ -5703,6 +5708,7 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : transitweak(v), transitgrad(v), avoid(v), + blwh(v), recurs(v), laplac(v), deltae(v), @@ -6140,6 +6146,7 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) transitweak = v; transitgrad = v; avoid = v; + blwh = v; recurs = v; laplac = v; deltae = v; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 5a1c40c4c..67107deca 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -413,6 +413,7 @@ public: bool transitweak; bool transitgrad; bool avoid; + bool blwh; bool recurs; bool laplac; bool deltae; From 2d517d64c62f966762a1a047ee8fd0a984f986ed Mon Sep 17 00:00:00 2001 From: Desmis Date: Sat, 2 May 2020 14:23:01 +0200 Subject: [PATCH 6/6] Added tooltip checkbox bw --- rtdata/languages/default | 1 + rtgui/controlspotpanel.cc | 3 +++ 2 files changed, 4 insertions(+) diff --git a/rtdata/languages/default b/rtdata/languages/default index b17eb315a..4a5dfe1c5 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -2303,6 +2303,7 @@ TP_LOCALLAB_BLMETHOD_TOOLTIP;Normal - direct blur and noise with all settings.\n TP_LOCALLAB_BLNORM;Normal TP_LOCALLAB_BLSYM;Symmetric TP_LOCALLAB_BLWH;All changes forced in Black and White +TP_LOCALLAB_BLWH_TOOLTIP;Force color change composante "a" and "b" to zero. TP_LOCALLAB_SPOTNAME;New Spot TP_LOCALLAB_BLUFR;Smooth - Blur - Grain - Denoise TP_LOCALLAB_BLUMETHOD_TOOLTIP;To blur the background and isolate the foreground:\n*Blur the background by a RT-spot fully covering the image (high values for scope and transition) - normal or inverse.\n*Isolate the foreground by one or more excluding RT-spot with the tools you want (increse scope), you can use a mask to enhance and amplify the effects.\n\nThis module can be used in additional noise reduction,including "median" and "Guided filter" diff --git a/rtgui/controlspotpanel.cc b/rtgui/controlspotpanel.cc index e7e4b3203..f9a532ec5 100644 --- a/rtgui/controlspotpanel.cc +++ b/rtgui/controlspotpanel.cc @@ -346,6 +346,9 @@ ControlSpotPanel::ControlSpotPanel(): if (complexsoft < 2) { artifBox->pack_start(*thresh_); } + if (showtooltip) { + blwh_->set_tooltip_text(M("TP_LOCALLAB_BLWH_TOOLTIP")); + } artifBox->pack_start(*iter_); artifBox->pack_start(*balan_);