I implement the usual (which means not fast), split Fourier transform for images. I know that in a floating point, the sum for one sin or cos period in equally spaced samples is not completely zero and that this is more a problem with a normal conversion than with a fast one.
The algorithm works with two-dimensional double arrays and is correct. The reverse is performed internally (over the double-sign icon and conditional check using an asymmetric formula), and not externally with mates. The results are almost 100%, as expected, so the question is about the details:
When I do the forward conversion, save the logarithmic magnitude and angle of the image, reload them and perform the inverse transformation, I experience different types of rounding errors with different types of implemented formulas:
F (u, v) = Sum (x = 0-> M-1) Sum (y = 0-> N-1) f (x, y) * e ^ (- i * 2 * pi * u * x / M) * e ^ (- i * 2 * pi * v * y / N)
f (x, y) = 1 / M * N * (as indicated above)
F (u, v) = 1 / sqrt (M * N) * (as above)
f (x, y) = 1 / sqrt (M * N) * (as above)
So, the first is a pair of asymmetric transformations, the second is symmetric. With an asymmetric pair, rounding errors are greater at bright points in the image (some pixels are rounded slightly outside the range of values (for example, 256). With a symmetric pair, errors are more in the constant middle region of the image (not exceeding the range of values!) In general, it seems that a symmetric pair produces slightly more rounding errors.
Then it also depends on the input: when the image saved in [0.255], rounding errors are different from when in [0.1].
So my question is: how should the optimal, most accurate algorithm (theoretically, without code) be implemented: an asymmetric / symmetric pair? range of input values in [0.255] or [0.1]? How is the linear result of scaling before saving the log file?
Edit
DFT. , :
sum_re += f_re * cos(-mode*pi*((2.0*v*y)/N)) - // mode = 1 for forward, -1
f_im * sin(-mode*pi*((2.0*v*y)/N)); // for inverse transform
// sum_im permutated in the known way and + instead of -
indside cos sin ( , , cos(-mode*2*pi*v*y/N)), / transcedental pi , . ?
1/M*N 1/sqrt(M*N) . ? ?
input->transform->save-to-file->read-from-file->transform^-1->output : input->transform->transform^-1->output.
8- 704x528 ( = ):
- [0,1] : delta = 2.6609e-13 ( 6.785295e-11 [0,255]).
- insde [0,1] : delta = 2.65232e-13 ( 6.763416e-11 [0,255]).
- [0,255] : delta = 6.74731e-11.
- [0,255] : delta = 6.7871e-11.
, . , 16- .
, - - ( ) , .
, : : ? : [0,1] [0,255]? : . [0, M * N] , [0,1] [0,255] [0,255 * M * N]?