bin_mh

[ XITE Reference Manual | XITE home ]

Name

bin_mh - binarize a gray-scale band using Mardia and Hainsworth`s method

Syntax

 #include <xite/binarize.h>

 int bin_mh( IBAND inband, IBAND outband,
    int use_sem_var, double convergence_limit );

Description

The input band inband is binarized using the method of Mardia and Hainsworth. The result is returned in outband.

Mardia and Hainsworth`s method first makes an initial binarization. Then several steps are iterated until convergence is reached. First, the estimated mean values mu1 and mu2, and the number of pixels n_i in both foreground and background of the current binarization are calculated. Then a threshold T based on these values is calculated. Then, for each pixel, a weighted mean, G, of the pixel and its eight neighbors is calculated. If G<=T, the pixel is classified as ``black', otherwise ``white'. The weights on the neighbor pixels, used to calculate G, may be equal, or they may be calculated based on a semivariogram approximation. If use_sem_var >= 1, the semivariogram approach is used. The last step of each iteration is to smooth the new binary image using a (3 x 3) median filter. convergence_limit is used to test if convergence has been reached. The number of different pixels of two successive binarizations is counted, and compared to convergence_limit.

Restrictions

inband and outband must have pixel type unsigned byte.

See also

binarize(1)

References

K.V. Mardia & T.J. Hainsworth "A spatial thresholding method for image segmentation", IEEE Transactions on Pattern Analysis and Machine Intelligence, vol T-PAMI 10, no 6, pp 919-927, 1988.

Return value

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

Author

Řivind Due Trier

Id

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