skimage 0.17.2

NotesParametersReturnsBackRef
threshold_sauvola(image, window_size=15, k=0.2, r=None)

In the original method a threshold T is calculated for every pixel in the image using the following formula:

T = m(x,y) * (1 + k * ((s(x,y) / R) - 1))

where m(x,y) and s(x,y) are the mean and standard deviation of pixel (x,y) neighborhood defined by a rectangular window with size w times w centered around the pixel. k is a configurable parameter that weights the effect of standard deviation. R is the maximum standard deviation of a greyscale image.

Notes

This algorithm is originally designed for text recognition.

Parameters

image : ndarray

Input image.

window_size : int, or iterable of int, optional

Window size specified as a single odd integer (3, 5, 7, …), or an iterable of length image.ndim containing only odd integers (e.g. (1, 5, 5) ).

k : float, optional

Value of the positive parameter k.

r : float, optional

Value of R, the dynamic range of standard deviation. If None, set to the half of the image dtype range.

Returns

threshold : (N, M) ndarray

Threshold mask. All pixels with an intensity higher than this value are assumed to be foreground.

Applies Sauvola local threshold to an array. Sauvola is a modification of Niblack technique.

Examples

This example is valid syntax, but we were not able to check execution
>>> from skimage import data
... image = data.page()
... t_sauvola = threshold_sauvola(image, window_size=15, k=0.2)
... binary_image = image > t_sauvola
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

skimage.filters.thresholding.threshold_sauvola

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /skimage/filters/thresholding.py#981
type: <class 'function'>
Commit: