bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / feature / corner / hessian_matrix
function
skimage.feature.corner:hessian_matrix
source: /dev/scikit-image/src/skimage/feature/corner.py :224
Signature
def hessian_matrix ( image , sigma = 1 , mode = constant , cval = 0 , order = rc , use_gaussian_derivatives = None ) Summary
Compute the Hessian matrix.
Extended Summary
In 2D, the Hessian matrix is defined as
H = [Hrr Hrc] [Hrc Hcc]
which is computed by convolving the image with the second derivatives of the Gaussian kernel in the respective r- and c-directions.
The implementation here also supports n-dimensional data.
Parameters
image: ndarrayInput image.
sigma: floatStandard deviation used for the Gaussian kernel, which is used as weighting function for the auto-correlation matrix.
mode: {'constant', 'reflect', 'wrap', 'nearest', 'mirror'}, optionalHow to handle values outside the image borders.
cval: float, optionalUsed in conjunction with mode 'constant', the value outside the image boundaries.
order: {'rc', 'xy'}, optionalFor 2D images, this parameter allows for the use of reverse or forward order of the image axes in gradient computation. 'rc' indicates the use of the first axis initially (Hrr, Hrc, Hcc), whilst 'xy' indicates the usage of the last axis initially (Hxx, Hxy, Hyy). Images with higher dimension must always use 'rc' order.
use_gaussian_derivatives: bool, optionalIndicates whether the Hessian is computed by convolving with Gaussian derivatives, or by a simple finite-difference operation.
Returns
H_elems: list of ndarrayUpper-diagonal elements of the hessian matrix for each pixel in the input image. In 2D, this will be a three element list containing [Hrr, Hrc, Hcc]. In nD, the list will contain
(n**2 + n) / 2arrays.
Notes
The distributive property of derivatives and convolutions allows us to restate the derivative of an image, I, smoothed with a Gaussian kernel, G, as the convolution of the image with the derivative of G.
When use_gaussian_derivatives is True, this property is used to compute the second order derivatives that make up the Hessian matrix.
When use_gaussian_derivatives is False, simple finite differences on a Gaussian-smoothed image are used instead.
Examples
from skimage.feature import hessian_matrix square = np.zeros((5, 5)) square[2, 2] = 4 Hrr, Hrc, Hcc = hessian_matrix(square, sigma=0.1, order='rc', use_gaussian_derivatives=False) Hrc✓
Aliases
-
skimage.feature.hessian_matrix