What do fspecial image filtering parameters mean?

3 次查看(过去 30 天)
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?

采纳的回答

David Young
David Young 2014-9-9
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.

更多回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by