skimage2.feature.shape_index#

skimage2.feature.shape_index(image, sigma=1, mode='constant', cval=0)[source]#

Compute the shape index.

The shape index, as defined by Koenderink & van Doorn [1], is a single valued measure of local curvature, assuming the image as a 3D plane with intensities representing heights.

It is derived from the eigenvalues of the Hessian, and its value ranges from -1 to 1 (and is undefined (=NaN) in flat regions), with following ranges representing following shapes:

Ranges of the shape index and corresponding shapes.#

Interval (s in â€Ķ)

Shape

[ -1, -7/8)

Spherical cup

[-7/8, -5/8)

Through

[-5/8, -3/8)

Rut

[-3/8, -1/8)

Saddle rut

[-1/8, +1/8)

Saddle

[+1/8, +3/8)

Saddle ridge

[+3/8, +5/8)

Ridge

[+5/8, +7/8)

Dome

[+7/8, +1]

Spherical cap

Parameters:
imagendarray of shape (M, N)

Input image.

sigmafloat, optional

Standard deviation used for the Gaussian kernel, which is used for smoothing the input data before Hessian eigen value calculation.

mode{‘constant’, ‘reflect’, ‘wrap’, ‘nearest’, ‘mirror’}, optional

How to handle values outside the image borders

cvalfloat, optional

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

Returns:
sndarray

Shape index

References

[1]

Koenderink, J. J. & van Doorn, A. J., “Surface shape and curvature scales”, Image and Vision Computing, 1992, 10, 557-564. DOI:10.1016/0262-8856(92)90076-F

Examples

>>> from _skimage2.feature import shape_index
>>> square = np.zeros((5, 5))
>>> square[2, 2] = 4
>>> s = shape_index(square, sigma=0.1)
>>> s
array([[ nan,  nan, -0.5,  nan,  nan],
       [ nan, -0. ,  nan, -0. ,  nan],
       [-0.5,  nan, -1. ,  nan, -0.5],
       [ nan, -0. ,  nan, -0. ,  nan],
       [ nan,  nan, -0.5,  nan,  nan]])