I'm taking a multidimensional discrete cosine transform (FFTW_REDFT11
) in FFTW, and am unsure how to compute the scaling factor. According to the documentation, taking the forward and reverse transforms results in the original image multiplied by a scaling factor:
[C]omputing a transform followed by its inverse yields the original array scaled by N, where N is the logical DFT size. For REDFT00, N=2(n-1); for RODFT00, N=2(n+1); otherwise, N=2n.
The documentation also defines logical arrays for 1D transforms:
[I]f you specify a size-5 REDFT00 (DCT-I) of the data abcde, it corresponds to the DFT of the logical even array abcdedcb of size 8. A size-4 REDFT10 (DCT-II) of the data abcd corresponds to the size-8 logical DFT of the even array abcddcba, shifted by half a sample.
I'm not sure what n
is in a multidimensional transform. Say I have a 10x10 matrix. Is n twice the total number of pixels (200)? Or is it the number of pixels in the image if it were reflected in all dimensions (400)?