skimage 0.17.2

NotesParametersReturnsBackRef
threshold_niblack(image, window_size=15, k=0.2)

A threshold T is calculated for every pixel in the image using the following formula:

T = m(x,y) - k * s(x,y)

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.

Notes

This algorithm is originally designed for text recognition.

The Bradley threshold is a particular case of the Niblack one, being equivalent to

>>> from skimage import data
>>> image = data.page()
>>> q = 1
>>> threshold_image = threshold_niblack(image, k=0) * q

for some value q . By default, Bradley and Roth use q=1 .

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 parameter k in threshold formula.

Returns

threshold : (N, M) ndarray

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

Applies Niblack local threshold to an array.

Examples

This example is valid syntax, but we were not able to check execution
>>> from skimage import data
... image = data.page()
... threshold_image = threshold_niblack(image, window_size=7, k=0.1)
See :

Back References

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

skimage.filters.thresholding.threshold_niblack

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#918
type: <class 'function'>
Commit: