From 495d214239a1e5149afeceeae4e919c739edd9f3 Mon Sep 17 00:00:00 2001 From: Stefan van der Walt Date: Tue, 28 Sep 2010 14:15:48 +0200 Subject: [PATCH] BUG: Hough failed on provision of angles argument. --- scikits/image/transform/hough_transform.py | 4 ++-- .../image/transform/tests/test_hough_transform.py | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/scikits/image/transform/hough_transform.py b/scikits/image/transform/hough_transform.py index 243bda8d..2342c2f0 100644 --- a/scikits/image/transform/hough_transform.py +++ b/scikits/image/transform/hough_transform.py @@ -1,4 +1,4 @@ -## Copyright (C) 2006 Stefan van der Walt +## Copyright (C) 2005 Stefan van der Walt ## ## Redistribution and use in source and binary forms, with or without ## modification, are permitted provided that the following conditions are @@ -78,7 +78,7 @@ def hough(img, angles=None): img = img.astype(bool) - if not angles: + if angles is None: angles = np.linspace(-90,90,180) theta = angles / 180. * np.pi diff --git a/scikits/image/transform/tests/test_hough_transform.py b/scikits/image/transform/tests/test_hough_transform.py index 3bc1e6c9..a8c31d58 100644 --- a/scikits/image/transform/tests/test_hough_transform.py +++ b/scikits/image/transform/tests/test_hough_transform.py @@ -16,3 +16,15 @@ def test_hough(): assert_equal(out.max(), 100) assert_equal(len(angles), 180) + +def test_hough_angles(): + img = np.zeros((10, 10)) + img[0, 0] = 1 + + out, angles, d = hough(img, np.linspace(0, 360, 10)) + + assert_equal(len(angles), 10) + +if __name__ == "__main__": + run_module_suite() +