bkTrack
Top  Previous  Next

bkTrack ( integer Input, integer Output, integer Size, floating Offset
[, integer Backgr=0, integer Mode=1 ])  


Use this function to automatically remove or extract background from a grayscale or color image. This is especially useful when applied to an image in which dark or bright objects of similar size are located on an uneven background. The function works by removing pixels corresponding to objects of interest and replacing them with the average background level in the vicinity of the objects.

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.  
 
Size  
 
A positive integer specifying the size of the averaging window. This parameter should be in the range of maximum linear dimension of the largest objects in the image.  
 
Offset  
 
A positive floating argument specifying the minimum intensity difference between the objects and background. Small background variations that fall beneath this level will not be eliminated.  
 
Bckgr  
 
An enumerated integer that describes intensity of the background relative to the foreground objects. Must be one of the following values:  
 
BK_DARK=0 – the image contains bright objects on a dark field.  
BK_BRIGHT=1 - the image contains dark objects on a bright field.  
Default value: BK_DARK  
 
Mode  
 
An enumerated integer that describes the mode of background processing. Must be one of the following values:  
 
M_REMOVE=0 – remove a detected background from the image  
M_SELECT=1 – extract a detected background from the image  
Default value: M_SELECT  
 
Error flags

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

Example

This set of statements tracks and remove the dark background from a sample image:  
 
setCurDir("samples")  
loadIm (1,"sample10.iwd")  
bktrack(1,2,10,80,BK_DARK,M_REMOVE)