threshGauss
Top  Previous  Next

val = threshGauss ( integer Input, integer Output, integer Channel [, integer Invert =0 ] )

Use this function to automatically separate objects of interest from the background by using the Gaussian fit technique. This method assumes a histogram with two overlapping bell curves (one of light objects and the other of dark objects) and sets the threshold in the crossing point. For color images thresholding can be performed on the luminance, hue or saturation channel. The function creates a binary output image and returns a calculated threshold.

Parameters

Input  
 
An integer between 0 and 116 specifying the input image frame number. A value of 0 represents the DMA memory buffer of the video device. Values in the range of 100-116 correspond to hidden frames.  
 
Output  
 
An integer between 1 and 116 specifying the output image frame number. Values in the range of 100-116 correspond to hidden frames.  
 
Channel  
 
An enumerated integer specifying the color channel that will be used for histogram analysis and thresholding. Must be one of the following values:  
 
TH_LUMINANCE=0 – separate the objects of interest based on the intensity distribution.  
TH_HUE=1 – separate the objects of interest based on the color pigment distribution.  
TH_SATURATION=2 - separate the objects of interest based on the color saturation distribution.  
 
This parameter is disregarded for grayscale images.  
 
Return value

A threshold level calculated from the histogram analysis and used for thresholding.  

Error flags

ERR_OK  
 
The flag set if successful.  
 
ERR_FAILED  
 
The flag set if failed.  

Example

This set of statements performs the automatic thresholding of a sample image using the Gaussian fit function:  
 
SetCurDir("samples")  
loadIm (1,"sample10.iwd")  
threshGauss (1, 2, TH_LUMINANCE)