NumPy/SciPy: 在图像上移动掩码并检查相等性
1 个回答
3
你可以使用scipy.ndimage.correlate这个工具,把你的模板和图片进行对比。然后找出那些亮点,这些亮点就是你要找的匹配部分。举个例子:
import scipy.ndimage
from numpy import mean, std
# a, b contain image and template in numpy arrays
correlation = scipy.ndimage.correlate(a, b)
matches = (correlation-mean(correlation)) > 5*std(correlation) # tune depending on level of noise