From 883dd24cdb4b518d6b5bd30813afe4d42541674d Mon Sep 17 00:00:00 2001 From: Tony S Yu Date: Wed, 29 Feb 2012 00:34:04 -0500 Subject: [PATCH] Fix bug when indexing into summed-area table. --- skimage/feature/_template.pyx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/skimage/feature/_template.pyx b/skimage/feature/_template.pyx index 77eea3f9..0c3145f1 100644 --- a/skimage/feature/_template.pyx +++ b/skimage/feature/_template.pyx @@ -94,8 +94,10 @@ def match_template(np.ndarray[float, ndim=2, mode="c"] image, for i in range(result.shape[0]): for j in range(result.shape[1]): num = result[i, j] - i_end = i + template.shape[0] - j_end = j + template.shape[1] + # subtract 1 because `i_end` and `j_end` are used for indexing into + # summed-area table, instead of slicing windows of the image. + i_end = i + template.shape[0] - 1 + j_end = j + template.shape[1] - 1 window_mean2 = 0 if method == 'norm-coeff':