roberts
Top  Previous  Next

roberts ( integer Input, integer Output [, integer Invert =0, integer Mode =0 ] )

Use this function to detect fine edges and their directions on an image by applying the Roberts cross operator. The filter represents a finite approximation to the derivative of intensity by calculating the absolute differences in two diagonal directions in the 2x2 neighborhood. The filter is based on the following kernels:

roberts1 roberts2

The method used for combining the two differentials depends on the Mode value. 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.  
 
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  
 
Mode  
 
An enumerated integer that describes how the two differential images are combined. Must be one of the following values:  
 
M_SUM – the target pixel is substituted with the sum of the absolute values of the corresponding pixels in two differential images:  
roberts3  
M_MAX – the target pixel is substituted with the maximum absolute value from two differential images:  
roberts4  
M_SQRT – the target pixel substituted with the square root of the sum of the squares of the corresponding pixels in two differential images:  
roberts5  
M_PHASE – the target pixel is substituted with the angle of the gradient direction: The angle is measured from the positive X-axis clockwise  
roberts6  
Default value: M_SUM  
 
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 Prewitt filter:  
 
do  
grabIm (0)  
prewitt (0, 1, FALSE, M_PHASE)  
loop while getError()=ERR_OK  
 
Remark

When the Mode is set to M_PHASE, the phase values will be calculated differently depending on the type of an image. If an image is of an integer type, the target pixel representing the angle of the intensity gradient will be rescaled so the range of possible angular values (0° -359°) will be mapped on the entire intensity scale of the image. If an image is of a floating type, the phase will be reported in radians, while the absence of the gradient will be indicated by pixels with the value of negative 1.