List of my modules...

Module: Local_Thresholding_Niblack

Description:

Thresholding method based on local mean and variance [Niblack, 1986]. A local threshold is computed, over a spherical window centred on the considered pixel. The threshold t(p) for a pixel p is: t(p) = Mean + λ σ, where the mean and variance are computed locally. The default values for the window radius and λ are said to work best [Trier and Jain, 1995].
Additionally, a heuristic modification of the threshold computation can be used [Sauvola and Pietikäinen, 2000]. The threshold then becomes: t(p) = Mean.(1+λ(1-σ/R)). In practice, R should be around half the greylevel range.
The figure below shows the result with the default values. You can directly see that in the uniform regions, the thresholding isn't good. You have to have the interface in the local window, otherwise the computed variance is very low, and the threshold value will be mainly based on the noise amplitude.

Left: original image. Right: overlay with thresholded image.
To avoid the above shortfall, a mask can be used. The algorithm will be applied only to the pixels in the mask (see the example below). Since the algorithm is prohibitively slow with a large window (the method is not useful with small windows), this option can greatly accelerate the process (below, twelve times faster because only 8% of the pixels processed), in addition to avoiding the previous problem with uniform regions.

Illustration of how a mask can be used. Left: the mask is defined as pixels with an intensity in a range intermediate between light and dark. In this case, for an 8-bit [0;255] image, between 27 and 87, the idea is that all pixels with a greylevel lower than 27 or greater than 87 are automatically assigned to background and object respectively, and only those in the intermediate range (i.e. in the masked region) are interesting to have this algorithm applied. Center: the result with the default options, in red the pixels that were already assigned to the object (because greylevel greater than 87), in yellow pixels of the mask assigned to the object, and in blue the pixels of the mask assigned to the background. Right: the result, using the same color scheme, with the heuristic modification and with a lambda (recommended by the authors) of -0.5.

Notes

Connections:

Image

[required]
The input image, of type HxUniformScalarField3.

Mask

[optional]
A mask image, defined in a class HxUniformScalarField3. Will only apply the thresholding to the pixels of the mask.

Ports:

Radius


Radius of the spherical window for the local threshold computation.

Lambda


Lambda used in the threshold computation.

Option


Heuristic modification of the threshold computation, proposed by [Sauvola and Pietikäinen, 2000].

R


Value for R used in the heuristic modification.

Mask_Threshold


If a mask is connected, this is the value to compare with the mask pixel intensity.

Mask_Comparison


If a mask is connected, defines how the mask threshold is used to define the pixels to count: should the pixel value be lower, lower or equal, greater, etc. than the mask threshold ?

Values


Output values for pixels of the object and of the background.

Action


Push this button to start the computation.

Commands:

Additional options can be accessed when typing in the console Local_Thresholding_Niblack COMMAND_NAME.

verbose

Displays timing information after the computation. Retype to hide info.

create

Runs the computation. Returns the name of the output, so it can be used in a script, such as set RESULT [Local_Thresholding_Niblack create].

References:

Niblack, W. An Introduction to Digital Image Processing, Prentice-Hall, 1986.
Sauvola, J. and Pietikäinen, M. Adaptive document image binarization, Pattern Recognition 33 (2) , pp. 225-236, 2000.
Trier, O and Jain, A. Goal-directed evaluation of binarization methods, IEEE Transactions on Pattern Analysis and Machine Intelligence 17(12), pp. 1191-1201, 1995.