Template Matching (Image Search) function in Python Imaging Library

吃可爱长大的小学妹 提交于 2019-12-04 22:54:43

This is likely best done as an inverse convolution or correlation. Numpy/scipy has code to do both.

edit: including a little example.

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

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

you can see that the highest values of the correlation are centered around where the subset of the image was taken. note that for large kernels or images, this code can take a while (because correlation is expensive)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!