From 610f5898af3f017e815dbb39cf716e0b16133c16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Sch=C3=B6nberger?= Date: Sun, 3 Nov 2013 08:51:51 +0100 Subject: [PATCH] Fix corner doc tests --- skimage/feature/corner.py | 74 +++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/skimage/feature/corner.py b/skimage/feature/corner.py index 53b2241e..0d7e1d3e 100644 --- a/skimage/feature/corner.py +++ b/skimage/feature/corner.py @@ -147,19 +147,19 @@ def corner_harris(image, method='k', k=0.05, eps=1e-6, sigma=1): Examples -------- >>> from skimage.feature import corner_harris, corner_peaks - >>> square = np.zeros([10, 10]) + >>> square = np.zeros([10, 10], dtype=int) >>> square[2:8, 2:8] = 1 >>> square - array([[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - [ 0, 0, 1, 1, 1, 1, 1, 1, 0, 0], - [ 0, 0, 1, 1, 1, 1, 1, 1, 0, 0], - [ 0, 0, 1, 1, 1, 1, 1, 1, 0, 0], - [ 0, 0, 1, 1, 1, 1, 1, 1, 0, 0], - [ 0, 0, 1, 1, 1, 1, 1, 1, 0, 0], - [ 0, 0, 1, 1, 1, 1, 1, 1, 0, 0], - [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) + array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 1, 1, 1, 1, 1, 1, 0, 0], + [0, 0, 1, 1, 1, 1, 1, 1, 0, 0], + [0, 0, 1, 1, 1, 1, 1, 1, 0, 0], + [0, 0, 1, 1, 1, 1, 1, 1, 0, 0], + [0, 0, 1, 1, 1, 1, 1, 1, 0, 0], + [0, 0, 1, 1, 1, 1, 1, 1, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) >>> corner_peaks(corner_harris(square), min_distance=1) array([[2, 2], [2, 7], @@ -217,19 +217,19 @@ def corner_shi_tomasi(image, sigma=1): Examples -------- >>> from skimage.feature import corner_shi_tomasi, corner_peaks - >>> square = np.zeros([10, 10]) + >>> square = np.zeros([10, 10], dtype=int) >>> square[2:8, 2:8] = 1 >>> square - array([[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - [ 0, 0, 1, 1, 1, 1, 1, 1, 0, 0], - [ 0, 0, 1, 1, 1, 1, 1, 1, 0, 0], - [ 0, 0, 1, 1, 1, 1, 1, 1, 0, 0], - [ 0, 0, 1, 1, 1, 1, 1, 1, 0, 0], - [ 0, 0, 1, 1, 1, 1, 1, 1, 0, 0], - [ 0, 0, 1, 1, 1, 1, 1, 1, 0, 0], - [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) + array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 1, 1, 1, 1, 1, 1, 0, 0], + [0, 0, 1, 1, 1, 1, 1, 1, 0, 0], + [0, 0, 1, 1, 1, 1, 1, 1, 0, 0], + [0, 0, 1, 1, 1, 1, 1, 1, 0, 0], + [0, 0, 1, 1, 1, 1, 1, 1, 0, 0], + [0, 0, 1, 1, 1, 1, 1, 1, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) >>> corner_peaks(corner_shi_tomasi(square), min_distance=1) array([[2, 2], [2, 7], @@ -283,28 +283,28 @@ def corner_foerstner(image, sigma=1): Examples -------- >>> from skimage.feature import corner_foerstner, corner_peaks - >>> square = np.zeros([10, 10]) + >>> square = np.zeros([10, 10], dtype=int) >>> square[2:8, 2:8] = 1 >>> square - array([[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - [ 0, 0, 1, 1, 1, 1, 1, 1, 0, 0], - [ 0, 0, 1, 1, 1, 1, 1, 1, 0, 0], - [ 0, 0, 1, 1, 1, 1, 1, 1, 0, 0], - [ 0, 0, 1, 1, 1, 1, 1, 1, 0, 0], - [ 0, 0, 1, 1, 1, 1, 1, 1, 0, 0], - [ 0, 0, 1, 1, 1, 1, 1, 1, 0, 0], - [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) + array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 1, 1, 1, 1, 1, 1, 0, 0], + [0, 0, 1, 1, 1, 1, 1, 1, 0, 0], + [0, 0, 1, 1, 1, 1, 1, 1, 0, 0], + [0, 0, 1, 1, 1, 1, 1, 1, 0, 0], + [0, 0, 1, 1, 1, 1, 1, 1, 0, 0], + [0, 0, 1, 1, 1, 1, 1, 1, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) >>> w, q = corner_foerstner(square) >>> accuracy_thresh = 0.5 >>> roundness_thresh = 0.3 >>> foerstner = (q > roundness_thresh) * (w > accuracy_thresh) * w >>> corner_peaks(foerstner, min_distance=1) - array([[2, 2], - [2, 7], - [7, 2], - [7, 7]]) + array([[3, 3], + [3, 6], + [6, 3], + [6, 6]]) """