Add blur shape detection to Shadows Highlight

This commit is contained in:
Desmis 2019-03-11 13:23:10 +01:00
parent bb0a415925
commit d11eb995de
10 changed files with 44 additions and 2 deletions

View File

@ -893,6 +893,7 @@ HISTORY_MSG_639;Local - SH Mask H
HISTORY_MSG_640;Local - SH blend
HISTORY_MSG_641;Local - Use SH mask
HISTORY_MSG_642;Local - radius SH
HISTORY_MSG_643;Local - Blur SH
HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors
HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction
HISTORY_MSG_COLORTONING_LABREGION_AB;CT - Color correction

View File

@ -152,6 +152,7 @@ struct local_params {
float struexp;
float blurexp;
float blurcol;
float blurSH;
float ligh;
float lowA, lowB, highA, highB;
int shamo, shdamp, shiter, senssha, sensv;
@ -486,6 +487,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall
float structexpo = (float) locallab.spots.at(sp).structexp;
float blurexpo = (float) locallab.spots.at(sp).blurexpde;
float blurcolor = (float) locallab.spots.at(sp).blurcolde;
float blurSH = (float) locallab.spots.at(sp).blurSHde;
int local_transit = locallab.spots.at(sp).transit;
double radius = locallab.spots.at(sp).radius;
double sharradius = ((double) locallab.spots.at(sp).sharradius);
@ -540,6 +542,7 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall
lp.struexp = structexpo;
lp.blurexp = blurexpo;
lp.blurcol = blurcolor;
lp.blurSH = blurSH;
lp.sens = local_sensi;
lp.sensh = local_sensih;
lp.dehaze = local_dehaze;
@ -3397,6 +3400,11 @@ void ImProcFunctions::transit_shapedetect(int senstype, LabImage * bufexporig, L
radius = (2.f + 0.2f * lp.blurcol) / sk;
}
if (senstype == 9)
{
radius = (2.f + 0.2f * lp.blurSH) / sk;
}
bool usemask = (lp.showmaskexpmet == 2 || lp.enaExpMask) && senstype == 1;
bool usemaskcol = (lp.showmaskcolmet == 2 || lp.enaColorMask) && senstype == 0;
bool usemaskSH = (lp.showmaskSHmet == 2 || lp.enaSHMask) && senstype == 9;

View File

@ -669,6 +669,7 @@ enum ProcEventCode {
EvlocallabblendmaskSH = 639,
EvLocallabEnaSHMask = 640,
EvlocallabradmaskSH = 641,
EvlocallabblurSHde = 642,
NUMOFEVENTS
};

View File

@ -2418,6 +2418,7 @@ LocallabParams::LocallabSpot::LocallabSpot() :
HHmaskSHcurve{(double)FCT_MinMaxCPoints, 0.0, 1.0, 0.35, 0.35, 0.50, 1.0, 0.35, 0.35, 1.0, 1.0, 0.35, 0.35},
blendmaskSH(0),
radmaskSH(10.0),
blurSHde(5),
// Vibrance
expvibrance(false),
saturated(0),
@ -2583,6 +2584,7 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const
&& HHmaskSHcurve == other.HHmaskSHcurve
&& blendmaskSH == other.blendmaskSH
&& radmaskSH == other.radmaskSH
&& blurSHde == other.blurSHde
// Vibrance
&& expvibrance == other.expvibrance
&& saturated == other.saturated
@ -3705,6 +3707,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo
saveToKeyfile(!pedited || pedited->locallab.spots.at(i).HHmaskSHcurve, "Locallab", "HHmaskSHCurve_" + std::to_string(i), spot.HHmaskSHcurve, keyFile);
saveToKeyfile(!pedited || pedited->locallab.spots.at(i).blendmaskSH, "Locallab", "BlendmaskSH_" + std::to_string(i), spot.blendmaskSH, keyFile);
saveToKeyfile(!pedited || pedited->locallab.spots.at(i).radmaskSH, "Locallab", "RadmaskSH_" + std::to_string(i), spot.radmaskSH, keyFile);
saveToKeyfile(!pedited || pedited->locallab.spots.at(i).blurSHde, "Locallab", "BlurSHde_" + std::to_string(i), spot.blurSHde, keyFile);
// Vibrance
saveToKeyfile(!pedited || pedited->locallab.spots.at(i).expvibrance, "Locallab", "Expvibrance_" + std::to_string(i), spot.expvibrance, keyFile);
saveToKeyfile(!pedited || pedited->locallab.spots.at(i).saturated, "Locallab", "Saturated_" + std::to_string(i), spot.saturated, keyFile);
@ -4955,6 +4958,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited)
assignFromKeyfile(keyFile, "Locallab", "HHmaskSHCurve_" + std::to_string(i), pedited, spot.HHmaskSHcurve, spotEdited.HHmaskSHcurve);
assignFromKeyfile(keyFile, "Locallab", "BlendmaskSH_" + std::to_string(i), pedited, spot.blendmaskSH, spotEdited.blendmaskSH);
assignFromKeyfile(keyFile, "Locallab", "RadmaskSH_" + std::to_string(i), pedited, spot.radmaskSH, spotEdited.radmaskSH);
assignFromKeyfile(keyFile, "Locallab", "BlurSHde_" + std::to_string(i), pedited, spot.blurSHde, spotEdited.blurSHde);
// Vibrance
assignFromKeyfile(keyFile, "Locallab", "Expvibrance_" + std::to_string(i), pedited, spot.expvibrance, spotEdited.expvibrance);
assignFromKeyfile(keyFile, "Locallab", "Saturated_" + std::to_string(i), pedited, spot.saturated, spotEdited.saturated);

View File

@ -1019,6 +1019,7 @@ struct LocallabParams {
std::vector<double> HHmaskSHcurve;
int blendmaskSH;
double radmaskSH;
int blurSHde;
// Vibrance
bool expvibrance;
int saturated;

View File

@ -668,8 +668,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = {
LUMINANCECURVE, //EvlocallabHHmaskSHshape
LUMINANCECURVE, //EvlocallabblendmaskSH
LUMINANCECURVE, //EvLocallabEnaSHMask
LUMINANCECURVE //EvlocallabradmaskSH
LUMINANCECURVE, //EvlocallabradmaskSH
LUMINANCECURVE //EvlocallabblurSHde
};

View File

@ -108,6 +108,7 @@ Locallab::Locallab():
sensihs(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 0, 100, 1, 15))),
blendmaskSH(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLENDMASKCOL"), -100, 100, 1, 0))),
radmaskSH(Gtk::manage(new Adjuster(M("TP_LOCALLAB_RADMASKCOL"), 0.0, 100.0, 0.1, 10.))),
blurSHde(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLURDE"), 2, 100, 1, 5))),
// Vibrance
saturated(Gtk::manage(new Adjuster(M("TP_VIBRANCE_SATURATED"), -100., 100., 1., 0.))),
pastels(Gtk::manage(new Adjuster(M("TP_VIBRANCE_PASTELS"), -100., 100., 1., 0.))),
@ -527,6 +528,7 @@ Locallab::Locallab():
sensihs->setAdjusterListener(this);
blendmaskSH->setAdjusterListener(this);
radmaskSH->setAdjusterListener(this);
blurSHde->setAdjusterListener(this);
enaSHMaskConn = enaSHMask->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::enaSHMaskChanged));
@ -570,6 +572,7 @@ Locallab::Locallab():
shadhighBox->pack_start(*s_tonalwidth);
shadhighBox->pack_start(*sh_radius);
shadhighBox->pack_start(*sensihs);
shadhighBox->pack_start(*blurSHde);
maskSHFrame->set_label_align(0.025, 0.5);
ToolParamBlock* const maskSHBox = Gtk::manage(new ToolParamBlock());
@ -1705,6 +1708,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited)
pp->locallab.spots.at(pp->locallab.selspot).HHmaskSHcurve = HHmaskSHshape->getCurve();
pp->locallab.spots.at(pp->locallab.selspot).blendmaskSH = blendmaskSH->getIntValue();
pp->locallab.spots.at(pp->locallab.selspot).radmaskSH = radmaskSH->getValue();
pp->locallab.spots.at(pp->locallab.selspot).blurSHde = blurSHde->getIntValue();
// Vibrance
pp->locallab.spots.at(pp->locallab.selspot).expvibrance = expvibrance->getEnabled();
@ -1887,6 +1891,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited)
pe->locallab.spots.at(pp->locallab.selspot).HHmaskSHcurve = pe->locallab.spots.at(pp->locallab.selspot).HHmaskSHcurve || !HHmaskSHshape->isUnChanged();
pe->locallab.spots.at(pp->locallab.selspot).blendmaskSH = pe->locallab.spots.at(pp->locallab.selspot).blendmaskSH || blendmaskSH->getEditedState();
pe->locallab.spots.at(pp->locallab.selspot).radmaskSH = pe->locallab.spots.at(pp->locallab.selspot).radmaskSH || radmaskSH->getEditedState();
pe->locallab.spots.at(pp->locallab.selspot).blurSHde = pe->locallab.spots.at(pp->locallab.selspot).blurSHde || blurSHde->getEditedState();
// Vibrance
pe->locallab.spots.at(pp->locallab.selspot).expvibrance = pe->locallab.spots.at(pp->locallab.selspot).expvibrance || !expvibrance->get_inconsistent();
pe->locallab.spots.at(pp->locallab.selspot).saturated = pe->locallab.spots.at(pp->locallab.selspot).saturated || saturated->getEditedState();
@ -2054,6 +2059,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited)
pedited->locallab.spots.at(pp->locallab.selspot).HHmaskSHcurve = pedited->locallab.spots.at(pp->locallab.selspot).HHmaskSHcurve || !HHmaskSHshape->isUnChanged();
pedited->locallab.spots.at(pp->locallab.selspot).blendmaskSH = pedited->locallab.spots.at(pp->locallab.selspot).blendmaskSH || blendmaskSH->getEditedState();
pedited->locallab.spots.at(pp->locallab.selspot).radmaskSH = pedited->locallab.spots.at(pp->locallab.selspot).radmaskSH || radmaskSH->getEditedState();
pedited->locallab.spots.at(pp->locallab.selspot).blurSHde = pedited->locallab.spots.at(pp->locallab.selspot).blurSHde || blurSHde->getEditedState();
// Vibrance
pedited->locallab.spots.at(pp->locallab.selspot).expvibrance = pedited->locallab.spots.at(pp->locallab.selspot).expvibrance || !expvibrance->get_inconsistent();
pedited->locallab.spots.at(pp->locallab.selspot).saturated = pedited->locallab.spots.at(pp->locallab.selspot).saturated || saturated->getEditedState();
@ -2883,6 +2889,7 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe
sensihs->setDefault((double)defSpot->sensihs);
blendmaskSH->setDefault((double)defSpot->blendmaskSH);
radmaskSH->setDefault(defSpot->radmaskSH);
blurSHde->setDefault((double)defSpot->blurSHde);
// Vibrance
saturated->setDefault((double)defSpot->saturated);
pastels->setDefault((double)defSpot->pastels);
@ -2979,6 +2986,7 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe
sensihs->setDefaultEditedState(Irrelevant);
blendmaskSH->setDefaultEditedState(Irrelevant);
radmaskSH->setDefaultEditedState(Irrelevant);
blurSHde->setDefaultEditedState(Irrelevant);
// Vibrance
saturated->setDefaultEditedState(Irrelevant);
pastels->setDefaultEditedState(Irrelevant);
@ -3079,6 +3087,7 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe
sensihs->setDefaultEditedState(defSpotState->sensihs ? Edited : UnEdited);
blendmaskSH->setDefaultEditedState(defSpotState->blendmaskSH ? Edited : UnEdited);
radmaskSH->setDefaultEditedState(defSpotState->radmaskSH ? Edited : UnEdited);
blurSHde->setDefaultEditedState(defSpotState->blurSHde ? Edited : UnEdited);
// Vibrance
saturated->setDefaultEditedState(defSpotState->saturated ? Edited : UnEdited);
pastels->setDefaultEditedState(defSpotState->pastels ? Edited : UnEdited);
@ -3374,6 +3383,12 @@ void Locallab::adjusterChanged(Adjuster * a, double newval)
}
}
if (a == blurSHde) {
if (listener) {
listener->panelChanged(EvlocallabblurSHde, blurSHde->getTextValue());
}
}
}
@ -3776,6 +3791,7 @@ void Locallab::setBatchMode(bool batchMode)
sensihs->showEditedCB();
blendmaskSH->showEditedCB();
radmaskSH->showEditedCB();
blurSHde->showEditedCB();
// Vibrance
saturated->showEditedCB();
pastels->showEditedCB();
@ -4156,6 +4172,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con
HHmaskSHshape->setCurve(pp->locallab.spots.at(index).HHmaskSHcurve);
blendmaskSH->setValue(pp->locallab.spots.at(index).blendmaskSH);
radmaskSH->setValue(pp->locallab.spots.at(index).radmaskSH);
blurSHde->setValue(pp->locallab.spots.at(index).blurSHde);
// Vibrance
expvibrance->setEnabled(pp->locallab.spots.at(index).expvibrance);
saturated->setValue(pp->locallab.spots.at(index).saturated);
@ -4366,6 +4383,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con
HHmaskSHshape->setUnChanged(!spotState->HHmaskSHcurve);
blendmaskSH->setEditedState(spotState->blendmaskSH ? Edited : UnEdited);
radmaskSH->setEditedState(spotState->radmaskSH ? Edited : UnEdited);
blurSHde->setEditedState(spotState->blurSHde ? Edited : UnEdited);
// Vibrance
expvibrance->set_inconsistent(!spotState->expvibrance);

View File

@ -126,6 +126,7 @@ private:
Adjuster* const sensihs;
Adjuster* const blendmaskSH;
Adjuster* const radmaskSH;
Adjuster* const blurSHde;
// Vibrance
Adjuster* const saturated;
Adjuster* const pastels;

View File

@ -1003,6 +1003,7 @@ void ParamsEdited::initFrom(const std::vector<rtengine::procparams::ProcParams>&
locallab.spots.at(j).HHmaskSHcurve = locallab.spots.at(j).HHmaskSHcurve && pSpot.HHmaskSHcurve == otherSpot.HHmaskSHcurve;
locallab.spots.at(j).blendmaskSH = locallab.spots.at(j).blendmaskSH && pSpot.blendmaskSH == otherSpot.blendmaskSH;
locallab.spots.at(j).radmaskSH = locallab.spots.at(j).radmaskSH && pSpot.radmaskSH == otherSpot.radmaskSH;
locallab.spots.at(j).blurSHde = locallab.spots.at(j).blurSHde && pSpot.blurSHde == otherSpot.blurSHde;
// Vibrance
locallab.spots.at(j).expvibrance = locallab.spots.at(j).expvibrance && pSpot.expvibrance == otherSpot.expvibrance;
locallab.spots.at(j).saturated = locallab.spots.at(j).saturated && pSpot.saturated == otherSpot.saturated;
@ -2817,6 +2818,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng
toEdit.locallab.spots.at(i).radmaskSH = mods.locallab.spots.at(i).radmaskSH;
}
if (locallab.spots.at(i).blurSHde) {
toEdit.locallab.spots.at(i).blurSHde = mods.locallab.spots.at(i).blurSHde;
}
// Vibrance
if (locallab.spots.at(i).expvibrance) {
toEdit.locallab.spots.at(i).expvibrance = mods.locallab.spots.at(i).expvibrance;
@ -4118,6 +4123,7 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) :
HHmaskSHcurve(v),
blendmaskSH(v),
radmaskSH(v),
blurSHde(v),
// Vibrance
expvibrance(v),
saturated(v),
@ -4280,6 +4286,7 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v)
HHmaskSHcurve = v;
blendmaskSH = v;
radmaskSH = v;
blurSHde = v;
// Vibrance
expvibrance = v;
saturated = v;

View File

@ -542,6 +542,7 @@ public:
bool HHmaskSHcurve;
bool blendmaskSH;
bool radmaskSH;
bool blurSHde;
// Vibrance
bool expvibrance;
bool saturated;