Tuesday, 20 August 2013

Scale of convolution with fftw

Scale of convolution with fftw

I have written a simple program (in ANSI C) to convolve two real 2D arrays
with FFTW (using the r2c and c2r plans). Everything (except the scale)
works well and the output looks fine.
The problem is that I am a little confused on how to scale the two arrays
so after the process IDFT[DFT(A)DFT(B)] (DFT: discrete Fourier transform.
I: Inverse.) the scale of the final result is correct. Say image A is a
square of width a pixels and the convolution kernel is b pixels. I then
create two padded square arrays of width p=a+b and place both my A and B
images in them and do the convolution.
Is scaling the final output with p^2 correct? Thanks in advance.

No comments:

Post a Comment