Added experimental hsl mode for DeHaze (with still incomplete gui)

This commit is contained in:
heckflosse
2015-09-09 12:22:25 +02:00
parent d8945607d5
commit 6cdc6e1fe4
10 changed files with 121 additions and 10 deletions

View File

@@ -44,7 +44,18 @@ Dehaz::Dehaz () : FoldableToolPanel(this, "dehaz", M("TP_DEHAZ_LABEL"), false, t
dehazmet->set_active(0);
dehazmetConn = dehazmet->signal_changed().connect ( sigc::mem_fun(*this, &Dehaz::dehazmetChanged) );
dehazmet->set_tooltip_markup (M("TP_DEHAZ_MET_TOOLTIP"));
dehazcolorspace = Gtk::manage (new MyComboBoxText ());
dehazcolorspace->append_text (M("TP_DEHAZ_LABSAPCE"));
dehazcolorspace->append_text (M("TP_DEHAZ_HSLSPACE"));
dehazcolorspace->set_active(0);
dehazmetConn = dehazcolorspace->signal_changed().connect ( sigc::mem_fun(*this, &Dehaz::dehazColorSpaceChanged) );
dehazcolorspace->set_tooltip_markup (M("TP_DEHAZ_COLORSPACE_TOOLTIP"));
dhbox->pack_start(*dehazmet);
dhbox->pack_start(*dehazcolorspace);
dehazVBox->pack_start(*dhbox);
std::vector<double> defaultCurve;
@@ -266,6 +277,10 @@ void Dehaz::read (const ProcParams* pp, const ParamsEdited* pedited)
dehazmet->set_active_text(M("GENERAL_UNCHANGED"));
}
if (!pedited->dehaz.dehazcolorspace) {
dehazcolorspace->set_active_text(M("GENERAL_UNCHANGED"));
}
cdshape->setUnChanged (!pedited->dehaz.cdcurve);
transmissionShape->setUnChanged (!pedited->dehaz.transmissionCurve);
@@ -301,6 +316,14 @@ void Dehaz::read (const ProcParams* pp, const ParamsEdited* pedited)
}
dehazmetChanged ();
if (pp->dehaz.dehazcolorspace == "Lab") {
dehazcolorspace->set_active (0);
} else if (pp->dehaz.dehazcolorspace == "HSL") {
dehazcolorspace->set_active (1);
}
dehazColorSpaceChanged();
retinexConn.block(false);
retinexChanged ();
retinexConn.block(false);
@@ -311,6 +334,7 @@ void Dehaz::read (const ProcParams* pp, const ParamsEdited* pedited)
cdshape->setCurve (pp->dehaz.cdcurve);
dehazmetConn.block(false);
dehazColorSpaceConn.block(false);
transmissionShape->setCurve (pp->dehaz.transmissionCurve);
@@ -367,6 +391,7 @@ void Dehaz::write (ProcParams* pp, ParamsEdited* pedited)
if (pedited) {
pedited->dehaz.dehazmet = dehazmet->get_active_text() != M("GENERAL_UNCHANGED");
pedited->dehaz.dehazcolorspace = dehazcolorspace->get_active_text() != M("GENERAL_UNCHANGED");
//%%%%%%%%%%%%%%%%%%%%%%
pedited->dehaz.str = str->getEditedState ();
@@ -391,6 +416,12 @@ void Dehaz::write (ProcParams* pp, ParamsEdited* pedited)
} else if (dehazmet->get_active_row_number() == 2) {
pp->dehaz.dehazmet = "high";
}
if (dehazcolorspace->get_active_row_number() == 0) {
pp->dehaz.dehazcolorspace = "Lab";
} else if (dehazcolorspace->get_active_row_number() == 1) {
pp->dehaz.dehazcolorspace = "HSL";
}
}
void Dehaz::dehazmetChanged()
@@ -400,6 +431,13 @@ void Dehaz::dehazmetChanged()
}
}
void Dehaz::dehazColorSpaceChanged()
{
if (listener) {
listener->panelChanged (EvdehazColorSpace, dehazcolorspace->get_active_text ());
}
}
void Dehaz::retinexChanged ()
{
if (batchMode) {

View File

@@ -31,6 +31,7 @@ protected:
Gtk::Label* labmdh;
Gtk::HBox* dhbox;
MyComboBoxText* dehazmet;
MyComboBoxText* dehazcolorspace;
Gtk::CheckButton* retinex;
Gtk::Frame* dehazFrame;
Gtk::CheckButton* medianmap;
@@ -49,6 +50,7 @@ protected:
DiagonalCurveEditor* cdshape;
CurveEditorGroup* transmissionCurveEditorG;
sigc::connection dehazmetConn;
sigc::connection dehazColorSpaceConn;
FlatCurveEditor* transmissionShape;
bool lastretinex, lastmedianmap;
sigc::connection retinexConn, medianmapConn;
@@ -75,6 +77,7 @@ public:
void enabledChanged ();
void curveChanged (CurveEditor* ce);
void dehazmetChanged();
void dehazColorSpaceChanged();
void retinexUpdateUI();
};

View File

@@ -51,6 +51,7 @@ void ParamsEdited::set (bool v)
toneCurve.method = v;
dehaz.cdcurve = v;
dehaz.dehazmet = v;
dehaz.dehazcolorspace = v;
dehaz.enabled = v;
dehaz.str = v;
dehaz.scal = v;
@@ -520,6 +521,7 @@ void ParamsEdited::initFrom (const std::vector<rtengine::procparams::ProcParams>
dehaz.cdcurve = dehaz.cdcurve && p.dehaz.cdcurve == other.dehaz.cdcurve;
dehaz.transmissionCurve = dehaz.transmissionCurve && p.dehaz.transmissionCurve == other.dehaz.transmissionCurve;
dehaz.dehazmet = dehaz.dehazmet && p.dehaz.dehazmet == other.dehaz.dehazmet;
dehaz.dehazcolorspace = dehaz.dehazcolorspace && p.dehaz.dehazcolorspace == other.dehaz.dehazcolorspace;
dehaz.str = dehaz.str && p.dehaz.str == other.dehaz.str;
dehaz.scal = dehaz.scal && p.dehaz.scal == other.dehaz.scal;
dehaz.neigh = dehaz.neigh && p.dehaz.neigh == other.dehaz.neigh;
@@ -1037,6 +1039,10 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten
toEdit.dehaz.dehazmet = mods.dehaz.dehazmet;
}
if (dehaz.dehazcolorspace) {
toEdit.dehaz.dehazcolorspace = mods.dehaz.dehazcolorspace;
}
if (dehaz.str) {
toEdit.dehaz.str = mods.dehaz.str;
}

View File

@@ -65,6 +65,7 @@ public:
bool gain;
bool offs;
bool dehazmet;
bool dehazcolorspace;
bool vart;
bool limd;
bool method;