## NAME

         igs_segment - improved gray-scale quantization

## SYNOPSIS

         Image * igs_segment(Image * inputImage, int gray_level)

          <inputImage> - pointer to an Image
          <gray_level> - gray level of the output image

## PATH

         $CVIPHOME/SEGMENTATION/igs_segment.c

## DESCRIPTION

         This  function  remaps  (quantizes)  an  image  to  a  user-
         specified  number  of gray levels to overcome the false con-
         touring present in uniform quantization.  It  uses  improved
         gray-scale (igs_segment) quantization introduced on page 318
         of  the   following   book:    Digital   Image   Processing,
         R.C.Gonzalez & R.Woods, Addison-Wesley, 1992.

## TYPES AND CONSTANTS

         None

## RETURN VALUES

         Upon successful completion, returns a non-NULL pointer; oth-
         erwise, returns NULL.

## HISTORY

         History information recorded: None

## DIAGNOSTICS

         If the input image is not a  CVIP_BYTE  image,  it  will  be
         remapped   to   CVIP_BYTE   before  processing.  It  can  be
         multi_band and assumed to be real only.

## EXAMPLE

          #include <CVIPtoolkit.h>
          #include <CVIPimage.h>
          #include <CVIPdef.h>
          #include <CVIPconvert.h>
          #include <CVIPview.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 remaps the desired number of gray
          levels to 2 */
          cvipImage = (Image *)igs_segment(cvipImage,2);
          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

         libsegment

## AUTHOR

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