mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-10 14:59:17 +08:00
Update Hessian matrix tests to match new values
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user