高斯模糊的并行链 [英] Parallelize chain of Gaussian Blurs

查看:91
本文介绍了高斯模糊的并行链的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有此代码(位置:

Mat gaussianBlur(const Mat input, const float sigma)
{
   Mat ret(input.rows, input.cols, input.type());
   int size = (int)(2.0 * 3.0 * sigma + 1.0); if (size % 2 == 0) size++;      
   GaussianBlur(input, ret, Size(size, size), sigma, sigma, BORDER_REPLICATE);
   return ret;
}

因此,如您所见,每个blurs[i+1]都依赖于blurs[i],因此无法并行化.我的问题是:是否有等效的方法来获得相同的结果,但使用firstLevel而不是blurs[i]?所以它看起来应该像这样:

So, as you can see, each blurs[i+1] depends on blurs[i], so it cannot be parallelized. My question is: is there an equivalent way to obtain the same result but using firstLevel instead of blurs[i]? So it should so look something like:

for (int i = 1; i < par.numberOfScales+2; i++){
  float sigma = //something;
  blurs[i+1] = gaussianBlur(firstLevel, sigma);
}

有可能吗?

答案让我认为这是有可能的,但我不明白如何实现此目标:

This answer let me think that it's possible, but I can't understand how I can implement this:

卷积滤镜如果您在同一张图像上应用多个滤镜 像高斯模糊,然后是Gabor滤镜,您可以 将它们结合在一起.使所有过滤器大小相同并卷积 他们.然后将结果应用于图像.数学说效果会是 与以前的组合相同

Convolve filters If you apply multiple filters on the same image consecutively, like a gaussian blur, then a Gabor filter, you can combine them together. Make all filters the same size and convolve them. Then apply the result on the image. Math says the effect will be identical with the previous combination

推荐答案

这是可能的(您可以并行化).我遇到了完全相同的问题,并以这种方式解决了(请参阅我对这个问题的回答,以及python代码).

This is possible (you can parallelize). I had exactly the same issue, and solved it this way (see my answer to that problem, with python code).

https://dsp.stackexchange.com/questions/667/image -pyramid-without-decimation/55654#55654

这篇关于高斯模糊的并行链的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆