开发者

3D Gaussian Filter in MATLAB

Is there a 3D eqivalent of imfilter available for MATLAB? I wish to apply Gaussian filtering to a 3D histogram. I was going to implement it myself, by creating a (3D) Gaussian filter, then looping over each element in my histogram, and summing up the corresponding data entries.

However, I didn't want to implement it myself in a slow and inefficient way if there's somet开发者_C百科hing already out there, or a cleverer way of doing it.


There are two ways to solve this in order to do the filtering in an efficient manner:

(1) Use CONVN three times to filter your data with three 1D Gaussians, one x-by-1-by-1, one 1-by-y-by-1, and one 1-by-1-by-z.

(2) If you have the signal processing toolbox, use FFTFILT to perform filtering in inverse space (or use any one of the fft-convolution algorithms on the file exchange).

[(3) Send me an email and I'll send you my fftFilterImage, which does 3D Gauss filtering.]


imfilter can already do 3D filtering, as long as the data matrix and the filter you give it are 3D. See the imfilter page.


This task can be handled with the new (as of R2015a) imgaussfilt3 function.

The basic syntax is as follows:

B = imgaussfilt3(A,sigma)

There are also a number of name-value pair arguments:

  • 'FilterSize': Size of the Gaussian filter, defaulting to a cube of size 2*ceil(2*sigma)+1.
  • 'Padding': Type of padding ('replicate' (default) | 'circular' | 'symmetric').
  • 'FilterDomain': Perform convolution in domain: 'frequency' or 'spatial' (default auto).
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜