From e8eb2de6e993f7925ca5cc19370b508ee3fcd203 Mon Sep 17 00:00:00 2001 From: Ankit Agrawal Date: Wed, 4 Sep 2013 19:08:57 +0530 Subject: [PATCH] Adding explicit test for corner_orientations --- skimage/feature/tests/test_corner.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/skimage/feature/tests/test_corner.py b/skimage/feature/tests/test_corner.py index 16566589..200c9e2a 100644 --- a/skimage/feature/tests/test_corner.py +++ b/skimage/feature/tests/test_corner.py @@ -280,6 +280,17 @@ def test_corner_orientations_lena(): assert_almost_equal(actual, expected) +def test_corner_orientations_square(): + square = np.zeros((12, 12)) + square[3:9, 3:9] = 1 + corners = corner_peaks(corner_fast(square, 9), min_distance=1) + actual_orientations = corner_orientations(square, corners, octagon(3, 2)) + actual_orientations_degrees = np.rad2deg(actual_orientations) + expected_orientations_degree = np.array([ 45., 135., -45., -135.]) + assert_array_equal(actual_orientations_degrees, + expected_orientations_degree) + + if __name__ == '__main__': from numpy import testing testing.run_module_suite()