{ } Raw JSON

bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / feature / corner / structure_tensor

function

skimage.feature.corner:structure_tensor

source: /dev/scikit-image/src/skimage/feature/corner.py :45

Signature

def   structure_tensor ( image sigma = 1 mode = constant cval = 0 order = rc )

Summary

Compute structure tensor using sum of squared differences.

Extended Summary

The (2-dimensional) structure tensor A is defined as

A = [Arr Arc]
    [Arc Acc]

which is approximated by the weighted sum of squared differences in a local window around each pixel in the image. This formula can be extended to a larger number of dimensions (see [1]).

Parameters

image : ndarray

Input image.

sigma : float or array-like of float, optional

Standard deviation used for the Gaussian kernel, which is used as a weighting function for the local summation of squared differences. If sigma is an iterable, its length must be equal to image.ndim and each element is used for the Gaussian kernel applied along its respective axis.

mode : {'constant', 'reflect', 'wrap', 'nearest', 'mirror'}, optional

How to handle values outside the image borders.

cval : float, optional

Used in conjunction with mode 'constant', the value outside the image boundaries.

order : {'rc', 'xy'}, optional

NOTE: 'xy' is only an option for 2D images, higher dimensions must always use 'rc' order. 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 (Arr, Arc, Acc), whilst 'xy' indicates the usage of the last axis initially (Axx, Axy, Ayy).

Returns

A_elems : list of ndarray

Upper-diagonal elements of the structure tensor for each pixel in the input image.

Examples

from skimage.feature import structure_tensor
square = np.zeros((5, 5))
square[2, 2] = 1
Arr, Arc, Acc = structure_tensor(square, sigma=0.1, order='rc')
Acc

See also

structure_tensor_eigenvalues

Aliases

  • skimage.feature.structure_tensor