NAME

     hist_stretch - stretches a histogram

SYNOPSIS

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

     Image * hist_stretch(Image * inputImage, int low_limit,  int
     high_limit, float low_clip, float high_clip)

      <inputImage> - pointer to an Image
      <low_limit> - lower limit for stretch
      <high_limit> - high limit for stretch
      <low_clip> - percentage of low values to clip
                   before stretching
      <high_clip> - percentage of high values to clip
                    before stretching

PATH

     $CVIPHOME/HISTOGRAM/hist_stretch.c

DESCRIPTION

     This function increases contrast in an image  by  stretching
     the  histogram to span the range low_limit to high_limit. To
     improve  performance  of  the  function  when  outliers  are
     present, percentages low_clip and high_clip pixel values can
     be removed before the stretch takes place.

TYPES AND CONSTANTS

     None

RETURN VALUES

     Pointer to a stretched image.

HISTORY

     History information recorded: None

EXAMPLE

      #include <CVIPtoolkit.h>
      #include <CVIPimage.h>
      #include <CVIPconvert.h>
      #include <CVIPview.h>
      #include "histogram.h"
      #define VIEWER "picture"
      #define VIDEO_APP "SunVideo &"

      void main()
      {
      Image *cvipImage;
      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);
      /* the following call ranges the histogram between 100
      and 200.Before the ranging is done,the histogram is
      clipped with the low level being 10 and the high level
      being 230 */
      cvipImage = hist_stretch(cvipImage,100,200,10,230);
      print_CVIP("\n\t\tEnter the Output File Name:  ");
      outputfile = getString_CVIP();
      view_Image(cvipImage,outputfile);
      write_Image(cvipImage,outputfile,CVIP_NO,CVIP_NO,format,1);
      free(outputfile);
      }

SEE ALSO

     libhisto

AUTHOR

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