From 5d79537566c0e1df94326e23ad5bc4162ce27694 Mon Sep 17 00:00:00 2001 From: Tony S Yu Date: Sat, 24 Mar 2012 17:42:36 -0400 Subject: [PATCH] Fix convolution input to get correlation results. --- 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 b0f6dc66..7f31d31e 100644 --- a/skimage/feature/_template.pyx +++ b/skimage/feature/_template.pyx @@ -101,8 +101,10 @@ def match_template(np.ndarray[float, ndim=2, mode="c"] image, inv_area = 1.0 / (template.shape[0] * template.shape[1]) # when `dtype=float` is used, ascontiguousarray returns ``double``. - corr = np.ascontiguousarray(fftconvolve(image, np.fliplr(template), - mode="valid"), dtype=np.float32) + corr = np.ascontiguousarray(fftconvolve(image, + np.flipud(np.fliplr(template)), + mode="valid"), + dtype=np.float32) cdef int i, j cdef float den, window_sqr_sum, window_mean_sqr, window_sum,