高斯模糊的并行链 [英] Parallelize chain of Gaussian Blurs
问题描述
我有此代码(位置:
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屋!