dual demosaic: improved auto threshold detection and fall back to more detailed demosaicer if no flat region was found, #4866
This commit is contained in:
@@ -269,8 +269,10 @@ void buildBlendMask(float** luminance, float **blend, int W, int H, float &contr
|
||||
const int minY = tilesize * minI;
|
||||
const int minX = tilesize * minJ;
|
||||
|
||||
// std::cout << pass << ": minvar : " << minvar << std::endl;
|
||||
if (minvar <= 1.f || pass == 1) {
|
||||
// a variance <= 1 means we already found a flat region and can skip second pass
|
||||
// in second pass we allow a variance of 2
|
||||
JaggedArray<float> Lum(tilesize, tilesize);
|
||||
JaggedArray<float> Blend(tilesize, tilesize);
|
||||
for (int i = 0; i < tilesize; ++i) {
|
||||
@@ -278,8 +280,7 @@ void buildBlendMask(float** luminance, float **blend, int W, int H, float &contr
|
||||
Lum[i][j] = luminance[i + minY][j + minX];
|
||||
}
|
||||
}
|
||||
|
||||
contrastThreshold = std::min(contrastThreshold, calcContrastThreshold(Lum, Blend, tilesize, tilesize) / 100.f);
|
||||
contrastThreshold = (pass == 0 || minvar <= 2.f) ? calcContrastThreshold(Lum, Blend, tilesize, tilesize) / 100.f : 0.f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -312,6 +312,9 @@ void BayerProcess::read(const rtengine::procparams::ProcParams* pp, const Params
|
||||
lmmseIterations->setValue (pp->raw.bayersensor.lmmse_iterations);
|
||||
dualDemosaicAutoContrast->setValue (pp->raw.bayersensor.dualDemosaicAutoContrast);
|
||||
dualDemosaicContrast->setValue (pp->raw.bayersensor.dualDemosaicContrast);
|
||||
if (!batchMode) {
|
||||
dualDemosaicContrast->set_sensitive(!pp->raw.bayersensor.dualDemosaicAutoContrast);
|
||||
}
|
||||
pixelShiftMotionMethod->set_active ((int)pp->raw.bayersensor.pixelShiftMotionCorrectionMethod);
|
||||
pixelShiftEperIso->setValue (pp->raw.bayersensor.pixelShiftEperIso);
|
||||
pixelShiftSigma->setValue (pp->raw.bayersensor.pixelShiftSigma);
|
||||
@@ -622,6 +625,9 @@ void BayerProcess::imageNumberChanged ()
|
||||
void BayerProcess::checkBoxToggled (CheckBox* c, CheckValue newval)
|
||||
{
|
||||
if (c == dualDemosaicAutoContrast) {
|
||||
if (!batchMode) {
|
||||
dualDemosaicContrast->set_sensitive(newval == CheckValue::off);
|
||||
}
|
||||
if (listener) {
|
||||
listener->panelChanged (EvDemosaicAutoContrast, dualDemosaicAutoContrast->getValueAsStr ());
|
||||
}
|
||||
|
Reference in New Issue
Block a user