thresBernsen

[ XITE Reference Manual | XITE home ]

Name

thresBernsen - local treshold by the method of Bernsen.

Syntax

 #include <xite/threshold.h>

 int thresBernsen( IBAND inband, IBAND outband,
    int cmin, int dx, int dy, int lpv, int hpv,
    int low );

Description

If the difference between the largest and the smallest pixel value within the dx*dy window is greater than or equal to cmin (local contrast threshold), the average of the two values is used as threshold. Pixels below this threshold are set to lpv, and pixels above are set to hpv.

If low is TRUE, pixels in homogenous areas (difference below cmin) are assumed to be below the threshold and are set to lpv, and if low is FALSE these pixels are set to hpv.

Restrictions

inband and outband must have pixel type unsigned byte.

Reference

Bernsen, J: "Dynamic thresholding of grey-level images" Proc. of the 8th ICPR, Paris, Oct 1986, 1251-1255.

Return value

 0 => ok
 1 => bad pixel type inband
 2 => bad pixel type outband
 3 => bad cmin value
 4 => bad dx or dy value
 5 => bad lpv or hpv value
 6 => not enough memory

Author

Olav Borgli and Tor Lønnestad, BLAB, Ifi, UiO

Id

$Id: thresBernsen.c,v 1.22 1997/01/14 13:10:39 svein Exp $