Add checkbox Retinex Dehaze

This commit is contained in:
Desmis 2019-09-22 18:27:29 +02:00
parent 363cfab749
commit ce78605a18
10 changed files with 61 additions and 7 deletions

View File

@ -988,6 +988,7 @@ HISTORY_MSG_747;Local Spot created
HISTORY_MSG_748;Local - Exp Denoise
HISTORY_MSG_749;Local - Reti Depth
HISTORY_MSG_750;Local - Reti Mode log - lin
HISTORY_MSG_751;Local - Reti Dehaze luminance
HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors
HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction
HISTORY_MSG_COLORTONING_LABREGION_AB;CT - Color correction
@ -2103,6 +2104,7 @@ TP_LOCALLAB_THRESRETI;Threshold
TP_LOCALLAB_DENOIS;Denoise
TP_LOCALLAB_DEHAZ;Strength Dehaze
TP_LOCALLAB_DEPTH;Dehaze depth
TP_LOCALLAB_LUMONLY;Dehaze Luminance only
TP_LOCALLAB_EXPMETHOD_TOOLTIP;Standard : use an algorithm similar as main Exposure but in L*a*b* and taking account of deltaE.\n\nLaplacian & PDE : use another algorithm also with deltaE and with Poisson equation to solve Laplacian in Fourier space.\nPDE Ipol, PDE Fattal and Standard can be combined.\nFFTW Fourier Transform is optimized in size to reduce processing time.\nPDE reduce artifacts and noise.
TP_LOCALLAB_PDEFRAME_TOOLTIP;PDE Ipol - personal algorithm adapted from Ipol to Rawtherapee: lead to very different results and needs differents settings that Standard (negative black, gamma < 1,...)\nMay be usefull for low exposure.\n
TP_LOCALLAB_FATFRAME_TOOLTIP;PDE Fattal - use Fattal Tone mapping algorithm.\nAnchor allows selection according to the images over or under exposed.\nUseful to increase Luminance for a Second spot near the current and using mask

View File

@ -8726,8 +8726,8 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
for (int jr = 0; jr < bfw; jr++) {
buflight[ir][jr] /= coef;
bufl_ab[ir][jr] /= coefC;
if (lp.str >= 0.1f) {
if(params->locallab.spots.at(sp).lumonly) {
// if (lp.str >= 0.1f) {
bufl_ab[ir][jr] = 0.f;
}
}

View File

@ -777,6 +777,7 @@ enum ProcEventCode {
EvlocallabexnoiseMethod = 747,
Evlocallabdepth = 748,
Evlocallabloglin = 749,
Evlocallablumonly = 750,
NUMOFEVENTS
};

View File

@ -2589,6 +2589,7 @@ LocallabParams::LocallabSpot::LocallabSpot() :
inversret(false),
equilret(true),
loglin(false),
lumonly(false),
softradiusret(0.0),
CCmaskreticurve{(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 },
LLmaskreticurve{(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},
@ -2852,6 +2853,7 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const
&& inversret == other.inversret
&& equilret == other.equilret
&& loglin == other.loglin
&& lumonly == other.lumonly
&& softradiusret == other.softradiusret
&& CCmaskreticurve == other.CCmaskreticurve
&& LLmaskreticurve == other.LLmaskreticurve
@ -4098,6 +4100,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo
saveToKeyfile(!pedited || pedited->locallab.spots.at(i).inversret, "Locallab", "Inversret_" + std::to_string(i), spot.inversret, keyFile);
saveToKeyfile(!pedited || pedited->locallab.spots.at(i).equilret, "Locallab", "Equilret_" + std::to_string(i), spot.equilret, keyFile);
saveToKeyfile(!pedited || pedited->locallab.spots.at(i).loglin, "Locallab", "Loglin_" + std::to_string(i), spot.loglin, keyFile);
saveToKeyfile(!pedited || pedited->locallab.spots.at(i).lumonly, "Locallab", "Lumonly_" + std::to_string(i), spot.lumonly, keyFile);
saveToKeyfile(!pedited || pedited->locallab.spots.at(i).softradiusret, "Locallab", "Softradiusret_" + std::to_string(i), spot.softradiusret, keyFile);
saveToKeyfile(!pedited || pedited->locallab.spots.at(i).CCmaskreticurve, "Locallab", "CCmaskretiCurve_" + std::to_string(i), spot.CCmaskreticurve, keyFile);
saveToKeyfile(!pedited || pedited->locallab.spots.at(i).LLmaskreticurve, "Locallab", "LLmaskretiCurve_" + std::to_string(i), spot.LLmaskreticurve, keyFile);
@ -5474,6 +5477,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited)
assignFromKeyfile(keyFile, "Locallab", "Inversret_" + std::to_string(i), pedited, spot.inversret, spotEdited.inversret);
assignFromKeyfile(keyFile, "Locallab", "Equilret_" + std::to_string(i), pedited, spot.equilret, spotEdited.equilret);
assignFromKeyfile(keyFile, "Locallab", "Loglin_" + std::to_string(i), pedited, spot.loglin, spotEdited.loglin);
assignFromKeyfile(keyFile, "Locallab", "Lumonly_" + std::to_string(i), pedited, spot.lumonly, spotEdited.lumonly);
assignFromKeyfile(keyFile, "Locallab", "Softradiusret_" + std::to_string(i), pedited, spot.softradiusret, spotEdited.softradiusret);
assignFromKeyfile(keyFile, "Locallab", "CCmaskretiCurve_" + std::to_string(i), pedited, spot.CCmaskreticurve, spotEdited.CCmaskreticurve);
assignFromKeyfile(keyFile, "Locallab", "LLmaskretiCurve_" + std::to_string(i), pedited, spot.LLmaskreticurve, spotEdited.LLmaskreticurve);

View File

@ -1138,6 +1138,7 @@ struct LocallabParams {
bool inversret;
bool equilret;
bool loglin;
bool lumonly;
double softradiusret;
std::vector<double> CCmaskreticurve;
std::vector<double> LLmaskreticurve;

View File

@ -776,7 +776,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = {
LUMINANCECURVE, //EvlocallabSpotCreated
LUMINANCECURVE, // EvlocallabexnoiseMethod
LUMINANCECURVE, // Evlocallabdepth
LUMINANCECURVE // Evlocallabloglin
LUMINANCECURVE, // Evlocallabloglin
LUMINANCECURVE // Evlocallablumonly
};

View File

@ -354,6 +354,7 @@ Locallab::Locallab():
equilret(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_EQUIL")))),
inversret(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_INVERS")))),
loglin(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_LOGLIN")))),
lumonly(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_LUMONLY")))),
enaretiMask(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ENABLE_MASK")))),
enaretiMasktmap(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_TM_MASK")))),
fftwreti(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_FFTW")))),
@ -1320,9 +1321,9 @@ Locallab::Locallab():
str->setAdjusterListener(this);
if (showtooltip) {
str->set_tooltip_text(M("TP_LOCALLAB_STRRETI_TOOLTIP"));
}
// if (showtooltip) {
// str->set_tooltip_text(M("TP_LOCALLAB_STRRETI_TOOLTIP"));
// }
neigh->setAdjusterListener(this);
@ -1367,6 +1368,7 @@ Locallab::Locallab():
inversretConn = inversret->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::inversretChanged));
equilretConn = equilret->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::equilretChanged));
loglinConn = loglin->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::loglinChanged));
lumonlyConn = lumonly->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::lumonlyChanged));
maskretiCurveEditorG->setCurveListener(this);
@ -1446,6 +1448,7 @@ Locallab::Locallab():
ToolParamBlock* const dehaBox = Gtk::manage(new ToolParamBlock());
dehaBox->pack_start(*dehaz);
dehaBox->pack_start(*depth);
dehaBox->pack_start(*lumonly);
dehaBox->pack_start(*str);
expreti->add(*dehaBox, false);
@ -3043,6 +3046,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited)
pp->locallab.spots.at(pp->locallab.selspot).softradiusret = softradiusret->getValue();
pp->locallab.spots.at(pp->locallab.selspot).equilret = equilret->get_active();
pp->locallab.spots.at(pp->locallab.selspot).loglin = loglin->get_active();
pp->locallab.spots.at(pp->locallab.selspot).lumonly = lumonly->get_active();
pp->locallab.spots.at(pp->locallab.selspot).LLmaskreticurve = LLmaskretishape->getCurve();
pp->locallab.spots.at(pp->locallab.selspot).CCmaskreticurve = CCmaskretishape->getCurve();
pp->locallab.spots.at(pp->locallab.selspot).HHmaskreticurve = HHmaskretishape->getCurve();
@ -3313,6 +3317,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited)
pe->locallab.spots.at(pp->locallab.selspot).inversret = pe->locallab.spots.at(pp->locallab.selspot).inversret || !inversret->get_inconsistent();
pe->locallab.spots.at(pp->locallab.selspot).equilret = pe->locallab.spots.at(pp->locallab.selspot).equilret || !equilret->get_inconsistent();
pe->locallab.spots.at(pp->locallab.selspot).loglin = pe->locallab.spots.at(pp->locallab.selspot).loglin || !loglin->get_inconsistent();
pe->locallab.spots.at(pp->locallab.selspot).lumonly = pe->locallab.spots.at(pp->locallab.selspot).lumonly || !lumonly->get_inconsistent();
pe->locallab.spots.at(pp->locallab.selspot).softradiusret = pe->locallab.spots.at(pp->locallab.selspot).softradiusret || softradiusret->getEditedState();
pe->locallab.spots.at(pp->locallab.selspot).CCmaskreticurve = pe->locallab.spots.at(pp->locallab.selspot).CCmaskreticurve || !CCmaskretishape->isUnChanged();
pe->locallab.spots.at(pp->locallab.selspot).LLmaskreticurve = pe->locallab.spots.at(pp->locallab.selspot).LLmaskreticurve || !LLmaskretishape->isUnChanged();
@ -3582,6 +3587,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited)
pedited->locallab.spots.at(pp->locallab.selspot).inversret = pedited->locallab.spots.at(pp->locallab.selspot).inversret || !inversret->get_inconsistent();
pedited->locallab.spots.at(pp->locallab.selspot).equilret = pedited->locallab.spots.at(pp->locallab.selspot).equilret || !equilret->get_inconsistent();
pedited->locallab.spots.at(pp->locallab.selspot).loglin = pedited->locallab.spots.at(pp->locallab.selspot).loglin || !loglin->get_inconsistent();
pedited->locallab.spots.at(pp->locallab.selspot).lumonly = pedited->locallab.spots.at(pp->locallab.selspot).lumonly || !lumonly->get_inconsistent();
pedited->locallab.spots.at(pp->locallab.selspot).softradiusret = pedited->locallab.spots.at(pp->locallab.selspot).softradiusret || softradiusret->getEditedState();
pedited->locallab.spots.at(pp->locallab.selspot).CCmaskreticurve = pedited->locallab.spots.at(pp->locallab.selspot).CCmaskreticurve || !CCmaskretishape->isUnChanged();
pedited->locallab.spots.at(pp->locallab.selspot).LLmaskreticurve = pedited->locallab.spots.at(pp->locallab.selspot).LLmaskreticurve || !LLmaskretishape->isUnChanged();
@ -5096,6 +5102,30 @@ void Locallab::loglinChanged()
}
}
void Locallab::lumonlyChanged()
{
if (multiImage) {
if (lumonly->get_inconsistent()) {
lumonly->set_inconsistent(false);
lumonlyConn.block(true);
lumonly->set_active(false);
lumonlyConn.block(false);
}
}
if (getEnabled() && expreti->getEnabled()) {
if (listener) {
if (lumonly->get_active()) {
listener->panelChanged(Evlocallablumonly, M("GENERAL_ENABLED"));
} else {
listener->panelChanged(Evlocallablumonly, M("GENERAL_DISABLED"));
}
}
}
}
void Locallab::inversretChanged()
{
@ -6284,7 +6314,7 @@ void Locallab::adjusterChanged(Adjuster * a, double newval)
// Retinex
if (getEnabled() && expreti->getEnabled()) {
if (a == str) {
if (str->getValue() >= 0.2f) {
if (str->getValue() >= 0.1f) {
retiBox->show();
} else {
retiBox->hide();
@ -7086,6 +7116,7 @@ void Locallab::enableListener()
inversretConn.block(false);
equilretConn.block(false);
loglinConn.block(false);
lumonlyConn.block(false);
enaretiMaskConn.block(false);
enaretiMasktmapConn.block(false);
showmaskretiMethodConn.block(false);
@ -7161,6 +7192,7 @@ void Locallab::disableListener()
inversretConn.block(true);
equilretConn.block(true);
loglinConn.block(true);
lumonlyConn.block(true);
enaretiMaskConn.block(true);
enaretiMasktmapConn.block(true);
showmaskretiMethodConn.block(true);
@ -7427,6 +7459,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con
inversret->set_active(pp->locallab.spots.at(index).inversret);
equilret->set_active(pp->locallab.spots.at(index).equilret);
loglin->set_active(pp->locallab.spots.at(index).loglin);
lumonly->set_active(pp->locallab.spots.at(index).lumonly);
softradiusret->setValue(pp->locallab.spots.at(index).softradiusret);
CCmaskretishape->setCurve(pp->locallab.spots.at(index).CCmaskreticurve);
LLmaskretishape->setCurve(pp->locallab.spots.at(index).LLmaskreticurve);
@ -7748,6 +7781,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con
inversret->set_inconsistent(multiImage && !spotState->inversret);
equilret->set_inconsistent(multiImage && !spotState->equilret);
loglin->set_inconsistent(multiImage && !spotState->loglin);
lumonly->set_inconsistent(multiImage && !spotState->lumonly);
softradiusret->setEditedState(spotState->softradiusret ? Edited : UnEdited);
CCmaskretishape->setUnChanged(!spotState->CCmaskreticurve);
LLmaskretishape->setUnChanged(!spotState->LLmaskreticurve);

View File

@ -319,6 +319,8 @@ private:
sigc::connection inversretConn;
Gtk::CheckButton* const loglin;
sigc::connection loglinConn;
Gtk::CheckButton* const lumonly;
sigc::connection lumonlyConn;
Gtk::CheckButton* const enaretiMask;
sigc::connection enaretiMaskConn;
Gtk::CheckButton* const enaretiMasktmap;
@ -454,6 +456,7 @@ private:
// Retinex
void equilretChanged();
void loglinChanged();
void lumonlyChanged();
void inversretChanged();
void enaretiMaskChanged();
void enaretiMasktmapChanged();

View File

@ -1129,6 +1129,7 @@ void ParamsEdited::initFrom(const std::vector<rtengine::procparams::ProcParams>&
locallab.spots.at(j).inversret = locallab.spots.at(j).inversret && pSpot.inversret == otherSpot.inversret;
locallab.spots.at(j).equilret = locallab.spots.at(j).equilret && pSpot.equilret == otherSpot.equilret;
locallab.spots.at(j).loglin = locallab.spots.at(j).loglin && pSpot.loglin == otherSpot.loglin;
locallab.spots.at(j).lumonly = locallab.spots.at(j).lumonly && pSpot.lumonly == otherSpot.lumonly;
locallab.spots.at(j).softradiusret = locallab.spots.at(j).softradiusret && pSpot.softradiusret == otherSpot.softradiusret;
locallab.spots.at(j).CCmaskreticurve = locallab.spots.at(j).CCmaskreticurve && pSpot.CCmaskreticurve == otherSpot.CCmaskreticurve;
locallab.spots.at(j).LLmaskreticurve = locallab.spots.at(j).LLmaskreticurve && pSpot.LLmaskreticurve == otherSpot.LLmaskreticurve;
@ -3367,6 +3368,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng
toEdit.locallab.spots.at(i).loglin = mods.locallab.spots.at(i).loglin;
}
if (locallab.spots.at(i).lumonly) {
toEdit.locallab.spots.at(i).lumonly = mods.locallab.spots.at(i).lumonly;
}
if (locallab.spots.at(i).CCmaskreticurve) {
toEdit.locallab.spots.at(i).CCmaskreticurve = mods.locallab.spots.at(i).CCmaskreticurve;
}
@ -4797,6 +4802,7 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) :
inversret(v),
equilret(v),
loglin(v),
lumonly(v),
softradiusret(v),
CCmaskreticurve(v),
LLmaskreticurve(v),
@ -5057,6 +5063,7 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v)
inversret = v;
equilret = v;
loglin = v;
lumonly = v;
softradiusret = v;
CCmaskreticurve = v;
LLmaskreticurve = v;

View File

@ -548,6 +548,7 @@ public:
bool inversret;
bool equilret;
bool loglin;
bool lumonly;
bool softradiusret;
bool CCmaskreticurve;
bool LLmaskreticurve;