## NAME

         gray_linear - performs linear gray level modification

## SYNOPSIS

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

         Image *gray_linear(Image * inputImage, double start,  double
         end, double s_gray, double slope, int change, int band)

          <inputImage> - pointer to an Image
          <start> - initial gray level to modify
          <end> - final gray level to modify
          <s_gray> - new initial gray level
          <slope> - slope of modifying line
          <change> - 0=change out-of-range pixels to black
                     1=don't modify out-of-range pixel values
          <band> - the band number to modify

## PATH

         $CVIPHOME/HISTOGRAM/graylevel_mod.c

## DESCRIPTION

         Performs linear gray level modification on a range of values
         in an image.  The user specifies a range of values to change
         with <start> and <end>, the new gray level to apply  at  the
         <start>  value,  and the function calculates a new value for
         each subsequent gray value by applying <slope> to  <s_gray>,
         until  <end> is reached. Slope can be positive, negative, or
         zero. Those values not within the range <start>...<end>  can
         be set to zero or left unmodified.

         The parameter band specifies which band to modify, which can
         be a non-negative integeter (from 0 to no_of_bands -1) for a
         specific band, or -1 representing  all  bands.  If  band  is
         equal to or greater than no_of_bands, the function will fail
         and return a NULL pointer, since the required  band  doesn't
         exist.  Usually,  the  user  is recommended to use -1 as the
         simplest way to use the function.

## TYPES AND CONSTANTS

         None

## RETURN VALUES

         Pointer to a modified 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 performs a mapping for pixels
          ranging from 0 to 255 with the starting pixel being
          0 and the slope of the mapping being 2. The mapping
          works on all bands*/
          cvipImage = gray_linear(cvipImage,0.0,255.0,0.0,2.0
          ,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,format,1);
          free(outputfile);
          }

## SEE ALSO

         libhisto

## AUTHOR

         Copyright (C) 1996 SIUE - by Scott E. Umbaugh and Kun Luo.