What do fspecial image filtering parameters mean?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I would like to high-pass-filter an image to get rid of wavelengths longer than about 30 pixels. Here is what I am trying:
hpFiltImage = myImage - imfilter(myImage,fspecial('gaussian',hsize,sigma));
I do not have an intuition for the units or meaning of hsize and sigma. How do I choose hsize and sigma to get the desired cutoff wavelength of 30 pixels?
0 commentaires
Réponse acceptée
David Young
le 9 Sep 2014
The Gaussian filter does not have a sharp cut-off, but 2*pi*sigma is the wavelength at which the amplitude is multiplied by a factor of about 0.6 (more exactly, exp(-0.5)). So you might set sigma to 30/(2*pi) to suppress wavelengths over about 30 pixels.
hsize needs to be big enough that you don't truncate the filter too much. I use hsize = 2*ceil(2.6*sigma)+1 which gives roughly 1% truncation error on each dimension of the image, but you may wish to vary this depending on the trade-off between precision and compute time for your problem.
Plus de réponses (0)
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!