added possibility to apply "RAW line noise filter" only in a specific direction (horizontal or vertical)

This commit is contained in:
Alberto Griggio
2018-02-28 23:37:34 +01:00
parent 34807dc7a9
commit 0bb7375a90
11 changed files with 73 additions and 8 deletions

View File

@@ -18,6 +18,7 @@
*/
#include "bayerpreprocess.h"
#include "guiutils.h"
#include "eventmapper.h"
#include <sstream>
using namespace rtengine;
@@ -25,6 +26,9 @@ using namespace rtengine::procparams;
BayerPreProcess::BayerPreProcess () : FoldableToolPanel(this, "bayerpreprocess", M("TP_PREPROCESS_LABEL"), true)
{
auto m = ProcEventMapper::getInstance();
EvLineDenoiseDirection = m->newEvent(DARKFRAME, "HISTORY_MSG_PREPROCESS_LINEDENOISE_DIRECTION");
lineDenoise = Gtk::manage(new Adjuster (M("TP_PREPROCESS_LINEDENOISE"), 0, 1000, 1, 0));
lineDenoise->setAdjusterListener (this);
@@ -43,7 +47,19 @@ BayerPreProcess::BayerPreProcess () : FoldableToolPanel(this, "bayerpreprocess",
greenEqThreshold->show();
Gtk::HBox *hb = Gtk::manage(new Gtk::HBox());
hb->pack_start(*Gtk::manage(new Gtk::Label(M("TP_PREPROCESS_LINEDENOISE_DIRECTION") + ": ")), Gtk::PACK_SHRINK, 0);
lineDenoiseDirection = Gtk::manage(new MyComboBoxText());
lineDenoiseDirection->append(M("TP_PREPROCESS_LINEDENOISE_DIRECTION_HORIZONTAL"));
lineDenoiseDirection->append(M("TP_PREPROCESS_LINEDENOISE_DIRECTION_VERTICAL"));
lineDenoiseDirection->append(M("TP_PREPROCESS_LINEDENOISE_DIRECTION_BOTH"));
lineDenoiseDirection->show();
lineDenoiseDirection->signal_changed().connect(sigc::mem_fun(*this, &BayerPreProcess::lineDenoiseDirectionChanged));
hb->pack_start(*lineDenoiseDirection);
pack_start( *lineDenoise, Gtk::PACK_SHRINK, 4);
pack_start(*hb, Gtk::PACK_SHRINK, 4);
pack_start( *Gtk::manage (new Gtk::HSeparator()));
@@ -58,9 +74,13 @@ void BayerPreProcess::read(const rtengine::procparams::ProcParams* pp, const Par
if(pedited ) {
lineDenoise->setEditedState( pedited->raw.bayersensor.linenoise ? Edited : UnEdited );
greenEqThreshold->setEditedState( pedited->raw.bayersensor.greenEq ? Edited : UnEdited );
if (!pedited->raw.bayersensor.linenoiseDirection) {
lineDenoiseDirection->set_active(3);
}
}
lineDenoise->setValue (pp->raw.bayersensor.linenoise);
lineDenoiseDirection->set_active(int(pp->raw.bayersensor.linenoiseDirection)-1);
greenEqThreshold->setValue (pp->raw.bayersensor.greenthresh);
enableListener ();
@@ -69,11 +89,13 @@ void BayerPreProcess::read(const rtengine::procparams::ProcParams* pp, const Par
void BayerPreProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pedited)
{
pp->raw.bayersensor.linenoise = lineDenoise->getIntValue();
pp->raw.bayersensor.linenoiseDirection = RAWParams::BayerSensor::LineNoiseDirection(lineDenoiseDirection->get_active_row_number() + 1);
pp->raw.bayersensor.greenthresh = greenEqThreshold->getIntValue();
if (pedited) {
pedited->raw.bayersensor.linenoise = lineDenoise->getEditedState ();
pedited->raw.bayersensor.greenEq = greenEqThreshold->getEditedState ();
pedited->raw.bayersensor.linenoise = lineDenoiseDirection->get_active_row_number() != 3;
}
}
@@ -96,6 +118,9 @@ void BayerPreProcess::setBatchMode(bool batchMode)
ToolPanel::setBatchMode (batchMode);
lineDenoise->showEditedCB ();
greenEqThreshold->showEditedCB ();
if (batchMode) {
lineDenoiseDirection->append(M("GENERAL_UNCHANGED"));
}
}
void BayerPreProcess::setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited)
@@ -125,3 +150,11 @@ void BayerPreProcess::trimValues (rtengine::procparams::ProcParams* pp)
lineDenoise->trimValue(pp->raw.bayersensor.linenoise);
greenEqThreshold->trimValue(pp->raw.bayersensor.greenthresh);
}
void BayerPreProcess::lineDenoiseDirectionChanged()
{
if (listener) {
listener->panelChanged(EvLineDenoiseDirection, lineDenoiseDirection->get_active_text());
}
}