lvgsin(3)

LIBRARY ROUTINE
lvgsin - Creates a sinusoidal image.

LIBRARY CALL
#include "vinclude.h"
lvgsin(image,rows,columns,bands,amp,fs,fx,fy,px,py,type)
  struct xvimage **image;
  int            rows,columns,bands,type;
  float          amp,fx,fy,fs,px,py;

INPUT

image
    pointer to VIFF structure containing image data to be processed.

rows
    rows is an integer that specifies the number of rows in the resultant image.

cols
    cols is an integer that specifies the number of columns in the resultant image.

bands
    bands is an integer that specifies the number of bands in the resultant image.

amp amp is an float that specifies the maximum amplitude of the signal.

fs  fs is a float that specifies the sampling frequency for signal generation.

fx  fx is a float that specifies the frequency of the signal in the X direction in radians/pixel.

fy  fy is a float that specifies the frequency of the signal in the Y direction. in radians/pixel

px  px is a float that specifies the phase shift in the X direction in radians.

py  py is a float that specifies the phase shift in the Y direction in radians.

type
    type is an int that specifies the output data type. It must be one of VFF_TYP_FLOAT or VFF_TYP_COMPLEX.

OUTPUT

image
    pointer to VIFF structure containing image data after processing.

Return Value:
    1 on success, 0 on failure.

MODIFICATIONS

Scott Wilson 09 Jun 1990 11:31 MST
    Major documentation fixed, fixed up units on input parameters so they are consistent (i.e. all in radians), fixed .pane to reflect this, changed argument names to be more descriptive (i.e. "py" instead of "e" for phase Y.

Scott Wilson 21 Jan 1991 14:20 MST
    Changed return(1) to RETURN(1) at end of routine - otherwise have a memory leak.

Scott Wilson 21 Jan 1991 14:25 MST
    Found fs and fx switched in the call from vgsin. Put 'em right.

Scott Wilson 21 Jan 1991 14:26 MST
    Found fx and fy switched in call to gsin(). Put 'em right.

Jeremy Worley 05 Mar 1992 08:35 MST
    Many fprintfs in error conditions were called with too few arguments - fixed.

DESCRIPTION
lvgsin creates a two dimensional image of dimension rows * columns. The image pixel values follow a sinusoidal waveform. The user can specify the frequency, phase, amplitude, sampling frequency and image dimensions.

The spatial frequencies are specified in radians/pixel, and the phase offsets are specified in radians. The expression generated is then
sin(fx*x + px + fy*y + py)
where fx and fy are the frequencies in the X and Y directions respectively, and px an py are the phase shifts in the X and Y directions respectively.

The phase fronts of the sinusoid are perpedicular to the direction given by the angle atan2(b,a). For a reference on this see J. Goodman, "Introduction to Fourier Optics".

The sampling frequency modifies the generated expression as follows:
sin(fx*x/fs + px + fy*y/fs + py)
which allows one to shift the frequency to match that of an incoming data stream (in 1D).

The resulting images may be of type FLOAT or COMPLEX. A complex image is generated using the formula cos[stuff] + j*sin[stuff].

SEE ALSO
vgsin(1), intro(3), vipl(3), verror(3), vutils(3) lvgconst(3)

RESTRICTIONS
lvgsin can only generate VFF_TYP_FLOAT and VFF_TYP_COMPLEX type images.

AUTHOR
Jeremy Worley, Marcelo Teran, Ramiro Jordan

COPYRIGHT
Copyright 1992, University of New Mexico. All rights reserved.