The power specturm is simply the square of the two dimensional Fourier transform:
P
k
x
,
k
y
=
∣
F
k
x
,
k
y
2
∣
P
k
x
,
k
y
=
∣
F
k
x
,
k
y
2
∣
size 12{P left (k rSub { size 8{x} } ,k rSub { size 8{y} } right )= lline F left (k rSub { size 8{x} } ,k rSub { size 8{y} } right ) rSup { size 8{2} } rline } {}
(2)where the two dimensional Fourier transform is given by:
F
k
x
,
k
y
=
∑
x
=
0
N
−
1
∑
y
=
0
N
−
1
f
k
x
,
k
y
2
e
−
j2π
N
xk
x
+
yk
y
F
k
x
,
k
y
=
∑
x
=
0
N
−
1
∑
y
=
0
N
−
1
f
k
x
,
k
y
2
e
−
j2π
N
xk
x
+
yk
y
size 12{F left (k rSub { size 8{x} } ,k rSub { size 8{y} } right )= Sum cSub { size 8{x=0} } cSup { size 8{N - 1} } { Sum cSub { size 8{y=0} } cSup { size 8{N - 1} } {f left (k rSub { size 8{x} } ,k rSub { size 8{y} } right ) rSup { size 8{2} } } } e rSup { size 8{ { { - j2π} over {N} } left ( ital "xk" rSub { size 6{x} } + ital "yk" rSub { size 6{y} } right )} } } {}
(3)Note that denotes an individual image pixel. You may have noticed that the above equations define a square image. While a non-symmetric two dimensional Fourier transform exists, using square images eases the process.
Because whether or not an image is in focus depends on the magnitude of power as a function of frequency, once the two dimensional power spectrum is computed as above, we radially average the spectrum. That is, the average of the values which lie on a circle a distance R from the origin is taken. Because frequency increases linearly in all directions from the origin, radially averaging the power spectrum gives the average power at one frequency, effectively collapsing the two dimensional spectrum to one dimension. It should be noted that
Fkx,kyFkx,ky size 12{F left (k rSub { size 8{x} } ,k rSub { size 8{y} } right )} {} has been centered around baseband, meaning the frequency of the rotionally averaged power spectrum extends from 0 to N/2 -1.
The power spectrum’s falloff on a loglog plot can now be examined to determine focus.