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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With