diff --git a/skimage/feature/__init__.py b/skimage/feature/__init__.py index 6a933056..c46fde01 100644 --- a/skimage/feature/__init__.py +++ b/skimage/feature/__init__.py @@ -26,7 +26,7 @@ __all__ = ['daisy', 'structure_tensor', 'structure_tensor_eigvals', 'hessian_matrix', - 'hessian_matrx_det', + 'hessian_matrix_det', 'hessian_matrix_eigvals', 'corner_kitchen_rosenfeld', 'corner_harris', @@ -45,5 +45,4 @@ __all__ = ['daisy', 'plot_matches', 'blob_dog', 'blob_doh', - 'blob_log', - 'hessian_matrix_det'] + 'blob_log'] diff --git a/skimage/feature/_hessian_det_appx.pyx b/skimage/feature/_hessian_det_appx.pyx index e66c0d53..7f5a403e 100644 --- a/skimage/feature/_hessian_det_appx.pyx +++ b/skimage/feature/_hessian_det_appx.pyx @@ -4,8 +4,6 @@ # cython: wraparound=False import numpy as np cimport numpy as cnp -from skimage.transform import integral_image, integrate -from skimage import util cdef inline Py_ssize_t _clip(Py_ssize_t x, Py_ssize_t low, Py_ssize_t high): @@ -78,7 +76,7 @@ cdef inline cnp.double_t _integ( return ans -def _hessian_matrix_det(cnp.double_t[:, ::1] img, float sigma): +def _hessian_matrix_det(cnp.double_t[:, ::1] img, double sigma): """Computes the approximate Hessian Determinant over an image. This method uses box filters over integral images to compute the diff --git a/skimage/feature/corner.py b/skimage/feature/corner.py index 1889d799..e1dd519b 100644 --- a/skimage/feature/corner.py +++ b/skimage/feature/corner.py @@ -31,7 +31,7 @@ def _compute_derivatives(image, mode='constant', cval=0): imy : ndarray Derivative in y-direction. -v """ + """ imy = ndimage.sobel(image, axis=0, mode=mode, cval=cval) imx = ndimage.sobel(image, axis=1, mode=mode, cval=cval) @@ -172,7 +172,7 @@ def hessian_matrix(image, sigma=1, mode='constant', cval=0): return Hxx, Hxy, Hyy -def hessian_matrix_det(image, sigma, integral=True): +def hessian_matrix_det(image, sigma): """Computes the approximate Hessian Determinant over an image. This method uses box filters over integral images to compute the @@ -184,11 +184,7 @@ def hessian_matrix_det(image, sigma, integral=True): The image over which to compute Hessian Determinant. sigma : float Standard deviation used for the Gaussian kernel, used for the Hessian - matrix - integral : bool - If `False`, `image` is assumed to be integral and intergral image is - not computed. If `True` the integral image is computed for `image` - and used for finding the Hessian Determinant. + matrix. Returns ------- @@ -211,9 +207,7 @@ def hessian_matrix_det(image, sigma, integral=True): """ image = img_as_float(image) - if(integral): - image = integral_image(image) - + image = integral_image(image) return np.array(_hessian_matrix_det(image, sigma)) diff --git a/skimage/feature/tests/test_corner.py b/skimage/feature/tests/test_corner.py index dd9f7703..3d59a495 100644 --- a/skimage/feature/tests/test_corner.py +++ b/skimage/feature/tests/test_corner.py @@ -93,9 +93,12 @@ def test_hessian_matrix_eigvals(): def test_hessian_matrix_det(): - image = np.ones((5, 5)) - det = hessian_matrix_det(image, 3, False) - assert_array_equal(det, 0) + image = np.zeros((5, 5)) + image[2, 2] = 1 + det = hessian_matrix_det(image, 5) + + + assert_almost_equal(det, 0, decimal = 3) def test_square_image():