Recursive gaussian filter vs traditional gaussian filter
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (2)
Junaid
il 2 Dic 2011
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 Commenti
Image Analyst
il 2 Dic 2011
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 Commenti
Vedere anche
Categorie
Scopri di più su Regression in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!