# How to implement Cross Spectral Density [duplicate]

I am writing a program to compute the cross spectral density of an image, and a template image, which is the image I am trying to find in other image.

Reading wiki1,wiki2,wiki3 from wikipedia, and from my knowledge of dsp I want to verify that I did this correctly because I keep getting 1 as my answer.

So if I have two images of equal size in the fourier domain and point $(0,0)$ for one image is $3+2i$ and point $(0,0)$ of the other "template" (the image I am trying to find) is $4+2i$

1. First I would do correlation so I take the conjugate of the template and multiply so I do $(3+2i)(4-2i)$ and get my $G_{xy}= 16+2i$
2. Then I would auto correlate the image with itself $(3+2i)(3-2i)$ to get $13+0i$, and correlate the template with itself $(4+2i)(4-2i)$ and get $20+0i$. So my $G_{xx} = 13+0i$ and my $G_{yy} = 20+0i$
3. Then I would get $\left|G_{xy}\right|^2$ which is $16^2 + 2^2 = 260$
4. Lastly I would get the cross spectral coherence by doing the power of the cross correlation squared divided by the power of the image correlated with itself, multiplied by the power of template correlated with itself or $\frac {\left|G_{xy}\right|^2}{\left(G_{xx}G_{yy}\right)}$, or $\frac {260}{(13+0i)(20+0i)}$

As you can see I would get $1$, but I am unsure of what I am interpreting wrong in the wiki articles. Can someone be of assistance and enlighten me? Thanks