[SciPy-User] Template Matching via fftconvolve

Brandon Lerner lernerbrandon2@gmail....
Sun Feb 24 10:34:37 CST 2013


Hi all,

I've been trying to write a program that will find all matches of a smaller
image in a bigger image by using fftconvolve to do a normalized cross
correlation of  two differently sized 2D numpy arrays.

I've written a brute force pixel by pixel comparison that works but it is
way too slow for me to use. Any guidance to someone new at SciPy is
appreciated. After days of research, I've found some discussions about
this, but I can't figure out what to do next (look at attached code for an
example):

http://stackoverflow.com/questions/7670112/finding-a-subimage-inside-a-numpy-image
http://stackoverflow.com/questions/12715673/numpy-template-matching-using-matrix-multiplications
http://dsp.stackexchange.com/questions/736/how-do-i-implement-cross-correlation-to-prove-two-audio-files-are-similar
http://stackoverflow.com/questions/4196453/simple-and-fast-method-to-compare-images-for-similarity

Note: I've also found cv2 (cv2.templateMatch) or skimage(matchTemplate),
but I want to learn the math behind all of this.

Best,
B
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20130224/c6368b57/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: templatematch.py
Type: application/octet-stream
Size: 2045 bytes
Desc: not available
Url : http://mail.scipy.org/pipermail/scipy-user/attachments/20130224/c6368b57/attachment.obj 


More information about the SciPy-User mailing list