Added a threshold slider to the impulse NR tool. Large values can cause cratering, but otherwise this should be a good precursor to pyramid denoising.

This commit is contained in:
Emil Martinec
2010-09-14 00:08:23 -05:00
parent da0faec489
commit 1820978df4
15 changed files with 169 additions and 41 deletions

View File

@@ -29,14 +29,14 @@ ImpulseDenoise::ImpulseDenoise () : ToolPanel() {
enabled = Gtk::manage (new Gtk::CheckButton (M("GENERAL_ENABLED")));
enabled->set_active (false);
//amount = Gtk::manage (new Adjuster (M("TP_DETAIL_AMOUNT"), 1, 100, 1, 30));
thresh = Gtk::manage (new Adjuster (M("TP_DETAIL_AMOUNT"), 0, 100, 1, 10));
pack_start (*enabled);
pack_start (*Gtk::manage (new Gtk::HSeparator()));
//pack_start (*amount);
pack_start (*thresh);
enaConn = enabled->signal_toggled().connect( sigc::mem_fun(*this, &ImpulseDenoise::enabledChanged) );
//amount->setAdjusterListener (this);
thresh->setAdjusterListener (this);
show_all_children ();
}
@@ -46,7 +46,7 @@ void ImpulseDenoise::read (const ProcParams* pp, const ParamsEdited* pedited) {
disableListener ();
if (pedited) {
//amount->setEditedState (pedited->impulseDenoise.amount ? Edited : UnEdited);
thresh->setEditedState (pedited->impulseDenoise.thresh ? Edited : UnEdited);
enabled->set_inconsistent (!pedited->impulseDenoise.enabled);
}
@@ -56,39 +56,39 @@ void ImpulseDenoise::read (const ProcParams* pp, const ParamsEdited* pedited) {
lastEnabled = pp->impulseDenoise.enabled;
//amount->setValue (pp->impulseDenoise.amount);
thresh->setValue (pp->impulseDenoise.thresh);
enableListener ();
}
void ImpulseDenoise::write (ProcParams* pp, ParamsEdited* pedited) {
//pp->impulseDenoise.amount = amount->getValue ();
pp->impulseDenoise.thresh = thresh->getValue ();
pp->impulseDenoise.enabled = enabled->get_active();
if (pedited) {
//pedited->impulseDenoise.amount = amount->getEditedState ();
pedited->impulseDenoise.thresh = thresh->getEditedState ();
pedited->impulseDenoise.enabled = !enabled->get_inconsistent();
}
}
void ImpulseDenoise::setDefaults (const ProcParams* defParams, const ParamsEdited* pedited) {
//amount->setDefault (defParams->impulseDenoise.amount);
thresh->setDefault (defParams->impulseDenoise.thresh);
/*if (pedited)
amount->setDefaultEditedState (pedited->impulseDenoise.amount ? Edited : UnEdited);
if (pedited)
thresh->setDefaultEditedState (pedited->impulseDenoise.thresh ? Edited : UnEdited);
else
amount->setDefaultEditedState (Irrelevant);*/
thresh->setDefaultEditedState (Irrelevant);
}
/*void ImpulseDenoise::adjusterChanged (Adjuster* a, double newval) {
void ImpulseDenoise::adjusterChanged (Adjuster* a, double newval) {
if (listener && enabled->get_active()) {
listener->panelChanged (EvCDNRadius, Glib::ustring::format (std::setw(2), std::fixed, std::setprecision(1), a->getValue()));
}
}*/
}
void ImpulseDenoise::enabledChanged () {
@@ -116,5 +116,5 @@ void ImpulseDenoise::enabledChanged () {
void ImpulseDenoise::setBatchMode (bool batchMode) {
ToolPanel::setBatchMode (batchMode);
//amount->showEditedCB ();
thresh->showEditedCB ();
}

View File

@@ -23,10 +23,10 @@
#include <adjuster.h>
#include <toolpanel.h>
class ImpulseDenoise : public Gtk::VBox, /*public AdjusterListener,*/ public ToolPanel {
class ImpulseDenoise : public Gtk::VBox, public AdjusterListener, public ToolPanel {
protected:
//Adjuster* radius;
Adjuster* thresh;
//Adjuster* edge;
Gtk::CheckButton* enabled;
bool lastEnabled;
@@ -42,10 +42,10 @@ class ImpulseDenoise : public Gtk::VBox, /*public AdjusterListener,*/ public Too
void setDefaults (const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited=NULL);
void setBatchMode (bool batchMode);
//void adjusterChanged (Adjuster* a, double newval);
void adjusterChanged (Adjuster* a, double newval);
void enabledChanged ();
//void setAdjusterBehavior (bool bedgetoladd);
void setAdjusterBehavior (bool bedgetoladd);
};
#endif

View File

@@ -69,6 +69,10 @@ void ParamsEdited::set (bool v) {
colorDenoise.enabled = v;
colorDenoise.amount = v;
impulseDenoise.enabled = v;
<<<<<<< local
impulseDenoise.thresh = v;
=======
>>>>>>> other
dirpyrDenoise.enabled = v;
dirpyrDenoise.luma = v;
dirpyrDenoise.chroma = v;
@@ -186,6 +190,10 @@ void ParamsEdited::initFrom (const std::vector<rtengine::procparams::ProcParams>
colorDenoise.amount = colorDenoise.amount && p.colorDenoise.amount == other.colorDenoise.amount;
impulseDenoise.enabled = impulseDenoise.enabled && p.impulseDenoise.enabled == other.impulseDenoise.enabled;
<<<<<<< local
impulseDenoise.thresh = impulseDenoise.thresh && p.impulseDenoise.thresh == other.impulseDenoise.thresh;
=======
>>>>>>> other
dirpyrDenoise.enabled = dirpyrDenoise.enabled && p.dirpyrDenoise.enabled == other.dirpyrDenoise.enabled;
dirpyrDenoise.luma = dirpyrDenoise.luma && p.dirpyrDenoise.luma == other.dirpyrDenoise.luma;
@@ -295,6 +303,10 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten
if (colorDenoise.amount) toEdit.colorDenoise.amount = mods.colorDenoise.amount;
if (impulseDenoise.enabled) toEdit.impulseDenoise.enabled = mods.impulseDenoise.enabled;
<<<<<<< local
if (impulseDenoise.thresh) toEdit.impulseDenoise.thresh = mods.impulseDenoise.thresh;
=======
>>>>>>> other
if (dirpyrDenoise.enabled) toEdit.dirpyrDenoise.enabled = mods.dirpyrDenoise.enabled;
if (dirpyrDenoise.luma) toEdit.dirpyrDenoise.luma = mods.dirpyrDenoise.luma;

View File

@@ -109,6 +109,10 @@ class ImpulseDenoiseParamsEdited {
public:
bool enabled;
<<<<<<< local
bool thresh;
=======
>>>>>>> other
};
class DirPyrDenoiseParamsEdited {