NAME

     spectral_feature - calculates total power spectrum  in  each
     ring and sector over half image

SYNOPSIS

      #include <math.h>
      #include "CVIPimage.h"
      #include "newfeature.h"

     POWER  *spectral_feature(Image  *  originalImage,  Image   *
     labeledImage, int no_of_rings, int no_of_sectors, int r, int
     c)

      <originalImage> - pointer to the original image
      <labeledImage> -  Pointer to the labeled image
      <no_of_rings> -   number of rings
      <no_of_sectors> - number of sectors
      < r > - row coordinate of a point on the labled image
      < c > - column coordinate of a point on the labled image

PATH

     $CVIPHOME/FEATURE/spectral_feature.c

DESCRIPTION

     Half of the frequency domain of the object  of  interest  is
     divided  into  <no_of_rings>  rings and <no_of_sectors> sec-
     tors, that is to say, all sectors have  equal  angles,  dis-
     tances  between  neighboring  rings are equal. The frequency
     domain is got by performing forward  FFT  on  image  of  the
     object  of  interest.  The object of interest is selected by
     the  point  of  coordinates  <r,c>  on  the  labeled  image.
     power_fft()  returns  dc_normalized  values  of  total power
     spectrum in each ring and sector. 'dc_normalized' means  all
     total  power  spectrums  are divided by the value of dc com-
     ponent (the value before divided by N*N). For dc  component,
     it  is divided by pow(N, 4) before returned to make it to be
     the power spectrum of the average value of all pixels in the
     object  image. N is equal to the image size of the object of
     interest(an N*N image).

TYPES AND CONSTANTS

     POWER is defined in $CVIPHOME/include/newfeature.h

     If the original image is a color image, the first no_of_rings
     and no_of_sectors values pointed to by 'dc', 'sector', and
     values pointed to by those pointers are for band 1, and so on.

RETURN VALUES

     A pointer to a structure  named  POWER  containing  spectral
     features data

HISTORY

     History information recorded: None

EXAMPLE

      #include "CVIPtoolkit.h"
      #include "CVIPobject.h"
      #include "CVIPconvert.h"
      #include <math.h>
      #include "ObjectContour.h"
      #include "newfeature.h"

      void main()
      {
         Image *inputImage, *labeledImage,*inputImage1;
         IMAGE_FORMAT format;
         char *inputfile, *outputfile;
         int rows, cols, r, c,k,i;
         POWER *PP;
         int bands,no_rings,no_sectors;

         setDisplay_Image("picture", "Default");

         print_CVIP("\nEnter the Input File Name:  ");
         inputfile = (char *) getString_CVIP();
         inputImage = read_Image(inputfile,1);
         view_Image(inputImage,inputfile);
         inputImage1=(Image *)duplicate_Image(inputImage);
         labeledImage = label(inputImage);
         rows = getNoOfRows_Image(labeledImage);
         cols = getNoOfCols_Image(labeledImage);
         bands = getNoOfBands_Image(labeledImage);
         print_CVIP("\nEnter the row coordinate of a point
         on the labled image: ");
         r = getInt_CVIP(10, 0, rows);
         print_CVIP("\nEnter the col coordinate of the point
         on the labled image: ");
         c = getInt_CVIP(10, 0, cols);
         print_CVIP("\nEnter the number of rings: ");
         no_rings = getInt_CVIP(10, 0,10);
         print_CVIP("\nEnter the number of sectors: ");
         no_sectors = getInt_CVIP(10, 0,10);
         PP=spectral_feature(inputImage1,labeledImage,
         no_rings,no_sectors,r,c);
         print_CVIP("The spectral features of the input image
         are:");
         for (k=0; k<bands; k++)
         {
              print_CVIP("Spectral DC value band%d =%f",k,
              (PP->dc)[k]);
              for (i=0; i<PP->no_of_bands; i++)
                 print_CVIP("Ring%d=%f\n ",i+1,(PP->band)
                 [k*PP->no_of_bands + i]);

              for (i=0; i<PP->no_of_sectors; i++)
                 print_CVIP("Sector%d=%f\n ",i,(PP->sector)
                 [k*PP->no_of_sectors + i]);
         }

         free(inputfile);
         free((char *)PP->dc);
         free((char *)PP->sector);
         free((char *)PP->band);
         free((char *)PP);
         free(inputImage);
         free(inputImage1);
         free(labeledImage);

       }

DIAGNOSTICS

     The original image can  be  of  any  of  these  data  types:
     CVIP_BYTE,    CVIP_SHORT,   CVIP_INTEGER,   CVIP_FLOAT   and
     CVIP_DOUBLE.

SEE ALSO

     libfeature

AUTHOR

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