Improve Retinex with Normalize luminance

This commit is contained in:
Desmis
2019-06-08 14:02:59 +02:00
parent c0a4e4c11b
commit 3a2d0c4dc6
10 changed files with 88 additions and 4 deletions

View File

@@ -153,7 +153,7 @@ Locallab::Locallab():
str(Gtk::manage(new Adjuster(M("TP_LOCALLAB_STR"), 0., 100., 0.1, 0.0))),
chrrt(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHRRT"), 0.0, 100.0, 0.1, 0.0))),
neigh(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NEIGH"), 4., 500., 0.5, 50.))),
vart(Gtk::manage(new Adjuster(M("TP_LOCALLAB_VART"), 10.0, 500., 0.1, 70.))),
vart(Gtk::manage(new Adjuster(M("TP_LOCALLAB_VART"), 4.0, 500., 0.1, 70.))),
dehaz(Gtk::manage(new Adjuster(M("TP_LOCALLAB_DEHAZ"), 0, 100, 1, 0))),
sensih(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSIH"), 0, 100, 1, 30))),
softradiusret(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GUIDFILTER"), 0.0, 100.0, 0.1, 0.))),
@@ -225,6 +225,7 @@ Locallab::Locallab():
// Blur & Noise
activlum(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ACTIV")))),
// Retinex
equilret(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_EQUIL")))),
inversret(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_INVERS")))),
enaretiMask(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ENABLE_MASK")))),
enaretiMasktmap(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_TM_MASK")))),
@@ -880,6 +881,7 @@ Locallab::Locallab():
LocalcurveEditorgainT->curveListComplete();
inversretConn = inversret->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::inversretChanged));
equilretConn = equilret->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::equilretChanged));
maskretiCurveEditorG->setCurveListener(this);
@@ -943,6 +945,7 @@ Locallab::Locallab():
ToolParamBlock* const retiBox = Gtk::manage(new ToolParamBlock());
retiBox->pack_start(*retinexMethod);
retiBox->pack_start(*equilret);
retiBox->pack_start(*str);
retiBox->pack_start(*chrrt);
retiBox->pack_start(*neigh);
@@ -2159,6 +2162,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited)
pp->locallab.spots.at(pp->locallab.selspot).localTgaincurve = cTgainshape->getCurve();
pp->locallab.spots.at(pp->locallab.selspot).inversret = inversret->get_active();
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).LLmaskreticurve = LLmaskretishape->getCurve();
pp->locallab.spots.at(pp->locallab.selspot).CCmaskreticurve = CCmaskretishape->getCurve();
@@ -2376,6 +2380,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited)
pe->locallab.spots.at(pp->locallab.selspot).sensih = pe->locallab.spots.at(pp->locallab.selspot).sensih || sensih->getEditedState();
pe->locallab.spots.at(pp->locallab.selspot).localTgaincurve = pe->locallab.spots.at(pp->locallab.selspot).localTgaincurve || !cTgainshape->isUnChanged();
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).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();
@@ -2597,6 +2602,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited)
pedited->locallab.spots.at(pp->locallab.selspot).sensih = pedited->locallab.spots.at(pp->locallab.selspot).sensih || sensih->getEditedState();
pedited->locallab.spots.at(pp->locallab.selspot).localTgaincurve = pedited->locallab.spots.at(pp->locallab.selspot).localTgaincurve || !cTgainshape->isUnChanged();
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).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();
@@ -3491,6 +3497,33 @@ void Locallab::inversshaChanged()
}
}
void Locallab::equilretChanged()
{
// printf("inversretChanged\n");
if (multiImage) {
if (equilret->get_inconsistent()) {
equilret->set_inconsistent(false);
equilretConn.block(true);
equilret->set_active(false);
equilretConn.block(false);
}
}
if (getEnabled() && expreti->getEnabled()) {
if (listener) {
if (inversret->get_active()) {
listener->panelChanged(Evlocallabequilret, M("GENERAL_ENABLED"));
} else {
listener->panelChanged(Evlocallabequilret, M("GENERAL_DISABLED"));
}
}
}
}
void Locallab::inversretChanged()
{
// printf("inversretChanged\n");
@@ -5138,6 +5171,7 @@ void Locallab::enableListener()
enableretiConn.block(false);
retinexMethodConn.block(false);
inversretConn.block(false);
equilretConn.block(false);
enaretiMaskConn.block(false);
enaretiMasktmapConn.block(false);
showmaskretiMethodConn.block(false);
@@ -5195,6 +5229,7 @@ void Locallab::disableListener()
enableretiConn.block(true);
retinexMethodConn.block(true);
inversretConn.block(true);
equilretConn.block(true);
enaretiMaskConn.block(true);
enaretiMasktmapConn.block(true);
showmaskretiMethodConn.block(true);
@@ -5380,6 +5415,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con
sensih->setValue(pp->locallab.spots.at(index).sensih);
cTgainshape->setCurve(pp->locallab.spots.at(index).localTgaincurve);
inversret->set_active(pp->locallab.spots.at(index).inversret);
equilret->set_active(pp->locallab.spots.at(index).equilret);
softradiusret->setValue(pp->locallab.spots.at(index).softradiusret);
CCmaskretishape->setCurve(pp->locallab.spots.at(index).CCmaskreticurve);
LLmaskretishape->setCurve(pp->locallab.spots.at(index).LLmaskreticurve);
@@ -5633,6 +5669,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con
sensih->setEditedState(spotState->sensih ? Edited : UnEdited);
cTgainshape->setUnChanged(!spotState->localTgaincurve);
inversret->set_inconsistent(multiImage && !spotState->inversret);
equilret->set_inconsistent(multiImage && !spotState->equilret);
softradiusret->setEditedState(spotState->softradiusret ? Edited : UnEdited);
CCmaskretishape->setUnChanged(!spotState->CCmaskreticurve);
LLmaskretishape->setUnChanged(!spotState->LLmaskreticurve);