pixelshift: cleaned gui

This commit is contained in:
heckflosse 2017-01-18 19:36:35 +01:00
parent 4ecdf8dca9
commit 70415fdfe5
11 changed files with 206 additions and 53 deletions

View File

@ -700,6 +700,7 @@ HISTORY_MSG_465;EvPixelShiftSum
HISTORY_MSG_466;EvPixelShiftExp0
HISTORY_MSG_467;EvPixelShiftHoleFill
HISTORY_MSG_468;EvPixelShiftMedian
HISTORY_MSG_469;EvPixelShiftMotionMethod
HISTORY_NEWSNAPSHOT;Add
HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: <b>Alt-s</b>
HISTORY_SNAPSHOT;Snapshot
@ -1700,6 +1701,7 @@ TP_RAW_PIXELSHIFTSHOWMOTION_TOOLTIP;Overlays the image with a mask showing the r
TP_RAW_PIXELSHIFTSHOWMOTIONMASKONLY_TOOLTIP;Shows the motion mask without the image
TP_RAW_PIXELSHIFTMOTIONCORRECTION;Green motion correction size
TP_RAW_PIXELSHIFTMOTIONCORRECTION_TOOLTIP;1 = 2 pixels\n3 = 3x3 grid\n5 = 5x5 grid
TP_RAW_PIXELSHIFTMOTIONMETHOD;Motion Correction
TP_RAW_PIXELSHIFTSHOWMOTION;Show motion
TP_RAW_PIXELSHIFTSHOWMOTIONMASKONLY;Show mask only
TP_RAW_PIXELSHIFTSTDDEVFACTORGREEN;StdDev factor Green

View File

@ -31,6 +31,7 @@
#include "../rtgui/multilangmgr.h"
#include "procparams.h"
#include "gauss.h"
#include "median.h"
#define BENCHMARK
#include "StopWatch.h"
@ -1162,9 +1163,11 @@ void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, const RA
}
// now that the temporary planes are filled for easy access we do the motion detection
int sum0 = 0;
int sum1 = 0;
float pixelcount = ((winh - (border + offsY) - (winy + border - offsY)) * (winw - (border + offsX) - (winx + border - offsX))) / 2.f;
#ifdef _OPENMP
#pragma omp parallel for schedule(dynamic,16)
#pragma omp parallel for reduction(+:sum0,sum1) schedule(dynamic,16)
#endif
for(int i = winy + border - offsY; i < winh - (border + offsY); ++i) {
@ -1338,6 +1341,12 @@ void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, const RA
}
if (gridMax > thresh - korr) {
if(offset == 0) {
sum0 ++;
} else {
sum1 ++;
}
if(nOf3x3) {
psMask[i][j] = 1.f;
} else if((offset == (frame & 1)) && checkNonGreenVertical) {
@ -1357,7 +1366,6 @@ void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, const RA
j++;
paintMotionMask(j + offsX, showMotion, (gridMax - thresh + korr) * blendFactor, showOnlyMask, greenDest, redDest, blueDest);
}
// do not set the motion pixel values. They have already been set by demosaicer or showMotion
continue;
}
@ -1547,6 +1555,20 @@ void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, const RA
}
if(adaptive && experimental0) { // for experiments
// float green1Median, green2Median;
// green1Median = median(psG1[ i - 1 ][ j - 1 ],psG1[ i - 1 ][ j + 1 ],psG1[ i ][ j ],psG1[ i + 1 ][ j -1 ],psG1[ i + 1 ][ j + 1 ]);
// green2Median = median(psG2[ i - 1 ][ j - 1 ],psG2[ i - 1 ][ j + 1 ],psG2[ i ][ j ],psG2[ i + 1 ][ j -1 ],psG2[ i + 1 ][ j + 1 ]);
// float greenDiffMedian = nonGreenDiff(green1Median, green2Median, stddevFactorGreen * 0.36f, eperIsoGreen, nRead, prnu, showMotion);
//
// if(greenDiffMedian > 0.f) {
// if(nOf3x3) {
// psMask[i][j] = 1.f;
// } else {
// paintMotionMask(j + offsX, showMotion, greenDiffMedian, showOnlyMask, greenDest, redDest, blueDest);
// }
//
// continue;
// }
}
@ -1561,6 +1583,11 @@ void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, const RA
}
}
float percent0 = 100.f * sum0 / pixelcount;
float percent1 = 100.f * sum1 / pixelcount;
std::cout << fileName << " : Green detections at stddev " << std::setprecision( 2 ) << bayerParams.pixelShiftStddevFactorGreen << " : Frame 1/3 : " << std::setprecision( 6 ) << sum0 << " (" << percent0 << "%)" << " Frame 2/4 : " << sum1 << " (" << percent1 << "%)" << std::endl;
if(adaptive && nOf3x3) {
if(blurMap) {
#pragma omp parallel
@ -1622,6 +1649,11 @@ void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, const RA
if(showMotion && showOnlyMask) { // we want only motion mask => paint areas without motion in pure black
red[i + offsY][j + offsX] = green[i + offsY][j + offsX] = blue[i + offsY][j + offsX] = 0.f;
} else {
if(blurMap && experimental0) {
red[i + offsY][j + offsX] = intp(psMask[i][j], red[i + offsY][j + offsX], psRed[i][j] );
green[i + offsY][j + offsX] = intp(psMask[i][j],green[i + offsY][j + offsX],(psG1[i][j] + psG2[i][j]) / 2.f);
blue[i + offsY][j + offsX] = intp(psMask[i][j],blue[i + offsY][j + offsX], psBlue[i][j]);
} else {
red[i + offsY][j + offsX] = psRed[i][j];
green[i + offsY][j + offsX] = (psG1[i][j] + psG2[i][j]) / 2.f;
@ -1630,6 +1662,7 @@ void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, const RA
}
}
}
}
if(plistener) {
plistener->setProgress(1.0);

View File

@ -496,6 +496,7 @@ enum ProcEvent {
EvPixelShiftHoleFill = 466,
EvPixelShiftMedian = 467,
EvPixelShiftMedian3 = 468,
EvPixelShiftMotionMethod = 469,
NUMOFEVENTS
};

View File

@ -875,6 +875,33 @@ void CoarseTransformParams::setDefaults()
hflip = false;
vflip = false;
}
void RAWParams::BayerSensor::setPixelShiftDefaults()
{
pixelShiftMotion = 0;
pixelShiftMotionCorrection = RAWParams::BayerSensor::Grid3x3New;
pixelShiftMotionCorrectionMethod = RAWParams::BayerSensor::Automatic;
pixelShiftStddevFactorGreen = 5.0;
pixelShiftStddevFactorRed = 5.0;
pixelShiftStddevFactorBlue = 5.0;
pixelShiftEperIso = 0.0;
pixelShiftNreadIso = 0.0;
pixelShiftPrnu = 1.0;
pixelShiftSigma = 1.0;
pixelShiftSum = 3.0;
pixelShiftRedBlueWeight = 0.7;
pixelShiftAutomatic = true;
pixelShiftNonGreenHorizontal = false;
pixelShiftNonGreenVertical = false;
pixelShiftHoleFill = true;
pixelShiftMedian = false;
pixelShiftMedian3 = false;
pixelShiftGreen = true;
pixelShiftBlur = true;
pixelShiftExp0 = false;
pixelShiftNonGreenCross = true;
pixelShiftNonGreenCross2 = false;
pixelShiftNonGreenAmaze = false;
}
void RAWParams::setDefaults()
{
@ -887,6 +914,7 @@ void RAWParams::setDefaults()
bayersensor.lmmse_iterations = 2;
bayersensor.pixelShiftMotion = 0;
bayersensor.pixelShiftMotionCorrection = RAWParams::BayerSensor::Grid3x3New;
bayersensor.pixelShiftMotionCorrectionMethod = RAWParams::BayerSensor::Automatic;
bayersensor.pixelShiftStddevFactorGreen = 5.0;
bayersensor.pixelShiftStddevFactorRed = 5.0;
bayersensor.pixelShiftStddevFactorBlue = 5.0;
@ -939,6 +967,10 @@ void RAWParams::setDefaults()
hotPixelFilter = false;
deadPixelFilter = false;
hotdeadpix_thresh = 100;
bayersensor.setPixelShiftDefaults();
bayersensor.pixelshiftShowMotion = false;
bayersensor.pixelshiftShowMotionMaskOnly = false;
}
void ColorManagementParams::setDefaults()
@ -3397,6 +3429,10 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b
keyFile.set_integer ("RAW Bayer", "PixelShiftMotionCorrection", raw.bayersensor.pixelShiftMotionCorrection );
}
if (!pedited || pedited->raw.bayersensor.pixelShiftMotionCorrectionMethod) {
keyFile.set_integer ("RAW Bayer", "PixelShiftMotionCorrectionMethod", raw.bayersensor.pixelShiftMotionCorrectionMethod );
}
if (!pedited || pedited->raw.bayersensor.pixelShiftStddevFactorGreen) {
keyFile.set_double ("RAW Bayer", "pixelShiftStddevFactorGreen", raw.bayersensor.pixelShiftStddevFactorGreen );
}
@ -7561,6 +7597,14 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited)
}
}
if (keyFile.has_key ("RAW Bayer", "PixelShiftMotionCorrectionMethod")) {
raw.bayersensor.pixelShiftMotionCorrectionMethod = (RAWParams::BayerSensor::ePSMotionCorrectionMethod)keyFile.get_integer("RAW Bayer", "PixelShiftMotionCorrectionMethod");
if (pedited) {
pedited->raw.bayersensor.pixelShiftMotionCorrectionMethod = true;
}
}
if (keyFile.has_key ("RAW Bayer", "pixelShiftStddevFactorGreen")) {
raw.bayersensor.pixelShiftStddevFactorGreen = keyFile.get_double("RAW Bayer", "pixelShiftStddevFactorGreen");
@ -8184,6 +8228,7 @@ bool ProcParams::operator== (const ProcParams& other)
&& raw.bayersensor.lmmse_iterations == other.raw.bayersensor.lmmse_iterations
&& raw.bayersensor.pixelShiftMotion == other.raw.bayersensor.pixelShiftMotion
&& raw.bayersensor.pixelShiftMotionCorrection == other.raw.bayersensor.pixelShiftMotionCorrection
&& raw.bayersensor.pixelShiftMotionCorrectionMethod == other.raw.bayersensor.pixelShiftMotionCorrectionMethod
&& raw.bayersensor.pixelShiftStddevFactorGreen == other.raw.bayersensor.pixelShiftStddevFactorGreen
&& raw.bayersensor.pixelShiftStddevFactorRed == other.raw.bayersensor.pixelShiftStddevFactorRed
&& raw.bayersensor.pixelShiftStddevFactorBlue == other.raw.bayersensor.pixelShiftStddevFactorBlue

View File

@ -1190,6 +1190,9 @@ public:
enum ePSMotionCorrection {
Grid1x1, Grid1x2, Grid3x3, Grid5x5, Grid7x7, Grid3x3New
};
enum ePSMotionCorrectionMethod {
Off, Automatic, Custom
};
static const char *methodstring[numMethods];
Glib::ustring method;
@ -1206,6 +1209,7 @@ public:
int lmmse_iterations;
int pixelShiftMotion;
ePSMotionCorrection pixelShiftMotionCorrection;
ePSMotionCorrectionMethod pixelShiftMotionCorrectionMethod;
double pixelShiftStddevFactorGreen;
double pixelShiftStddevFactorRed;
double pixelShiftStddevFactorBlue;
@ -1231,6 +1235,9 @@ public:
bool pixelShiftNonGreenAmaze;
bool dcb_enhance;
//bool all_enhance;
void setPixelShiftDefaults();
};
/**

View File

@ -2027,10 +2027,18 @@ void RawImageSource::demosaic(const RAWParams &raw)
if(numFrames != 4) { // fallback for non pixelshift files
amaze_demosaic_RT (0, 0, W, H, rawData, red, green, blue);
} else {
if(!raw.bayersensor.pixelshiftShowMotion || raw.bayersensor.pixelShiftNonGreenAmaze || raw.bayersensor.pixelShiftNonGreenCross2) {
if((raw.bayersensor.pixelShiftMotion > 0 || raw.bayersensor.pixelShiftAutomatic) && numFrames == 4) {
if(raw.bayersensor.pixelShiftMedian) { // We need the amaze demosaiced frames for motion correction
if(!raw.bayersensor.pixelShiftMedian3) {
RAWParams::BayerSensor bayerParams = raw.bayersensor;
if(bayerParams.pixelShiftMotionCorrectionMethod == RAWParams::BayerSensor::Automatic) {
bayerParams.setPixelShiftDefaults();
} else if(bayerParams.pixelShiftMotionCorrectionMethod == RAWParams::BayerSensor::Off) {
bayerParams.pixelShiftMotion = 0;
bayerParams.pixelShiftAutomatic = false;
bayerParams.pixelshiftShowMotion = false;
}
if(!bayerParams.pixelshiftShowMotion || bayerParams.pixelShiftNonGreenAmaze || bayerParams.pixelShiftNonGreenCross2 || (bayerParams.pixelShiftBlur && bayerParams.pixelShiftExp0)) {
if((bayerParams.pixelShiftMotion > 0 || bayerParams.pixelShiftAutomatic) && numFrames == 4) {
if(bayerParams.pixelShiftMedian) { // We need the amaze demosaiced frames for motion correction
if(!bayerParams.pixelShiftMedian3) {
amaze_demosaic_RT (0, 0, W, H, *(rawDataFrames[0]), red, green, blue);
multi_array2D<float,3> redTmp(W,H);
multi_array2D<float,3> greenTmp(W,H);
@ -2122,7 +2130,7 @@ void RawImageSource::demosaic(const RAWParams &raw)
amaze_demosaic_RT (0, 0, W, H, rawData, red, green, blue); // for non pixelshift files use amaze if pixelshift is selected. We need it also for motion correction
}
}
pixelshift(0, 0, W, H, raw.bayersensor, raw.bayersensor.pixelShiftExp0 ? 0: currFrame, ri->get_model(), raw.expos);
pixelshift(0, 0, W, H, bayerParams, currFrame, ri->get_model(), raw.expos);
}
} else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::dcb] ) {
dcb_demosaic(raw.bayersensor.dcb_iterations, raw.bayersensor.dcb_enhance);

View File

@ -495,7 +495,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = {
DEMOSAIC, // EvPixelShiftExp0
DEMOSAIC, // EvPixelShiftHoleFill
DEMOSAIC, // EvPixelShiftMedian
DEMOSAIC // EvPixelShiftMedian3
DEMOSAIC, // EvPixelShiftMedian3
DEMOSAIC // EvPixelShiftMotionMethod
};

View File

@ -50,6 +50,18 @@ BayerProcess::BayerProcess () : FoldableToolPanel(this, "bayerprocess", M("TP_RA
imageNumberBox->pack_end (*imageNumber, Gtk::PACK_EXPAND_WIDGET, 4);
pack_start( *imageNumberBox, Gtk::PACK_SHRINK, 4);
pack_start( *Gtk::manage( new Gtk::HSeparator()), Gtk::PACK_SHRINK, 0 );
ccSteps = Gtk::manage (new Adjuster (M("TP_RAW_FALSECOLOR"), 0, 5, 1, 0 ));
ccSteps->setAdjusterListener (this);
if (ccSteps->delay < options.adjusterMaxDelay) {
ccSteps->delay = options.adjusterMaxDelay;
}
ccSteps->show();
pack_start( *ccSteps, Gtk::PACK_SHRINK, 4);
dcbOptions = Gtk::manage (new Gtk::VBox ());
dcbOptions->set_border_width(4);
@ -81,16 +93,30 @@ BayerProcess::BayerProcess () : FoldableToolPanel(this, "bayerprocess", M("TP_RA
lmmseOptions->pack_start(*lmmseIterations);
pack_start( *lmmseOptions, Gtk::PACK_SHRINK, 4);
pixelShiftFrame = Gtk::manage (new Gtk::VBox ());
pixelShiftFrame->set_border_width(0);
Gtk::HBox* hb3 = Gtk::manage (new Gtk::HBox ());
hb3->pack_start (*Gtk::manage (new Gtk::Label ( M("TP_RAW_PIXELSHIFTMOTIONMETHOD") + ": ")), Gtk::PACK_SHRINK, 4);
pixelShiftMotionMethod = Gtk::manage (new MyComboBoxText ());
pixelShiftMotionMethod->append_text("Off");
pixelShiftMotionMethod->append_text("Automatic");
pixelShiftMotionMethod->append_text("Custom");
pixelShiftMotionMethod->set_active(1);
pixelShiftMotionMethod->show();
hb3->pack_start(*pixelShiftMotionMethod);
pixelShiftFrame->pack_start(*hb3);
pixelShiftOptions = Gtk::manage (new Gtk::VBox ());
pixelShiftOptions->set_border_width(4);
pixelShiftOptions->set_border_width(0);
pixelShiftShowMotion = Gtk::manage (new Gtk::CheckButton(M("TP_RAW_PIXELSHIFTSHOWMOTION")));
pixelShiftShowMotion->set_tooltip_text (M("TP_RAW_PIXELSHIFTSHOWMOTION_TOOLTIP"));
pixelShiftOptions->pack_start(*pixelShiftShowMotion);
pixelShiftFrame->pack_start(*pixelShiftShowMotion);
pixelShiftShowMotionMaskOnly = Gtk::manage (new Gtk::CheckButton(M("TP_RAW_PIXELSHIFTSHOWMOTIONMASKONLY")));
pixelShiftShowMotionMaskOnly->set_tooltip_text (M("TP_RAW_PIXELSHIFTSHOWMOTIONMASKONLY_TOOLTIP"));
pixelShiftOptions->pack_start(*pixelShiftShowMotionMaskOnly);
pixelShiftFrame->pack_start(*pixelShiftShowMotionMaskOnly);
pixelShiftAutomatic = Gtk::manage (new Gtk::CheckButton(M("TP_RAW_PIXELSHIFTADAPTIVE")));
pixelShiftOptions->pack_start(*pixelShiftAutomatic);
@ -142,8 +168,9 @@ BayerProcess::BayerProcess () : FoldableToolPanel(this, "bayerprocess", M("TP_RA
pixelShiftMotion->show();
pixelShiftOptions->pack_start(*pixelShiftMotion);
Gtk::HBox* hb2 = Gtk::manage (new Gtk::HBox ());
hb2->pack_start (*Gtk::manage (new Gtk::Label ( M("TP_RAW_PIXELSHIFTMOTIONCORRECTION") + ": ")), Gtk::PACK_SHRINK, 4);
hb2->pack_start (*Gtk::manage (new Gtk::Label ( M("TP_RAW_PIXELSHIFTMOTIONCORRECTION") + ": ")), Gtk::PACK_SHRINK, 0);
pixelShiftMotionCorrection = Gtk::manage (new MyComboBoxText ());
pixelShiftMotionCorrection->append_text("1x1");
pixelShiftMotionCorrection->append_text("1x2");
@ -152,7 +179,6 @@ BayerProcess::BayerProcess () : FoldableToolPanel(this, "bayerprocess", M("TP_RA
pixelShiftMotionCorrection->append_text("7x7");
pixelShiftMotionCorrection->append_text("3x3 new");
pixelShiftMotionCorrection->set_active(0);
// pixelShiftMotionCorrection->set_tooltip_markup (M("TP_RAW_PIXELSHIFTMOTIONCORRECTION_TOOLTIP"));
pixelShiftMotionCorrection->show();
hb2->pack_start(*pixelShiftMotionCorrection);
pixelShiftOptions->pack_start(*hb2);
@ -218,7 +244,7 @@ BayerProcess::BayerProcess () : FoldableToolPanel(this, "bayerprocess", M("TP_RA
pixelShiftPrnu->show();
pixelShiftOptions->pack_start(*pixelShiftPrnu);
pixelShiftSigma = Gtk::manage (new Adjuster (M("TP_RAW_PIXELSHIFTSIGMA"), 0.5, 2.5, 0.1, 1.0));
pixelShiftSigma = Gtk::manage (new Adjuster (M("TP_RAW_PIXELSHIFTSIGMA"), 0.5, 25, 0.1, 1.0));
pixelShiftSigma->setAdjusterListener (this);
if (pixelShiftSigma->delay < options.adjusterMaxDelay) {
@ -248,19 +274,10 @@ BayerProcess::BayerProcess () : FoldableToolPanel(this, "bayerprocess", M("TP_RA
pixelShiftRedBlueWeight->show();
pixelShiftOptions->pack_start(*pixelShiftRedBlueWeight);
pack_start( *pixelShiftOptions, Gtk::PACK_SHRINK, 4);
pixelShiftFrame->pack_start(*pixelShiftOptions);
pixelShiftOptions->hide();
pack_start( *Gtk::manage( new Gtk::HSeparator()), Gtk::PACK_SHRINK, 0 );
ccSteps = Gtk::manage (new Adjuster (M("TP_RAW_FALSECOLOR"), 0, 5, 1, 0 ));
ccSteps->setAdjusterListener (this);
if (ccSteps->delay < options.adjusterMaxDelay) {
ccSteps->delay = options.adjusterMaxDelay;
}
ccSteps->show();
pack_start( *ccSteps, Gtk::PACK_SHRINK, 4);
pack_start( *pixelShiftFrame, Gtk::PACK_SHRINK, 4);
//pack_start( *Gtk::manage( new Gtk::HSeparator()), Gtk::PACK_SHRINK, 0 );
//allOptions = Gtk::manage (new Gtk::VBox ());
@ -273,6 +290,7 @@ BayerProcess::BayerProcess () : FoldableToolPanel(this, "bayerprocess", M("TP_RA
psmcconn = pixelShiftMotionCorrection->signal_changed().connect( sigc::mem_fun(*this, &BayerProcess::psMotionCorrectionChanged) );
imagenumberconn = imageNumber->signal_changed().connect( sigc::mem_fun(*this, &BayerProcess::imageNumberChanged) );
dcbEnhconn = dcbEnhance->signal_toggled().connect ( sigc::mem_fun(*this, &BayerProcess::dcbEnhanceChanged), true);
pixelShiftMotionMethodConn = pixelShiftMotionMethod->signal_changed().connect( sigc::mem_fun(*this, &BayerProcess::pixelShiftMotionMethodChanged) );
pixelShiftShowMotionconn = pixelShiftShowMotion->signal_toggled().connect ( sigc::mem_fun(*this, &BayerProcess::pixelShiftShowMotionChanged), true);
pixelShiftShowMotionMaskOnlyconn = pixelShiftShowMotionMaskOnly->signal_toggled().connect ( sigc::mem_fun(*this, &BayerProcess::pixelShiftShowMotionMaskOnlyChanged), true);
pixelShiftAutomaticconn = pixelShiftAutomatic->signal_toggled().connect ( sigc::mem_fun(*this, &BayerProcess::pixelShiftAutomaticChanged), true);
@ -349,6 +367,9 @@ void BayerProcess::read(const rtengine::procparams::ProcParams* pp, const Params
if(!pedited->raw.bayersensor.pixelShiftMotionCorrection) {
pixelShiftMotionCorrection->set_active_text(M("GENERAL_UNCHANGED"));
}
if(!pedited->raw.bayersensor.pixelShiftMotionCorrectionMethod) {
pixelShiftMotionMethod->set_active_text(M("GENERAL_UNCHANGED"));
}
}
//allEnhance->set_active(pp->raw.bayersensor.all_enhance);
@ -373,6 +394,7 @@ void BayerProcess::read(const rtengine::procparams::ProcParams* pp, const Params
lmmseIterations->setValue (pp->raw.bayersensor.lmmse_iterations);
pixelShiftMotion->setValue (pp->raw.bayersensor.pixelShiftMotion);
pixelShiftMotionCorrection->set_active ((int)pp->raw.bayersensor.pixelShiftMotionCorrection);
pixelShiftMotionMethod->set_active ((int)pp->raw.bayersensor.pixelShiftMotionCorrectionMethod);
pixelShiftStddevFactorGreen->setValue (pp->raw.bayersensor.pixelShiftStddevFactorGreen);
pixelShiftStddevFactorRed->setValue (pp->raw.bayersensor.pixelShiftStddevFactorRed);
pixelShiftStddevFactorBlue->setValue (pp->raw.bayersensor.pixelShiftStddevFactorBlue);
@ -398,10 +420,15 @@ void BayerProcess::read(const rtengine::procparams::ProcParams* pp, const Params
}
if (pp->raw.bayersensor.method == procparams::RAWParams::BayerSensor::methodstring[procparams::RAWParams::BayerSensor::pixelshift] ||
method->get_active_row_number() == procparams::RAWParams::BayerSensor::numMethods) {
if(pp->raw.bayersensor.pixelShiftMotionCorrectionMethod == RAWParams::BayerSensor::Custom) {
pixelShiftOptions->show();
} else {
pixelShiftOptions->hide();
}
pixelShiftFrame->show();
} else {
pixelShiftFrame->hide();
}
// Flase color suppression is applied to all demozaicing method, so don't hide anything
/*if (pp->raw.bayersensor.method == procparams::RAWParams::BayerSensor::methodstring[procparams::RAWParams::BayerSensor::eahd] ||
@ -433,6 +460,7 @@ void BayerProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pe
pp->raw.bayersensor.lmmse_iterations = lmmseIterations->getIntValue();
pp->raw.bayersensor.pixelShiftMotion = pixelShiftMotion->getIntValue();
pp->raw.bayersensor.pixelShiftMotionCorrection = (RAWParams::BayerSensor::ePSMotionCorrection)pixelShiftMotionCorrection->get_active_row_number();
pp->raw.bayersensor.pixelShiftMotionCorrectionMethod = (RAWParams::BayerSensor::ePSMotionCorrectionMethod)pixelShiftMotionMethod->get_active_row_number();
pp->raw.bayersensor.pixelShiftStddevFactorGreen = pixelShiftStddevFactorGreen->getValue();
pp->raw.bayersensor.pixelShiftStddevFactorRed = pixelShiftStddevFactorRed->getValue();
pp->raw.bayersensor.pixelShiftStddevFactorBlue = pixelShiftStddevFactorBlue->getValue();
@ -478,6 +506,7 @@ void BayerProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pe
pedited->raw.bayersensor.lmmseIterations = lmmseIterations->getEditedState ();
pedited->raw.bayersensor.pixelShiftMotion = pixelShiftMotion->getEditedState ();
pedited->raw.bayersensor.pixelShiftMotionCorrection = pixelShiftMotionCorrection->get_active_text() != M("GENERAL_UNCHANGED");
pedited->raw.bayersensor.pixelShiftMotionCorrectionMethod = pixelShiftMotionMethod->get_active_text() != M("GENERAL_UNCHANGED");
pedited->raw.bayersensor.pixelShiftStddevFactorGreen = pixelShiftStddevFactorGreen->getEditedState ();
pedited->raw.bayersensor.pixelShiftStddevFactorRed = pixelShiftStddevFactorRed->getEditedState ();
pedited->raw.bayersensor.pixelShiftStddevFactorBlue = pixelShiftStddevFactorBlue->getEditedState ();
@ -510,6 +539,8 @@ void BayerProcess::setBatchMode(bool batchMode)
method->set_active(procparams::RAWParams::BayerSensor::numMethods); // No name
pixelShiftMotionCorrection->append_text (M("GENERAL_UNCHANGED"));
pixelShiftMotionCorrection->set_active (4);
pixelShiftMotionMethod->append_text (M("GENERAL_UNCHANGED"));
pixelShiftMotionMethod->set_active (4);
imageNumber->append_text (M("GENERAL_UNCHANGED"));
imageNumber->set_active(4);
dcbOptions->hide();
@ -613,26 +644,16 @@ void BayerProcess::adjusterChanged (Adjuster* a, double newval)
void BayerProcess::psMotionCorrectionChanged ()
{
int curSelection = pixelShiftMotionCorrection->get_active_row_number();
Glib::ustring sGrid;
switch (curSelection) {
case 0:
sGrid = "1x1";
break;
case 1:
sGrid = "1x2";
break;
case 2:
sGrid = "3x3";
break;
case 3:
default:
sGrid = "5x5";
break;
if(pixelShiftMotionCorrection->get_active_row_number() == 5) {
pixelShiftBlur->set_sensitive(true);
pixelShiftHoleFill->set_sensitive(true);
} else {
pixelShiftBlur->set_sensitive(false);
pixelShiftHoleFill->set_sensitive(false);
}
if (listener) {
listener->panelChanged (EvPixelShiftMotionCorrection, sGrid);
listener->panelChanged (EvPixelShiftMotionCorrection, pixelShiftMotionCorrection->get_active_text());
}
}
@ -653,10 +674,15 @@ void BayerProcess::methodChanged ()
}
if ( curSelection == procparams::RAWParams::BayerSensor::pixelshift) {
if(pixelShiftMotionMethod->get_active_row_number() == 2) {
pixelShiftOptions->show();
} else {
pixelShiftOptions->hide();
}
pixelShiftFrame->show();
} else {
pixelShiftFrame->hide();
}
Glib::ustring methodName = "";
bool ppreq = false;
@ -703,6 +729,26 @@ void BayerProcess::dcbEnhanceChanged ()
}
}
void BayerProcess::pixelShiftMotionMethodChanged ()
{
if(pixelShiftMotionMethod->get_active_row_number() == 0) {
pixelShiftOptions->hide();
pixelShiftShowMotion->hide();
pixelShiftShowMotionMaskOnly->hide();
} else if(pixelShiftMotionMethod->get_active_row_number() == 2) {
pixelShiftOptions->show();
pixelShiftShowMotion->show();
pixelShiftShowMotionMaskOnly->show();
} else {
pixelShiftOptions->hide();
pixelShiftShowMotion->show();
pixelShiftShowMotionMaskOnly->show();
}
if (listener) {
listener->panelChanged (EvPixelShiftMotionMethod, pixelShiftMotionMethod->get_active_text());
}
}
void BayerProcess::pixelShiftShowMotionChanged ()
{
if (batchMode) {

View File

@ -41,9 +41,11 @@ protected:
//Gtk::CheckButton* allEnhance;
Gtk::VBox *lmmseOptions;
Adjuster* lmmseIterations;
Gtk::VBox *pixelShiftFrame;
Gtk::VBox *pixelShiftOptions;
Adjuster* pixelShiftMotion;
MyComboBoxText* pixelShiftMotionCorrection;
MyComboBoxText* pixelShiftMotionMethod;
Gtk::CheckButton* pixelShiftShowMotion;
Gtk::CheckButton* pixelShiftShowMotionMaskOnly;
Gtk::CheckButton* pixelShiftAutomatic;
@ -73,7 +75,7 @@ protected:
sigc::connection methodconn, imagenumberconn, psmcconn, dcbEnhconn,
pixelShiftShowMotionconn, pixelShiftShowMotionMaskOnlyconn, pixelShiftAutomaticconn,
pixelShiftNonGreenHorizontalconn, pixelShiftNonGreenVerticalconn, pixelShiftHoleFillconn, pixelShiftMedianconn, pixelShiftMedian3conn, pixelShiftNonGreenCrossconn,
pixelShiftNonGreenCross2conn, pixelShiftNonGreenAmazeconn, pixelShiftGreenconn, pixelShiftBlurconn, pixelShiftExp0conn;
pixelShiftNonGreenCross2conn, pixelShiftNonGreenAmazeconn, pixelShiftGreenconn, pixelShiftBlurconn, pixelShiftExp0conn, pixelShiftMotionMethodConn;
public:
BayerProcess ();
@ -102,6 +104,7 @@ public:
void pixelShiftNonGreenCrossChanged();
void pixelShiftNonGreenCross2Changed();
void pixelShiftNonGreenAmazeChanged();
void pixelShiftMotionMethodChanged();
};
#endif

View File

@ -372,6 +372,7 @@ void ParamsEdited::set (bool v)
raw.bayersensor.lmmseIterations = v;
raw.bayersensor.pixelShiftMotion = v;
raw.bayersensor.pixelShiftMotionCorrection = v;
raw.bayersensor.pixelShiftMotionCorrectionMethod = v;
raw.bayersensor.pixelShiftStddevFactorGreen = v;
raw.bayersensor.pixelShiftStddevFactorRed = v;
raw.bayersensor.pixelShiftStddevFactorBlue = v;
@ -893,6 +894,7 @@ void ParamsEdited::initFrom (const std::vector<rtengine::procparams::ProcParams>
raw.bayersensor.lmmseIterations = raw.bayersensor.lmmseIterations && p.raw.bayersensor.lmmse_iterations == other.raw.bayersensor.lmmse_iterations;
raw.bayersensor.pixelShiftMotion = raw.bayersensor.pixelShiftMotion && p.raw.bayersensor.pixelShiftMotion == other.raw.bayersensor.pixelShiftMotion;
raw.bayersensor.pixelShiftMotionCorrection = raw.bayersensor.pixelShiftMotionCorrection && p.raw.bayersensor.pixelShiftMotionCorrection == other.raw.bayersensor.pixelShiftMotionCorrection;
raw.bayersensor.pixelShiftMotionCorrectionMethod = raw.bayersensor.pixelShiftMotionCorrectionMethod && p.raw.bayersensor.pixelShiftMotionCorrectionMethod == other.raw.bayersensor.pixelShiftMotionCorrectionMethod;
raw.bayersensor.pixelShiftStddevFactorGreen = raw.bayersensor.pixelShiftStddevFactorGreen && p.raw.bayersensor.pixelShiftStddevFactorGreen == other.raw.bayersensor.pixelShiftStddevFactorGreen;
raw.bayersensor.pixelShiftStddevFactorRed = raw.bayersensor.pixelShiftStddevFactorRed && p.raw.bayersensor.pixelShiftStddevFactorRed == other.raw.bayersensor.pixelShiftStddevFactorRed;
raw.bayersensor.pixelShiftStddevFactorBlue = raw.bayersensor.pixelShiftStddevFactorBlue && p.raw.bayersensor.pixelShiftStddevFactorBlue == other.raw.bayersensor.pixelShiftStddevFactorBlue;
@ -2336,6 +2338,10 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten
toEdit.raw.bayersensor.pixelShiftMotionCorrection = mods.raw.bayersensor.pixelShiftMotionCorrection;
}
if (raw.bayersensor.pixelShiftMotionCorrectionMethod) {
toEdit.raw.bayersensor.pixelShiftMotionCorrectionMethod = mods.raw.bayersensor.pixelShiftMotionCorrectionMethod;
}
if (raw.bayersensor.pixelShiftStddevFactorGreen) {
toEdit.raw.bayersensor.pixelShiftStddevFactorGreen = mods.raw.bayersensor.pixelShiftStddevFactorGreen;
}
@ -2938,7 +2944,7 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten
bool RAWParamsEdited::BayerSensor::isUnchanged() const
{
return method && imageNum && dcbIterations && dcbEnhance && lmmseIterations/*&& allEnhance*/ && greenEq
&& pixelShiftMotion && pixelShiftMotionCorrection && pixelShiftStddevFactorGreen && pixelShiftStddevFactorRed && pixelShiftStddevFactorBlue && pixelShiftEperIso
&& pixelShiftMotion && pixelShiftMotionCorrection && pixelShiftMotionCorrectionMethod && pixelShiftStddevFactorGreen && pixelShiftStddevFactorRed && pixelShiftStddevFactorBlue && pixelShiftEperIso
&& pixelShiftNreadIso && pixelShiftPrnu && pixelShiftSigma && pixelShiftSum && pixelShiftRedBlueWeight && pixelshiftShowMotion && pixelshiftShowMotionMaskOnly
&& pixelShiftAutomatic && pixelShiftNonGreenHorizontal && pixelShiftNonGreenVertical && pixelShiftHoleFill && pixelShiftMedian && pixelShiftMedian3 && pixelShiftNonGreenCross && pixelShiftNonGreenCross2 && pixelShiftNonGreenAmaze && pixelShiftGreen && pixelShiftBlur && pixelShiftExp0
&& linenoise && exBlack0 && exBlack1 && exBlack2 && exBlack3 && exTwoGreen;

View File

@ -694,6 +694,7 @@ public:
bool lmmseIterations;
bool pixelShiftMotion;
bool pixelShiftMotionCorrection;
bool pixelShiftMotionCorrectionMethod;
bool pixelShiftStddevFactorGreen;
bool pixelShiftStddevFactorRed;
bool pixelShiftStddevFactorBlue;