thresMlWaHa

[ XITE Reference Manual | XITE home ]

Contents


Name

thresMlWaHa - Finds multiple thresholds by Wang & Haralick method.

Syntax

 #include <xite/thresMl.h>

 int thresMlWaHa( IBAND gray, IBAND tri,
    IBAND edge, int thVect[], int edgeTh,
    int numTh, int population, int n,
    int* totTh );

Description

The pixels in gray are first classified as either edge pixels or nonedge pixels. Edge pixels are then classified, on the basis of their neighborhoods, as being relatively dark, relatively bright or gray. A histogram of the graytone intensities is obtained for those pixels which are edge pixels and relatively dark, and another histogram is obtained for those which are edge pixels and relatively bright. Two candidate thresholds are found at the intensity values corresponding to peaks in the two histograms. The threshold giving the highest probability of getting pure dark or bright regions is selected. If the selected threshold corresponds to the peak in the dark edge histogram, the process is repeated for the graytone range above the threshold, if the threshold corresponds to the peak in the bright edge histogram, the process is repeated for the graytone range below the threshold.

You can specify the number of thresholds to be found, or a minimum population of the two histograms at which to stop. The population of the two histograms decreases rapidly, and might reach zero before the specified number of thresholds is found. There is no peak in a histogram with only zero entries and the process stops.

Parameters

gray
The inband to be thresholded.

tri
A band to hold the tri-tone edge band. Can be NULL.

edge
A band to hold the sobel magnitude edge band. Can be NULL.

thVect
A 256 element int vector returning the threshold values in increasing order. The number of thresholds found are returned through the argument totTh.

edgeTh
The threshold-value at wich to threshold the edge band.

numTh
The number of thresholds wanted.

pop
The minimum population allowed for the dark/bright edge histograms. One and only one of numTh and pop must be specified, the other one should be zero.

n
An integer used to adjust the number of edge pixels classified as either dark or bright. The number of pixels classified as either dark or bright increases with increasing n. Must be positive and non-zero, usually n = 3.

totTh
The number of thresholds found.

Reference

S. Wang and R. M. Haralick
"Automatic Multithreshold Selection". Computer Vision, Graphics, and Image Processing, 25, 46-67 (1984).

Restrictions

gray, tri and edge must have pixel type unsigned byte.

See also

thresMl(1), thresMlAppScale(3), thresMlAppMean(3), thresMlAppMedian(3), thresMlApply(3), histoCentroid(3), thresMlCentroid(3), thresMlCentroid(3), mkComCur(3), thresMlComCur(3), thresMlComCur(1), thresMlReddi(3), thresMlReddi(3), thresMlWaHa(1), sobel(3)

Return value

 Status value:
    0 => ok
    1 => None or both "numTh" and "pop" specified.
    2 => Wrong pixeltype in "gray".
    3 => Wrong pixeltype in "tri".
    4 => Wrong pixeltype in "edge".
    5 => Malloc error. Not able to create temporary image.
    6 => "tri" size different from "gray" size.
    7 => "edge" size different from "gray" size.
    8 => "n" < 1.
    9 => No thresholds found.

Author

Jørn Tilley Jacobsen, BLAB, Ifi, UiO

Id

$Id: thresMlWaHa.c,v 1.22 1997/01/14 13:09:28 svein Exp $