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:
parent
c0e67b64c8
commit
7224412b69
@ -9559,6 +9559,8 @@ void ImProcFunctions::DeNoise(int call, float * slidL, float * slida, float * sl
|
|||||||
|
|
||||||
if(lp.nlstr > 0 && (hspot > 150 && wspot > 150)) {
|
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(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.smasktyp != 0) {
|
||||||
if(lp.enablMask && lp.recothrd != 1.f) {
|
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) {
|
if(lp.nlstr > 0) {
|
||||||
NLMeans(bufwv.L, lp.nlstr, lp.nldet, lp.nlpat, lp.nlrad, lp.nlgam, bfw, bfh, 1.f, multiThread);
|
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
|
BENCHFUN
|
||||||
const int W = bfw;
|
const int W = bfw;
|
||||||
const int H = bfh;
|
const int H = bfh;
|
||||||
|
// printf("W=%i H=%i\n", W, H);
|
||||||
float gamma = gam;
|
float gamma = gam;
|
||||||
rtengine::GammaValues g_a; //gamma parameters
|
rtengine::GammaValues g_a; //gamma parameters
|
||||||
double pwr = 1.0 / static_cast<double>(gam);//default 3.0 - gamma Lab
|
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]);
|
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
|
// these two can be changed if needed. increasing max_patch_radius doesn't
|
||||||
// affect performance, whereas max_search_radius *really* does
|
// affect performance, whereas max_search_radius *really* does
|
||||||
// (the complexity is O(max_search_radius^2 * W * H))
|
// (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)
|
# pragma omp parallel for if (multithread)
|
||||||
#endif
|
#endif
|
||||||
for (int y = 0; y < HH; ++y) {
|
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) {
|
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;
|
float Y = img[yy][xx] / 65536.f;
|
||||||
src[y][x] = Y;
|
src[y][x] = Y;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user