variance
Top  Previous  Next

variance ( integer Input, integer Output, integer Size [, integer Invert =0 ] )

Use this function to detect edges and textures in an image or selection. The filter works by adding the squares of the differences between the intensity of the central pixel and its neighbors. If an overflow occurs, the result is clipped to the minimum or maximum pixel value for the given image type

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  
 
An odd integer between 1 and 2*Overscan+1 specifying the size of the square neighborhood in which the variance is calculated. The Overscan setting is defined in ImageWarp Preferences.  
 
Invert  
 
A boolean integer specifying if the outcome of the function should be inverted. Must be one of the following values:  
 
FALSE – the direct mode. Edges are presented as bright lines on a dark background.  
TRUE – the inverse mode. Edges are presented as dark lines on a bright background.  
Default: FALSE  
 
Error flags

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

Example

This set of statements continuously captures an image and performs phase detection by applying the inverted variance filter with the window of size 5.:  
 
do  
grabIm (0)  
variance (0, 1, 5, TRUE)  
loop while getError()=ERR_OK