Recursive gaussian filter vs traditional gaussian filter
조회 수: 6 (최근 30일)
이전 댓글 표시
Some papers say Recursive gaussian filter is much faster than traditional gaussian filter. Traditional gaussian filter accepts a 2D MxN matrix as kernel. While, Recursive gaussian filter accepts a 1D float sigma as kernel.
If I have a 2D kernel for traditional guassian filter before. I want to use Recursive Gaussian now. How to calculate the corresponding 1D float sigma to get a closest result to traditional filter?
e.g: int kernel[25] = { 1, 4, 7, 4, 1, 4, 16, 26, 16, 4, 7, 26, 41, 26, 7, 4, 16, 26, 16, 4, 1, 4, 7, 4, 1 }; How to calculate sigma for this 2D kernel?
Regards
zlf
댓글 수: 0
답변 (2개)
Junaid
2011년 12월 2일
As I understand your code and question. you have kernel variable.
Kernel =[1, 4, 7, 4, 1, 4, 16, 26, 16, 4, 7, 26, 41, 26, 7, 4, 16, 26, 16, 4, 1, 4, 7, 4, 1];
and you want to compute the gaussian for this. let say G.
G = fspecial('gaussian', size(Kernel),5);
where 5 is initiall value of sigma, you tune it as you like. You can plot your G as well. Like this
plot([1:length(G)], G)
댓글 수: 0
Image Analyst
2011년 12월 2일
Sounds like maybe you're mixing up the method of separable kernels and recursive filtering.
Because the convolution of two Gaussians is another Gaussian, filtering an image with a Gaussian and then doing it again is the same as filtering once with a larger Gaussian. That would be recursive filtering. (By the way if you convolve anything (other than a delta function or comb function) with itself enough times (more than about 6) it is essentially the same as a Gaussian for all intents and purposes.
Now you can get a 2D Gaussian kernel by convolving once in the vertical direction with a 1D Gaussian filter, and then filter that result by another 1D Gaussian in the horizontal direction. That's the method of separable kernels.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Regression에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!