Improve local contrast with simple wavelet

This commit is contained in:
Desmis
2019-08-01 10:36:35 +02:00
parent 1a75467794
commit 3105bab29f
17 changed files with 560 additions and 34 deletions

View File

@@ -2599,6 +2599,49 @@ void LocLHCurve::Set(const std::vector<double> &curvePoints, bool &LHutili)
}
}
LocwavCurve::LocwavCurve() : sum(0.f) {};
void LocwavCurve::Reset()
{
lutLocwavCurve.reset();
sum = 0.f;
}
void LocwavCurve::Set(const Curve &pCurve)
{
if (pCurve.isIdentity()) {
Reset(); // raise this value if the quality suffers from this number of samples
return;
}
lutLocwavCurve(501); // raise this value if the quality suffers from this number of samples
sum = 0.f;
for (int i = 0; i < 501; i++) {
lutLocwavCurve[i] = pCurve.getVal(double (i) / 500.);
if (lutLocwavCurve[i] < 0.02f) {
lutLocwavCurve[i] = 0.02f; //avoid 0.f for wavelet : under 0.01f quasi no action for each value
}
sum += lutLocwavCurve[i];
}
//lutLocCurve.dump("wav");
}
void LocwavCurve::Set(const std::vector<double> &curvePoints)
{
if (!curvePoints.empty() && curvePoints[0] > FCT_Linear && curvePoints[0] < FCT_Unchanged) {
FlatCurve tcurve(curvePoints, false, CURVES_MIN_POLY_POINTS / 2);
tcurve.setIdentityValue(0.);
Set(tcurve);
} else {
Reset();
}
}
LocretigainCurve::LocretigainCurve() : sum(0.f) {};