bin_ni

[ XITE Reference Manual | XITE home ]

Name

bin_ni - binarize a gray-scale band using Niblack`s method

Syntax

 #include <xite/binarize.h>

 int bin_ni( int region_size, double weight,
    IBAND inband, IBAND outband );

Description

The input band inband is binarized using the method of Niblack. The result is returned in outband.

The idea of this method is to vary the threshold over the image, based on the local mean and local standard deviation. The threshold at pixel (x,y) is calculated as

T(x,y) = weight * sigma(x,y) + mu(x,y)

where sigma(x,y) and mu(x,y) are the estimated standard deviation and mean value in a local neighborhood of (x,y) of size (region_size x region_size). The value of weight is used to adjust how much of the foreground object edges that are taken as a part of the object. A recommended value for weight is -0.2 for images with black foreground objects, and weight = +0.2 for images with white foreground objects.

Restrictions

inband and outband must have pixel type unsigned byte.

See also

binarize(1), stvar(3)

References

Wayne Niblack
"An introduction to Digital image processing", pp 115-116, Prentice Hall, 1986.

Return value

 0 : ok
 1 : Bad input pixel type
 2 : Bad output pixel type

Files

src/binarize/bin_ni.c

Author

Řivind Due Trier

Id

$Id: bin_ni.c,v 1.16 1997/01/14 15:46:54 svein Exp $