combIm
Top  Previous  Next

combIm ( integer Input1, integer Input2, integer Output, floating Factor1, floating Factor2
[, integer Mode =1])  

Use this function to find the linear combination of two images on a pixel-by-pixel basis. The following formula is used for calculating the intensity of the target pixel:

combim

If a pixel's result goes beyond the intensity range of the given image type, it wraps around or saturates depending on the Mode selected.

If the input images differ in types, they will be automatically converted to the type that forces conformity between the images. If the 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

Input1  
 
An integer between 0 and 116 specifying the frame number of the first input image. A value of 0 represents the DMA memory buffer of the video device. Values in the range of 100-116 correspond to hidden frames.  
 
Input2  
 
An integer between 0 and 116 specifying the frame number of the second input image. 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.  
 
Factor1, Factor2  
 
A floating coefficients by which pixel values of the input images will be multiplied.  
 
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 which fall outside of the image's intensity range will be wrapped around the highest permitted value or zero level.  
M_CLIP=1 - pixel values in the output image which fall outside of the image's intensity range will be clipped to the highest permitted intensity value or zero level.  
M_NORMALIZE=2 - pixel values in the output image to be linearly scaled to the full intensity range of the image.  
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
 
This set of statements combines two sample images and normalizes the result:  
 
setCurDir("samples")  
loadIm (1,"sample14.iwd")  
loadIm (2,"sample15.iwd")  
f1=3  
f2=5  
combIm (1,2,3, f1, f2, M_NORMALIZE)