如何使用PIL库查找子图像? [英] How to find subimage using the PIL library?
本文介绍了如何使用PIL库查找子图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用PIL库从大图像中查找子图像.我还想知道在哪里找到坐标?
I want to find the sub-image from large image using PIL library. I also want to know the coordinates where it is found ?
推荐答案
import cv2
import numpy as np
image = cv2.imread("Large.png")
template = cv2.imread("small.png")
result = cv2.matchTemplate(image,template,cv2.TM_CCOEFF_NORMED)
print np.unravel_index(result.argmax(),result.shape)
这对我来说很好且有效.
This works fine and in efficient way for me.
这篇关于如何使用PIL库查找子图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文