[ XITE Reference Manual | XITE home ]

Name

bin_be - binarize a gray-scale band using Bernsen`s method

Syntax

 #include <xite/binarize.h>
 int bin_be( int region_size,
    int contrast_limit, int set_doubt_to_low,
    IBAND inband, IBAND outband );

Description

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

For each pixel, the threshold

T(x,y) = (Z_low + Z_high)/2

is used, where Z_low and Z_high are the lowest and highest gray level pixel values in a square neighborhood of size (region_size x region_size) about the pixel (x,y). However, if the contrast measure

C(x,y) = Z_high - Z_low < contrast_limit

the pixel is set to 255 if set_doubt_to_low == 0, and to 0 if set_doubt_to_low >= 1.

Files

src/binarize/bin_be.c

See also

binarize(1), thresBernsen(1), thresBernsen(3)

References

John Bernsen
"Dynamic thresholding of grey-level images", Proc. 8th International Conference on Pattern Recognition (ICPR8), pp 1251-1255, Paris, France, October 1986.

Return value

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

Restrictions

inband and outband must have pixel type unsigned byte.

Author

Oivind Due Trier

Examples

Id

$Id: bin_be.c,v 1.15 1997/01/14 15:46:50 svein Exp $