From 94262bc8d6d12ae6910e7e1af33b963ccc296b61 Mon Sep 17 00:00:00 2001 From: Tony S Yu Date: Thu, 1 Mar 2012 23:05:17 -0500 Subject: [PATCH] Tweak example to reduce confusion. Set background 1 so that the template has values equally-above and -below the mean image value. This change makes the template results left-right symmetric, which may reduce confusion. --- doc/examples/plot_template.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/examples/plot_template.py b/doc/examples/plot_template.py index 3aea93d9..3ebb9070 100644 --- a/doc/examples/plot_template.py +++ b/doc/examples/plot_template.py @@ -16,18 +16,18 @@ template. import numpy as np from skimage.feature import match_template, peak_local_max -from numpy.random import randn import matplotlib.pyplot as plt # We first construct a simple image target: size = 100 target = np.tri(size) + np.tri(size)[::-1] # place target in an image at two positions, and add noise. -image = np.zeros((400, 400)) +image = np.ones((400, 400)) target_positions = [(50, 50), (200, 200)] for x, y in target_positions: image[x:x+size, y:y+size] = target -image += randn(400, 400)*2 +np.random.seed(1) +image += np.random.randn(400, 400)*2 result = match_template(image, target)