Re: Normalised cross correlation
![](https://secure.gravatar.com/avatar/b80364cc6fbb2eac7dcfdb7738bae083.jpg?s=120&d=mm&r=g)
2012/3/27 Stéfan van der Walt <stefan@sun.ac.za>
On Mon, Mar 26, 2012 at 6:36 PM, Tony Yu <tsyu80@gmail.com> wrote:
Thanks for checking. What do you mean by "correct position in the correlation"?
It looked like you took the result of np.correlate, and then normalized those coefficients. I wasn't sure (didn't verify) whether the normalization was computed for the correct position in the np.correlate result.
Yes, you're correct---not sure why I was confused by before.
Hmm, I was under the impression that half-template matches would be appropriately penalized.
That explanation seems reasonable--such behaviour seems totally sane.
Stéfan
I added some commits to the template PR<https://github.com/scikits-image/scikits-image/pull/100>. I changed the interface: `pad_output` is replaced by `pad_input`, which defaults to False. When True, the input image is padded with a border that is half the template dimensions on each side, and the padding value is the image mean, as Mike suggested. Note that this function still does not produce results similar to Matlab's; no one made the case for it, so I left it out (and as Stefan pointed out: the user can manually pad the input if such a result is desired). Are people happy with this interface? I added a simpler example plot<https://github.com/scikits-image/scikits-image/pull/100/files#diff-0>to the gallery, but there should probably only be a single example. Personally, I prefer the simpler plot. (The more complex plot<https://github.com/scikits-image/scikits-image/pull/100/files#diff-1>, however, is more "realistic" since it has noise and uses a peak detector.) Any objections to removing the complex plot? -Tony
participants (1)
-
Tony Yu