Commit 9db28f33 authored by Ilya Lavrenov's avatar Ilya Lavrenov

more fixes

parent 891dbeab
...@@ -137,6 +137,8 @@ FastNlMeansDenoisingInvoker<T>::FastNlMeansDenoisingInvoker( ...@@ -137,6 +137,8 @@ FastNlMeansDenoisingInvoker<T>::FastNlMeansDenoisingInvoker(
double dist = almost_dist * almost_dist2actual_dist_multiplier; double dist = almost_dist * almost_dist2actual_dist_multiplier;
int weight = cvRound(fixed_point_mult_ * std::exp(-dist / (h * h * sizeof(T)))); int weight = cvRound(fixed_point_mult_ * std::exp(-dist / (h * h * sizeof(T))));
printf("%d ", weight);
if (weight < WEIGHT_THRESHOLD * fixed_point_mult_) if (weight < WEIGHT_THRESHOLD * fixed_point_mult_)
weight = 0; weight = 0;
......
...@@ -111,15 +111,17 @@ static bool ocl_fastNlMeansDenoising(InputArray _src, OutputArray _dst, float h, ...@@ -111,15 +111,17 @@ static bool ocl_fastNlMeansDenoising(InputArray _src, OutputArray _dst, float h,
_dst.create(size, type); _dst.create(size, type);
UMat dst = _dst.getUMat(); UMat dst = _dst.getUMat();
Size upColSumSize(size.width, searchWindowSize * searchWindowSize * nblocksy); int searchWindowSizeSq = searchWindowSize * searchWindowSize;
Size colSumSize(nblocksx * templateWindowSize, searchWindowSize * searchWindowSize * nblocksy); Size upColSumSize(size.width, searchWindowSizeSq * nblocksy);
Size colSumSize(nblocksx * templateWindowSize, searchWindowSizeSq * nblocksy);
UMat buffer(upColSumSize + colSumSize, CV_32SC(cn)); UMat buffer(upColSumSize + colSumSize, CV_32SC(cn));
srcex = srcex(Rect(Point(borderSize, borderSize), size));
k.args(ocl::KernelArg::ReadOnlyNoSize(srcex), ocl::KernelArg::WriteOnly(dst), k.args(ocl::KernelArg::ReadOnlyNoSize(srcex), ocl::KernelArg::WriteOnly(dst),
ocl::KernelArg::PtrReadOnly(almostDist2Weight), nblocksy, nblocksx, ocl::KernelArg::PtrReadOnly(almostDist2Weight),
ocl::KernelArg::PtrReadOnly(buffer), almostTemplateWindowSizeSqBinShift); ocl::KernelArg::PtrReadOnly(buffer), almostTemplateWindowSizeSqBinShift);
size_t globalsize[2] = { nblocksx, nblocksy }, localsize[2] = { CTA_SIZE, 1 }; size_t globalsize[2] = { nblocksx * BLOCK_COLS, nblocksy * BLOCK_ROWS }, localsize[2] = { CTA_SIZE, 1 };
return k.run(2, globalsize, localsize, false); return k.run(2, globalsize, localsize, false);
} }
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment