2D FFT of Image and Sharpness

I'm trying to make some simply autofocus algorithm for my device and pretty confused with 2D FFT results. As I know for now - number of high-frequency's components in 2D FFT will say me that image is more focused, than other one where 2D FFT got more low-frequency's components. And i do not know how to calculate this parameter.

I'm thinking about applying high-pass filter, but how i should choose cut-off frequency? In 1D FFT it's pretty simple to determine just looking at the picture of 1D FFT..

• You will have to do a 3d plot, and based on the plot you can know where most of your energy concentrated. – Adel Bibi Jul 7 '14 at 19:43
• If you're using Matlab, have a look at this, based on this paper. – Pokey McPokerson Jul 8 '14 at 7:32
• Thanks for answers. But, anyway even with 3d plot how i can get some numbers from 2D FFT for high-frequency and low-frequency? If I'm working with 1D FFT with some signal, there is mathematical equalition which can take me from bins to frequency. If i will switch (and i will) from Matlab to c# i wont be able to plot 3d graphics in my application. – Araxnid Jul 9 '14 at 13:21