I've got in total 6 images, from 2 cameras (thus 3 per camera) storing 16 bit data.
What I need to feedback to the user is like some sort of sharpness coefficient, preferably live while he is adjusting the focus of the whole system (since its looking into the eyes, it depends on the dioptres of the patient).
What I am currently using is a contrast coefficient combined with standard deviation, which should work fine, but with a change of the focus the field of view changes slightly, which can impact the contrast.
Now I wonder when I move to use the FFTW library to get the FFT of my image, it results in an array of fftw_complex (which is double).
For my purpose, it should be fine to calculate the average of the resulting array, but I don't understand how to mangle real / complex components in this. Do I iterate over the whole array, calculate sum equalling sum of double and double, or am I totally wrong here? I don't really understand why there is a real and a complex component. I understand that the FFT results in coefficients for different frequency sinus waves, but the frequency of the wave depends on its position in the array, while the amplitude should be the real component. Is the combination of real and complex variable responsible for the direction in the image, or what is it used for, and how would I use it to get an idea of an "average" frequency (sharpness) in the image?