mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-16 10:34:50 +08:00
moved public interface of hessian determinant to corner.py
This commit is contained in:
@@ -7,6 +7,8 @@ from skimage.util import img_as_float, pad
|
||||
from skimage.feature import peak_local_max
|
||||
from skimage.feature.util import _prepare_grayscale_input_2D
|
||||
from skimage.feature.corner_cy import _corner_fast
|
||||
from ._hessian_det_appx import _hessian_matrix_det
|
||||
from ..transform import integral_image
|
||||
|
||||
|
||||
def _compute_derivatives(image, mode='constant', cval=0):
|
||||
@@ -29,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)
|
||||
@@ -170,6 +172,52 @@ def hessian_matrix(image, sigma=1, mode='constant', cval=0):
|
||||
return Hxx, Hxy, Hyy
|
||||
|
||||
|
||||
def hessian_matrix_det(image, sigma, integral=True):
|
||||
"""Computes the approximate Hessian Determinant over an image.
|
||||
|
||||
This method uses box filters over integral images to compute the
|
||||
approximate Hessian Determinant as described in [1]_.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
image : array
|
||||
The integral 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.
|
||||
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : array
|
||||
The array of the Determinant of Hessians.
|
||||
|
||||
References
|
||||
----------
|
||||
.. [1] Herbert Bay, Andreas Ess, Tinne Tuytelaars, Luc Van Gool,
|
||||
"SURF: Speeded Up Robust Features"
|
||||
ftp://ftp.vision.ee.ethz.ch/publications/articles/eth_biwi_00517.pdf
|
||||
|
||||
Notes
|
||||
-----
|
||||
The running time of this method only depends on size of the image. It is
|
||||
independent of `sigma` as one would expect. The downside is that the
|
||||
result for `sigma` less than `3` is not accurate, i.e., not similar to
|
||||
the result obtained if someone computed the Hessian and took it's
|
||||
determinant.
|
||||
"""
|
||||
|
||||
image = img_as_float(image)
|
||||
if(integral):
|
||||
image = integral_image(image)
|
||||
|
||||
return np.array(_hessian_matrix_det(image, sigma))
|
||||
|
||||
|
||||
def _image_orthogonal_matrix22_eigvals(M00, M01, M11):
|
||||
l1 = (M00 + M11) / 2 + np.sqrt(4 * M01 ** 2 + (M00 - M11) ** 2) / 2
|
||||
l2 = (M00 + M11) / 2 - np.sqrt(4 * M01 ** 2 + (M00 - M11) ** 2) / 2
|
||||
|
||||
Reference in New Issue
Block a user