genSine
Top  Previous  Next

genSine ( integer Input, integer Output , floating Amplitude, floating Wavelength
[, floating Base, floating Angle =0, floating Phase =0, floating Color =7 ] )  

Use this function to generate a flat sinusoidal wave pattern and apply it to an image or selection. The following equation is used for the horizontal wave:

gensine

where
f(x,y) is the original intensity, B is the base constant component, ë is the wavelength, and ö is the phase shift of the wave. The function also allows you to change the orientation of the wave to the horizontal.
.
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.  
 
Amplitude  
 
A positive floating argument specifying the amplitude of the sine wave. The value will affect the intensity variations along the wave.  
 
Wavelength  
 
A positive floating argument specifying the wavelength of the sine wave in pixels. This larger this value is, the longer the distance between the adjacent crests of the waves will be.  
 
Base  
 
An optional floating argument specifying the constant level to be added to all pixels in the image.  
Default value: the average of minimum and maximum permitted pixel values for the given image type.  
 
Angle  
 
An optional floating argument specifying the orientation of the wave to the horizontal. The angle is measured in degrees clockwise.  
Default value: 0  
 
Phase  
 
A floating argument specifying the phase shift of the wave in degrees. Modifying this value will cause a shift of the wave along the direction of its propagation. The zero value of the phase generates a sine wave; the 90 degrees value generates a cosine wave.  
Default value: 0  
 
Color  
 
An enumerated integer between 1 and 7 specifying the color code for the wave pattern for a color image. Must be one of the following values:  
 
 
1
red color
2
green color
3
yellow color
4
blue color
5
magenta color
6
cyan color
7
white color
 
Default value: 7  
 
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 adds a sine wave to it, gradually changing a phase of the wave:  
 
grabIm  (100)  
amp=getMaxPixel(100)/4  
base=0  
wave=getImWidth(100)/16  
angle=20  
for phase=0 to 360*10 step 8  
genSine(100,1,amp,wave,angle,phase,base)  
next