@nivag在信号处理指出,每个维度可以独立处理: https://dsp.stackexchange.com/questions/19519/extending-1d-window-functions-to-3d-or-higher
这里是我想出了一个代码(从scikit图像球队修订帮助):
def _nd_window(data, filter_function):
"""
Performs an in-place windowing on N-dimensional spatial-domain data.
This is done to mitigate boundary effects in the FFT.
Parameters
----------
data : ndarray
Input data to be windowed, modified in place.
filter_function : 1D window generation function
Function should accept one argument: the window length.
Example: scipy.signal.hamming
"""
for axis, axis_size in enumerate(data.shape):
# set up shape for numpy broadcasting
filter_shape = [1, ] * data.ndim
filter_shape[axis] = axis_size
window = filter_function(axis_size).reshape(filter_shape)
# scale the window intensities to maintain image intensity
np.power(window, (1.0/data.ndim), output=window)
data *= window
可能要发布此[Signal Processing](http://dsp.stackexchange.com/) – wwii 2014-12-07 18:23:59
谢谢,会做。 – msarahan 2014-12-07 18:24:44