NAME

     fft_phase - extract phase of fft

SYNOPSIS

     Image * fft_phase(Image * fftImage, int remap_norm, float k)

      <fftImage> - Pointer to a complex image structure
      <remap_norm> - 0 = remaps the phase data and returns
                         a CVIP_BYTE image
                     1 = normalizes the magnitude, using value
                         of k, returns a complex image
      <k> - constant to normalize the magnitude

PATH

     $CVIPHOME/TRANSFORMS/fft_phase.c

DESCRIPTION

     This function performs two types of  operations:   normalize
     magnitude by setting
                      REAL = k*cos(phase_angle)
                      IMAG = k*sin(phase_angle)
     where k is a constant, and remaps  the  phase  data  into  a
     CVIP_BYTE image:
                      phase = arctan(IMAG/REAL)

     Phase data are values between 0 -- 2*PI, values between PI/4
     --  5*PI/4  are remapped to 255 -- 0; values between -3*PI/4
     -- PI/4 are remapped to 0 -- 255.

TYPES AND CONSTANTS

     None

RETURN VALUES

     Pointer to a complex or CVIP_BYTE image

HISTORY

     History information recorded: None

EXAMPLE

      #include <CVIPtoolkit.h>
      #include <CVIPimage.h>
      #include <CVIPconvert.h>
      #include <CVIPview.h>
      #include <CVIPtransform.h>
      #include <math.h>
      #include <sys/file.h>
      #include <float.h>
      #include <sys/types.h>
      #include <sys/uio.h>
      #define VIEWER "picture"
      #define VIDEO_APP "SunVideo &"
      void main()
      {
      Image *cvipImage,*cvipImage1;
      IMAGE_FORMAT format;
      char *inputfile,*outputfile;

      setDisplay_Image(VIEWER, "Default");

      print_CVIP("\n\t\tEnter the Input File Name:  ");
      inputfile =(char *) getString_CVIP();
      format = getFormat_CVIP(inputfile);
      cvipImage = read_Image(inputfile, 1);
      view_Image(cvipImage, inputfile);
      free(inputfile);
      cvipImage = fft_transform(cvipImage,256);
      print_CVIP("\n\t\tEnter the Output File Name:  ");
      outputfile = getString_CVIP();
      view_Image(cvipImage,outputfile);
      /* VIP format because of the complex image */
      write_Image(cvipImage,outputfile,CVIP_NO,CVIP_NO,VIP,1);
      free(outputfile);
      print_CVIP("\n\t\tEnter the Input File Name:  ");
      inputfile =(char *) getString_CVIP();
      format = getFormat_CVIP(inputfile);
      cvipImage = read_Image(inputfile, 1);
      view_Image(cvipImage, inputfile);
      free(inputfile);
      /* the following call extracts the phase of the
      transformed complex image,remaps the phase
      between 0 and 255 and diplays the CVIP_BYTE
      image.Since we are not normalising the magnitude,
      we use k=-1 */
      cvipImage = fft_phase(cvipImage,0,-1);
      print_CVIP("\n\t\tEnter the Output File Name:  ");
      outputfile = getString_CVIP();
      view_Image(cvipImage,outputfile);
      write_Image(cvipImage,outputfile,CVIP_NO,CVIP_NO,PGM,1);
      free(outputfile);
      }

SEE ALSO

     libtransform

AUTHOR

     Copyright (C) 1996 SIUE - by Scott E.  Umbaugh  and  Wenxing
     Li.