mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-06 05:16:40 +08:00
changed parameter of hessian_matrix_det
This commit is contained in:
@@ -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']
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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))
|
||||
|
||||
|
||||
|
||||
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user