structure-tensor

structure_tensor

skimage.feature.structure_tensor(image, sigma=1, mode='constant', cval=0) [source]

Compute structure tensor using sum of squared differences.

The structure tensor A is defined as:

1
2
A = [Axx Axy]
    [Axy Ayy]

which is approximated by the weighted sum of squared differences in a local window around each pixel in the image.

Parameters:

image : ndarray

Input image.

sigma : float

Standard deviation used for the Gaussian kernel, which is used as a weighting function for the local summation of squared differences.

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.

Returns:

Axx : ndarray

Element of the structure tensor for each pixel in the input image.

Axy : ndarray

Element of the structure tensor for each pixel in the input image.

Ayy : ndarray

Element of the structure tensor for each pixel in the input image.

Examples

1
2
3
4
5
6
7
8
9
10
>>> from skimage.feature import structure_tensor
>>> square = np.zeros((5, 5))
>>> square[2, 2] = 1
>>> Axx, Axy, Ayy = structure_tensor(square, sigma=0.1)
>>> Axx
array([[ 0.0.0.0.0.],
       [ 0.1.0.1.0.],
       [ 0.4.0.4.0.],
       [ 0.1.0.1.0.],
       [ 0.0.0.0.0.]])
doc_scikit_image
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.