NAME

     projection - calculates horizontal and vertical  projections
     of a size_normalized object of interest

SYNOPSIS

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

     int * projection(Image * labeledImage, int  r,  int  c,  int
     height, int width)

      <labeledImage> -  pointer to a labeled image
      <r> - row coordinate of a point on the labeled image
      <c> - column coordinate of a point on the labeled image
      <height> - image height after the  object  of  interest  is
     normalized
      <width>  - image width after the object of interest is nor-
     malized

PATH

     $CVIPHOME/FEATURE/size_norm_projection.c

DESCRIPTION

     This function calculates the horizontal and vertical projec-
     tions  of  a  binary  object.  The  object is first grown or
     shrunk (as required) to fit in the box  of  <height>  height
     and <width> width. Zero-order hold is used to grow; deleting
     every other line (decimation) is used to shrink. The  object
     is grown (or shrunk), until it just fits within the box. The
     growing or shrinking is the same  in  both  dimensions.  The
     function then calculates horizontal and vertical projections
     on this size_normalized object according to equations  given
     in chapter 2 of the soon-to-be-published book:

                Computer Vision and Image Processing:
                 A practical Approach Using CVIPtools

                   S.E.Umbaugh, Prentice Hall, 1997

TYPES AND CONSTANTS

     None

RETURN VALUES

     A pointer to int, first <height> values are  for  horizontal
     projections, following <width> data are for vertical projec-
     tions. Zero values are not filtered out.

HISTORY

     History information recorded: None

EXAMPLE

      #include <math.h>
      #include "ObjectContour.h"
      #include "CVIPfeatures.h"
      #include "CVIPconvert.h"

      void main() {
         Image *inputImage, *labeledImage;
         IMAGE_FORMAT format;
         char *inputfile, *outputfile;
         int rows, cols, r, c, h, w;
         int *result;

         setDisplay_Image("picture", "Default");

         print_CVIP("\nEnter the Input File Name:  ");
         inputfile = (char *) getString_CVIP();
         inputImage = read_Image(inputfile, 1);
         view_Image(inputImage,inputfile);

         labeledImage = label(inputImage);

         rows = getNoOfRows_Image(labeledImage);
         cols = getNoOfCols_Image(labeledImage);

         print_CVIP("\nEnter the row coordinate of any  pixel  on
     the labled image: ");
         r = getInt_CVIP(10, 0, rows);
         print_CVIP("\nEnter the col coordinate of any  pixel  on
     the labled image: ");
         c = getInt_CVIP(10, 0, cols);

         print_CVIP("\nEnter image height  after  the  object  of
     interest is normalized: ");
         h = getInt_CVIP(10, 0, cols);
         print_CVIP("\nEnter image  width  after  the  object  of
     interest is normalized: ");
         w = getInt_CVIP(10, 0, cols);

         result = projection(labeledImage, r, c, h, w);
         print_CVIP("\nThe horizontal projection  of  the  object
     (r, c) = %d\n", *result );
         print_CVIP("\nThe vertical projection of the object  (r,
     c) = %d\n", *(result+1) );
         free(inputfile);
       }

DIAGNOSTICS

     The labeled image can only of data type CVIP_INTEGER

SEE ALSO

     libfeature

AUTHOR

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