diff --git a/scikits/image/transform/hough_transform.py b/scikits/image/transform/hough_transform.py index c2e880a8..243bda8d 100644 --- a/scikits/image/transform/hough_transform.py +++ b/scikits/image/transform/hough_transform.py @@ -50,22 +50,28 @@ def hough(img, angles=None): Examples -------- - # Generate a test image - 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 - img += np.random.random(img.shape) > 0.95 + Generate a test image: - out, angles, d = houghtf(img) + >>> 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 + >>> img += np.random.random(img.shape) > 0.95 + + Apply the Hough transform: + + >>> out, angles, d = houghtf(img) + + Plot the results: + + >>> import matplotlib.pyplot as plt + >>> plt.imshow(out, cmap=plt.cm.bone) + >>> plt.xlabel('Angle (degree)') + >>> plt.ylabel('Distance %d (pixel)' % d[0]) + >>> plt.show() - import matplotlib.pyplot as plt - plt.imshow(out, cmap=plt.cm.bone) - plt.xlabel('Angle (degree)') - plt.ylabel('Distance %d (pixel)' % d[0]) - plt.show() """ if img.ndim != 2: raise ValueError("Input must be a two-dimensional array")