-1
$\begingroup$

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

$\endgroup$
-1
$\begingroup$

So after doing some reading, and looking at this matlab article I should be getting a 1 when I do this. As stated here in this matlab link "To prevent obtaining a magnitude-squared coherence estimate, which is identically 1 for all frequencies, you must use an averaged MSC estimator. " So because I was not using an MSC estimator, and simply just using calculating the power, I continued to get a 1 for my answer.

| improve this answer | |
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.