thresMlWaHa

[ XITE Reference Manual | XITE home ]

Contents


Name

thresMlWaHa - Finds multiple thresholds by Wang & Haralick method

Syntax

 thresMlWaHa [-n <n>] [-nt <nt>] [-p <p>] [-et <et>] \\
       [-verbose] [-tri <trilevel-image>] \\
       [-edge <edge-image>] <inimage> <outimage>

Description

The pixels in inimage 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.

Options

-n n
An integer n 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. Default n = 3.

-et et
Edge threshold et. The sobel magnitude operator is used to find the edge strenght in every pixel. The edge threshold value et is then used to classify pixels as edge pixels or nonedge pixels. Default et = 100.

-nt nt
Number nt of thresholds wanted.

-p p
The minimum population p in dark or bright edge histograms allowed before stopping. Only one of nt and p may be specified. If none of them are specified, the default value p = 100 is used as stop criteria.

-verbose
Verbose. Will cause certain messages to be written to "stdout". ie. the thresholds found, the poulation of the dark and bright histograms and the graytone range, and the total number of thresholds found.

-edge edge-image
Specifies that the thresholded sobel magnitude image should be written to edge-image.

-tri trilevel-image
Specifies that the classified edge image should be written to trilevel-image. Edge pixels classified as dark will be dark, edgepixels classified as bright will be bright, and other pixels will be gray.

The result written to outimage will be a multithresholded version of inimage with either nt thresholds (if possible), or as many thresholds found with significant populations in both dark and bright histograms.

Reference

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

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(3), sobel(1)

Restrictions

inimage must have bands with pixel type unsigned byte.

Return value

0 => OK. 1 => Bad number of arguments. 2 => Cant open inimage. 3 => Malloc error. 4 => Error in thresMlWaHa function.

Author

Jørn Tilley Jacobsen, BLAB, Ifi, UiO

Examples

 thresMlWaHa solflekk.img solSeg.img
 thresMlWaHa -nt 5 -n 2 -et 50 -verbose -edge solE.img \\
     -tri solT.img solflekk.img solSeg.img

Id

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