Normalised cross correlation

Malcolm Reynolds malcolm.reynolds at gmail.com
Tue Mar 20 12:12:04 EDT 2012


>
>
> Wow, those results are incredibly different. Yes, please put together a 
> small script to reproduce the different behaviors (ideally, with the matlab 
> result saved as .npy---or if it's easier .mat---file; also, if you can 
> reproduce with a smaller image, that would be great).
>
> It'll be easy to check for switched arguments, but the rest might 
> take some time for me to get to. In your original email, it sounded like 
> you have some expertise in template matching; feel free to dig into the 
> code and see if you can spot any errors in the code.
>
> Cheers,
> -Tony
>

I've quickly whipped up some scripts in both matlab (if you have access to 
that) and python and put them 
here: https://github.com/malcolmreynolds/NCC-test-program - if you don't 
have access to matlab, then the .mat file included should contain the 
inputs and outputs from matlab's normxcorr2. To run it you just need to put 
any image called 'lena.png' in the directory and then I ran 'ipython 
--pylab -i run_ncc.py' at the shell on OS X. You may have your plotting set 
up a different way, or not use pylab, but if all else fails the result 
images are written out as pngs (also included in the repository). With 
matlab just get to the matlab prompt and do "run_ncc".

For reference, this is what I see when using a 256x256 downsampled version 
of the lena image: 
http://img843.imageshack.us/img843/2729/screenshot20120320at155.png 
 (matlab on left, middle and right are python with and without the 
pad_output flag).

I'm afraid I'm definitely not an expert on template matching, but I reckon 
it's pretty crucial to have a good free (&fast!) implementation available 
in numpy/scipy/skimage in order to compete.. I will take a dig through your 
code sometime but unfortunately deadlines are always looming for me.. I'll 
hopefully get a chance this coming weekend.

Thanks for your quick response, let me know if you have any problems with 
the stuff on github.

Malcolm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20120320/d86a19bf/attachment.html>


More information about the scikit-image mailing list