Pattern Matching Function (Image Search) in Python Image Library

I have a problem when I need to look for a pattern (present as numpy ndarray) in another image (also represented as numpy ndarray) and calculate pattern matching (minimum difference position in the image). My question is: is there an inline image that I can use in the Python or Numpy image library, or anything else that can do this without me, manually writing a function for this?

Thanks....

0
source share
1 answer

This is most likely best done as reverse convolution or correlation. Numpy / scipy has code for both.

edit: including a small example.

Go here for the ipython laptop file: http://nbviewer.ipython.org/4020770/

I made a little gaussian and then used scipy.signal.correlate2d with the original image and a small subset.

You can see that the highest correlation values ​​are centered around the subset of the image. note that for large kernels or images this code may take some time (because correlation is expensive)

+1
source

All Articles