## NAME

         colorxform - transforms an RGB image into a new color space

## SYNOPSIS

          #include "CVIPdef.h"
          #include "CVIPcomplex.h"
          #include "CVIPtoolkit.h"
          #include "CVIPcolor.h"

         Image  *  colorxform(const  Image  *rgbImage,   COLOR_FORMAT
         newcspace, float *norm, float *refwhite, int dir)

          <rgbImage> - pointer to an Image structure (data type equal
         to or less precise than type CVIP_FLOAT)
          <newcspace> - desired color space
          <norm> - pointer to a normalization vector
          <refwhite> - pointer to reference white values (for LUV and
         LAB only)
          <dir> - direction of transform (1 => (RGB->newcspace)  else
         (newcspace->RGB)

## PATH

         $CVIPHOME/COLOR/cxform.c

## DESCRIPTION

         Transforms an RGB image into a new color space specified  by
         <newcspace>, one of...

          HSL - Hue/Saturation/Lightness,
          HSV - Hue/Saturation/Value,
          SCT - Spherical Coordinates Transform,
          CCT - Cylindrical Coordinates Transform,
          LAB - C.I.E. L*a*b* Color Coordinate System,
          LUV - C.I.E. L*u*v*  Color  Coordinate  System,
          XYZ - Chromaticity  Coordinate System.

         Each transform  requires  that  the  input  image  be   nor-
         malized  between  0 and 1. A pointer to a normalization vec-
         tor <norm> must be passed that contains a set of  values  to
         normalize the  image  bands  with. (e.g. norm[0] = norm[1] =
         norm[2] = 255.0). If <norm> is NULL then it will be  assumed
         that  the  input  image is already normalized. colorxform is
         capable of performing several inverse transforms as well. If
         <dir>  is  passed as any other value except for one then the
         inverse transform (<newcspace>->RGB)  will   be   performed.
         Currently the only inverse transforms that are supported are
         HSL->RGB  &  HSV->RGB.  If  either  a   L*a*b*   or   L*u*v*
         transform   is   requested   then  an  additional  parameter
         <refwhite> must be  passed  as  well  (e.g.   refwhite[0]  =
         refwhite[1]  = refwhite[2] = 1.0 ). All transforms will also
         be normalized to the range [0.0 ... 1.0] except  for  L*a*b*
         and  L*u*v*  whose  range will vary with different values of
         reference white.

## TYPES AND CONSTANTS

         None

## RETURN VALUES

         Pointer to transformed image

## HISTORY

         History information recorded: None

## EXAMPLE

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

          void main()
          {
          Image *cvipImage;
          IMAGE_FORMAT format;
          char *inputfile,*outputfile;
          float norm[3]={255.0,255.0,255.0};
          float ref[3]={1.0,1.0,1.0};

          setDisplay_Image(VIEWER, "Default");
          /* The input image should be a COLOR one */
          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 transforms an RGB image into
          a new color space LUV */
          cvipImage=colorxform(cvipImage,LUV,norm,ref,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,VIP,1);
          free(outputfile);
          }

## SEE ALSO

         libcolor

## AUTHOR

         Copyright (C) 1996 SIUE -  by  Scott  E.  Umbaugh  and  Greg
         Hance.