今天在一篇论文中看到这样一句话:
FFT-based deconvolution hinges on a blur model which assumes a convolution with periodic (circular) boundary conditions.
Matlab 文档中详细说明了二者的区别:
Linear and Circular Convolution
通常我们所学的是Linear Convolution,但是它的计算比较复杂,而我们所说的简化方法:“时域上的卷积 等价于 频域上(傅里叶域)的点积” 只适用于 Circular Convolution,对 于Linear Convolution 需要加上额外的Padding操作才能等价。原话是这样:
1、For two vectors, x and y, the circular convolution is equal to the inverse discrete Fourier transform (DFT) of the product of the vectors’ DFTs.
2、Knowing the conditions under which linear and circular convolution are equivalent allows you to use the DFT to efficiently compute linear convolutions.
具体二者等价的条件是:For the circular convolution of x and y to be equivalent, you must pad the vectors with zeros to length at least N + L - 1 before you take the DFT. After you invert the product of the DFTs, retain only the first N + L - 1 elements.
Linear Convolution 和 Cicular Convolution的具体操作图示如下:
如何pad x 和 y,才能让利用DFT快速计算 Linear Convolution?如下图所示:
下面看一组测试:
x = [5 6 8 2 5];
y = [6 -1 3 5 1];
N = length(x) + length(y) -1;
x1 = [x zeros(1,N-length(x))];
y1 = [y zeros(1,N-length(y))];
c1 = ifft(fft(x1).*fft(y1)); % Circular Convolution
c2 = conv(x,y,'full'); % Linear Convolution = c2 due to the padding
c3 = ifft(fft(x).*fft(y)); % Without padding, not equivalent to c2
c4 = cconv(x,y, length(x)); % Circular Convolution, equal to c3
x1 =
5 6 8 2 5 0 0 0 0
y1 =
6 -1 3 5 1 0 0 0 0
c1 =
30 31 57 47 87 47 33 27 5
c2 =
30 31 57 47 87 47 33 27 5
c3 =
77 64 84 52 87
c4 =
77 64 84 52 87
参考:
【1】2D circular convolution Vs convolution FFT [Matlab/Octave/Python]
【2】Linear and Circular Convolution