This is a development version (0.26.1rc0.dev0) and may be unstable.Go to latest (0.26.1rc0.dev0+git20260530.b607368ff)
{ } Raw JSON

bundles / skimage 0.26.1rc0.dev0 / skimage / feature / corner / shape_index

function

skimage.feature.corner:shape_index

source: /_skimage2/feature/corner.py:521

Signature

def shape_index(image, sigma = 1, mode = constant, cval = 0)

Summary

Compute the shape index.

Extended Summary

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:

Parameters

image : ndarray of shape (M, N)

Input image.

sigma : float, 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

cval : float, optional

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

Returns

s : ndarray

Shape index

Examples

from skimage.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]])

Aliases

  • skimage.feature.shape_index