offsetIm
Top  Previous  Next

offsetIm ( integer Input, integer Output, float Offset [, integer Mode =1] )

Use this function to add a constant value to each pixel in an image or selection. The following formula is used for calculating the intensity of a target pixel:

offsetim

If a pixel's result falls outside of the image's intensity scale, it will be clipped or wrapped around the highest /lowest permitted value, depending on the Mode selected.


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.  
 
Offset  
 
A floating variable or constant specifying the value that will be added to each pixel of the image.  
 
Mode  
 
An optional enumerated integer that describes the processing mode to use. Must be one of the following values:  
 
M_WRAP=0 - pixel values in the output image will be wrapped around the highest permitted intensity value in case of a positive Offset, and around zero in case of a negative Offset.  
M_CLIP=1 - pixel values in the output image will be clipped to the highest permitted level in case of a positive Offset, and to the zero level in case of a negative Offset.  
Default: M_CLIP  
 
If the input image is of the floating or complex type, this parameter is disregarded.  
 
Error flags

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

Example

The following set of statements displays a live image with all pixels offset by a value of 64 with saturation:  
 
do  
  grabIm (0)  
  offsetIm(0, 1, 64.)  
loop while getError()=ERR_OK