I want to find a function that applies 2d filter or 3d filter in python. the function should receive the filter function and the data.
Like the functions filter2
and imfilter
in Matlab,
or like the function scipy.ndimage.gaussian_filter()
in python, that can deal with N-dimensions but is only for gaussian filter (and I want the filter to be an argument)
I think I can write a function that applies a filter using multidimensional convolution (scipy.ndimage.convolve()
), but I was not successful for 1d filters.
The code I used for 1d filtering:
signal.convolve(signal, filter_, mode='same', method='auto')
, and it gave a different result than the function signal.filtfilt(filter_, 1, signal, padlen=len(signal)-1)
.
Is there a function that applies N-D filters? and if not, how can I use the convolution function?
thanks!