Local adjustments - Nlmeans - Fixed smears image borders issue 6171 (#6172)

* Fixed ? smears image borders issue 6171

* Increase effect for borders

* Fixed smears image border nlmeans - thanks to Lawrence37
This commit is contained in:
Desmis 2021-03-19 08:45:56 +01:00 committed by GitHub
parent c0e67b64c8
commit 7224412b69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9559,6 +9559,8 @@ void ImProcFunctions::DeNoise(int call, float * slidL, float * slida, float * sl
if(lp.nlstr > 0 && (hspot > 150 && wspot > 150)) {
NLMeans(tmp1.L, lp.nlstr, lp.nldet, lp.nlpat, lp.nlrad, lp.nlgam, GW, GH, float (sk), multiThread);
// NLMeans(*nlm, lp.nlstr, lp.nldet, lp.nlpat, lp.nlrad, lp.nlgam, GW + addsiz, GH + addsiz, float (sk), multiThread);
}
if(lp.smasktyp != 0) {
if(lp.enablMask && lp.recothrd != 1.f) {
@ -10230,6 +10232,9 @@ void ImProcFunctions::DeNoise(int call, float * slidL, float * slida, float * sl
if(lp.nlstr > 0) {
NLMeans(bufwv.L, lp.nlstr, lp.nldet, lp.nlpat, lp.nlrad, lp.nlgam, bfw, bfh, 1.f, multiThread);
// NLMeans(*nlm, lp.nlstr, lp.nldet, lp.nlpat, lp.nlrad, lp.nlgam, bfw + addsiz, bfh + addsiz, 1.f, multiThread);
}
@ -10896,6 +10901,7 @@ void ImProcFunctions::NLMeans(float **img, int strength, int detail_thresh, int
BENCHFUN
const int W = bfw;
const int H = bfh;
// printf("W=%i H=%i\n", W, H);
float gamma = gam;
rtengine::GammaValues g_a; //gamma parameters
double pwr = 1.0 / static_cast<double>(gam);//default 3.0 - gamma Lab
@ -10918,7 +10924,6 @@ void ImProcFunctions::NLMeans(float **img, int strength, int detail_thresh, int
img[y][x] = 65536.f * igammalog(img[y][x] / 32768.f, gamma, ts, g_a[2], g_a[4]);
}
}
// these two can be changed if needed. increasing max_patch_radius doesn't
// affect performance, whereas max_search_radius *really* does
// (the complexity is O(max_search_radius^2 * W * H))
@ -10973,9 +10978,9 @@ void ImProcFunctions::NLMeans(float **img, int strength, int detail_thresh, int
# pragma omp parallel for if (multithread)
#endif
for (int y = 0; y < HH; ++y) {
int yy = y <= border ? 0 : y >= H ? H-1 : y - border;
int yy = y <= border ? 0 : y - border >= H ? H-1 : y - border;
for (int x = 0; x < WW; ++x) {
int xx = x <= border ? 0 : x >= W ? W-1 : x - border;
int xx = x <= border ? 0 : x - border >= W ? W-1 : x - border;
float Y = img[yy][xx] / 65536.f;
src[y][x] = Y;
}