Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 something already out there, or a cleverer way of doing it.

like image 851
Bill Cheatham Avatar asked Jun 13 '11 13:06

Bill Cheatham


2 Answers

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.]

like image 181
Jonas Avatar answered Sep 23 '22 23:09

Jonas


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

like image 25
Jim Clay Avatar answered Sep 25 '22 23:09

Jim Clay