NAME

     gray_binary - performs binary/gray code conversion

SYNOPSIS

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

     Image * gray_binary(Image * inputImage, int direction)

      <inputImage> - pointer to an Image
      <direction> - direction (0=gray->binary 1=binary->gray)

PATH

     $CVIPHOME/CONVERSION/gray_binary.c

DESCRIPTION

     Performs binary code to gray code conversion and the inverse
     conversion.   The input image should be a real image, of any
     data type (CVIP_BYTE, CVIP_SHORT,  CVIP_INTEGER,  CVIP_FLOAT
     or CVIP_DOUBLE).

     Based on code in Numerical Recipes in C, second edition.

TYPES AND CONSTANTS

     None

RETURN VALUES

     Pointer to an encoded image

HISTORY

     History information recorded: None

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 performs the binary code to gray
      code conversion */
      cvipImage = gray_binary(cvipImage,0);
      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

     libconverter

AUTHOR

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