From 4c4bb4f44476d1f96a311c8fdaf8170b2130ea5a Mon Sep 17 00:00:00 2001 From: Juan Nunez-Iglesias Date: Sat, 16 Jul 2016 18:59:23 -0500 Subject: [PATCH] Update Hessian matrix tests to match new values --- skimage/feature/tests/test_corner.py | 56 ++++++++++++++-------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/skimage/feature/tests/test_corner.py b/skimage/feature/tests/test_corner.py index a5bc392a..bd6c14e9 100644 --- a/skimage/feature/tests/test_corner.py +++ b/skimage/feature/tests/test_corner.py @@ -40,23 +40,25 @@ def test_structure_tensor(): def test_hessian_matrix(): square = np.zeros((5, 5)) - square[2, 2] = 1 + square[2, 2] = 4 Hxx, Hxy, Hyy = hessian_matrix(square, sigma=0.1) - assert_almost_equal(Hxx, np.array([[0, 0, 0, 0, 0], - [0, 0, 0, 0, 0], - [0, 0, -1591.549431, 0, 0], - [0, 0, 0, 0, 0], - [0, 0, 0, 0, 0]])) - assert_almost_equal(Hxy, np.array([[0, 0, 0, 0, 0], - [0, 0, 0, 0, 0], - [0, 0, 0, 0, 0], - [0, 0, 0, 0, 0], - [0, 0, 0, 0, 0]])) - assert_almost_equal(Hyy, np.array([[0, 0, 0, 0, 0], - [0, 0, 0, 0, 0], - [0, 0, -1591.549431, 0, 0], - [0, 0, 0, 0, 0], - [0, 0, 0, 0, 0]])) + assert_almost_equal(Hxx, np.array([[0, 0, 0, 0, 0], + [0, 0, 0, 0, 0], + [2, 0, -2, 0, 2], + [0, 0, 0, 0, 0], + [0, 0, 0, 0, 0]])) + + assert_almost_equal(Hxy, np.array([[0, 0, 0, 0, 0], + [0, 1, 0, -1, 0], + [0, 0, 0, 0, 0], + [0, -1, 0, 1, 0], + [0, 0, 0, 0, 0]])) + + assert_almost_equal(Hyy, np.array([[0, 0, 2, 0, 0], + [0, 0, 0, 0, 0], + [0, 0, -2, 0, 0], + [0, 0, 0, 0, 0], + [0, 0, 2, 0, 0]])) def test_structure_tensor_eigvals(): @@ -78,19 +80,19 @@ def test_structure_tensor_eigvals(): def test_hessian_matrix_eigvals(): square = np.zeros((5, 5)) - square[2, 2] = 1 + square[2, 2] = 4 Hxx, Hxy, Hyy = hessian_matrix(square, sigma=0.1) l1, l2 = hessian_matrix_eigvals(Hxx, Hxy, Hyy) - assert_almost_equal(l1, np.array([[0, 0, 0, 0, 0], - [0, 0, 0, 0, 0], - [0, 0, -1591.549431, 0, 0], - [0, 0, 0, 0, 0], - [0, 0, 0, 0, 0]])) - assert_almost_equal(l2, np.array([[0, 0, 0, 0, 0], - [0, 0, 0, 0, 0], - [0, 0, -1591.549431, 0, 0], - [0, 0, 0, 0, 0], - [0, 0, 0, 0, 0]])) + assert_almost_equal(l1, np.array([[0, 0, 2, 0, 0], + [0, 1, 0, 1, 0], + [2, 0, -2, 0, 2], + [0, 1, 0, 1, 0], + [0, 0, 2, 0, 0]])) + assert_almost_equal(l2, np.array([[0, 0, 0, 0, 0], + [0, -1, 0, -1, 0], + [0, 0, -2, 0, 0], + [0, -1, 0, -1, 0], + [0, 0, 0, 0, 0]])) @test_parallel()