开发者

CUDA cufftPlan2d plan size question

开发者 https://www.devze.com 2023-02-21 12:30 出处:网络
I\'m studying the code behind the convolutionFFT2D example of the Nvidia CUDA sdk, but I don\'t get the point of this line:

I'm studying the code behind the convolutionFFT2D example of the Nvidia CUDA sdk, but I don't get the point of this line:

cufftPlan2d(&fftPlan, fftH, fftW/2, CUFFT_C2C);

Apparently this initializes a complex plane for the FFT to be running in, but I don't see the point of dividing the plan width by 开发者_运维问答2.

Just to be precise: the fftH and fftW are rounded values for imageX+kernelX+1 and imageY+kernelY+1 dimensions (just for speed reasons). I know that in the frequency domain you usually have a positive component and a symmetric negative component of the same frequency.. but this sounds like cutting half of my image data away..

Can someone explain this to me a little better? I've never used a FFT (I just know the theory behind a fourier transformation)


When you perform a real to complex FFT half the frequency domain data is redundant due to symmetry. This is only the case in one axis of a 2D FFT though. You can think of a 2D FFT as two 1D FFT operations, the first operates on all the rows, and for a real valued image this will give you complex row values. In the second stage you apply a 1D FFT to every column, but since the row values are now complex this will be a complex to complex FFT with no redundancy in the output. Hence you only need width / 2 points in the horizontal axis, but you still need height pointe in the vertical axis.

0

精彩评论

暂无评论...
验证码 换一张
取 消