From f18be31822bf6e9cb22cac8374239d64ffc480d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Boulogne?= Date: Fri, 22 Mar 2013 23:12:05 +0100 Subject: [PATCH] Fix and improve example --- doc/source/plots/hough_tf.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/source/plots/hough_tf.py b/doc/source/plots/hough_tf.py index ea2fc4bb..df1dcd31 100644 --- a/doc/source/plots/hough_tf.py +++ b/doc/source/plots/hough_tf.py @@ -2,13 +2,14 @@ import numpy as np import matplotlib.pyplot as plt from skimage.transform import hough_line +from skimage.draw import line img = np.zeros((100, 150), dtype=bool) img[30, :] = 1 img[:, 65] = 1 img[35:45, 35:50] = 1 -for i in range(90): - img[i, i] = 1 +rr, cc = line(60, 130, 80, 10) +img[rr, cc] = 1 img += np.random.random(img.shape) > 0.95 out, angles, d = hough_line(img) @@ -20,8 +21,8 @@ plt.title('Input image') plt.subplot(1, 2, 2) plt.imshow(out, cmap=plt.cm.bone, - extent=(np.rad2deg(angles[0]), np.rad2deg(angles[-1]), - d[0], d[-1])) + extent=(np.rad2deg(angles[-1]), np.rad2deg(angles[0]), + d[-1], d[0])) plt.title('Hough transform') plt.xlabel('Angle (degree)') plt.ylabel('Distance (pixel)')