maskIm
Top  Previous  Next

maskIm ( integer Input, integer Mask, integer Output [, integer Phase =1, integer Invert =0 ] )

Use this function to mask a source image with an image of the multiphase type. The function extracts from the input image only those pixels that have the corresponding pixels in the mask image belonging to a specified Phase. The pixels that do not fall under the mask are set to zero. If the Input and Mask images or selections are different sizes, one or both of them will be clipped to match the minimal horizontal and vertical dimension of the images or selected regions of interests.

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.  
 
Mask  
 
An integer between 0 and 116 specifying the frame number of the multiphase image used as a mask. 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.  
 
Phase  
 
An optional integer between 0 and 255 specifying the phase that will be used for masking. Only those pixels in the input image that have the corresponding pixels in the Mask image equal to the value of Phase will be extracted.  
Default value: 1  
 
Invert  
 
An optional boolean integer that defines if the operation should be inverted. Must be one of the following values:  
FALSE=0 – the operation is performed as described above.  
TRUE=1- inverts the operation and extracts those area of the input image that are not masked.  
Default value: FALSE  
 
Error flags

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

Example

This set of statements continuously grabs an image and masks it with a hidden binary image that contains an ellipse and rectangle:  
 
createIm (100,IM_MULTI,512,512)  
phase=1  
drawEllipse (100,50,50,350,300,TRUE,phase)  
drawRect(100,350,350,480,450,TRUE,phase)  
do  
grabIm(101)  
maskIm (101,100,1,phase)  
loop