Note
Go to the end to download the full example code or to run this example in your browser via Binder.
Shape Index#
The shape index is a single valued measure of local curvature, derived from the eigen values of the Hessian, defined by Koenderink & van Doorn [1].
It can be used to find structures based on their apparent local shape.
The shape index maps to values from -1 to 1, representing different kind of shapes (see the documentation for details).
In this example, a random image with spots is generated, which should be detected.
A shape index of 1 represents ‘spherical caps’, the shape of the spots we want to detect.
The leftmost plot shows the generated image, the center shows a 3D render of the image, taking intensity values as height of a 3D surface, and the right one shows the shape index (s).
As visible, the shape index readily amplifies the local shape of noise as well, but is insusceptible to global phenomena (e.g. uneven illumination).
The blue and green marks are points which deviate no more than 0.05 from the desired shape. To attenuate noise in the signal, the green marks are taken from the shape index (s) after another Gaussian blur pass (yielding s’).
Note how spots interjoined too closely are not detected, as they do not posses the desired shape.