Help for GLLCOLOR

PURPOSE
Welcome to GLLCOLOR .  GLLCOLOR transforms
Galileo images taken through several filters into a color image in which an
attempt is made to reproduce accurately certain designated spectra ("special
colors").  At this time, the only output devices supported by this program are
the CONRAC 7211 color monitor, and the MDA Color Fire film recorder. 
There are two modes for 'FILM products and one for 'TV products.
See IOM Klaasen 7/23/91.

BACKGROUND
This program implements an algorithm specified by K. Klaasen and described in 
the Galileo calibration report GLL 625-210, section 6).  In particular, if we 
estimate for each pixel 

  		T = M * R,

where T is a triplet of tristimulus values, M is a 3 by 3 matrix, and R is a
triplet of reflectance (or radiance) values.  The matrix M is solved by
writing the equation for 3-4 "special colors" and then solving the resulting
simultaneous equations.  When the output device is a monitor, T is the 
tristimulus of the radiance spectra and R are the radiances.  When the output
device is a film recorder, T is the tristimulus values calculated from the 
reflectance spectra (radiance spectrum divided by the solar spectrum), and R 
are the reflectances (radiance divided by the camera's response to the solar 
spectrum).  This solution has been extended here to arbitrary numbers of inputs 
and colors, using a least-squares solution when the problem is over-determined.

The matrix which converts tristimulus values to film recorder input is computed 
(and then hard coded) as described in the Galileo calibration report.
All hard coded values can be overridden.

This program has a lot of similarities to GIACONDA.  See "OPERATION" for a list 
of differences between the two programs.


EXECUTION
The program is executed by specifying up to eight halfword Galileo images
(registered and GALSOS'ed) taken through different filters, up to 10 special
colors, and, optionally, three output files (red, blue, and green), a weight
for each special color (applied to a least-square fit), a scale factor for all 
input images, a conversion factor for each input image, and an image display 
device. The program will display the resulting transformation matrix (input dn 
to output intensity) and, if output files have been specified, will generate 
images which may be input to the specified device.  The input images should be 
reflectance images if the specified DEVICE is a film recorder, and radiance 
images if the specified DEVICE is a color monitor. 

If the program indicates "NO UNIQUE SOLUTION", then two of the input images
were probably taken through the same filter. 


OPERATION
The operation of this program is very similar to that of program, GIACONDA.
The user should refer to this section of the GIACONDA help for more information.
There are several important differences between the two programs:
  1) The special colors available to GLLCOLOR are hard coded into the program --
     they may be modified via parameters however.
  2) GLLCOLOR gets I/F (or radiance) of special colors from GALSOS'ed images of
     a color calibration target , whereas GIACONDA calculates those numbers. 
  3) If the output device is a monitor, then the input to GLLCOLOR must be a 
     radiance image -- GIACONDA expects all images to be in reflectance (I/F).
  4) GLLCOLOR implements a solution for film recorders, and
       a) the tristimulus-to-rgb conversion is done as described in the Galileo 
          calibration report;
       b) the simultaneous equations are solved using the tristimulus values of 
          the reflectance of each of the selected special colors.
  5) GLLCOLOR uses a CRT exponent of 2.25 instead of the 2.6 used by GIACONDA.
  6) Parameter CONV has been added, which is a conversion factor for each input
     image, allowing all inputs to be scaled in the same units.     
  7) A translation from "scene DN" to "DN input to film recorder" has been added
     so that the output for reflectance is linearly proportional to the MDA
     calibration curve.  Before this translation, reflectance output from GLLCOLOR
     was logorithmically proportional to the MDA calibration curve, which is
     based on measurements taken off the negetives (not positive prints).
     The translation equation follows:

                  255 * log{(C-B)*DN/(255*B)+1}
            DN' = -----------------------------
                           log(C/B)

     NOTE: If 'HALF was specified then the 255 value above is replaced by
           32767.

                         where DN' = DN value input to film recorder
                               C   = maximum print reflectivity
                               B   = minimum print reflectivity
                               DN  = DN value proportional to scene reflectivity

EXAMPLE
In the following examples the user creates output files, OUT.*, using input
images INP.*, and special colors, 11/7, 7/6, and 5/7, with corresponding
weights, 3, 2, and 1, respectively.  He wants input dn's of 10000 to be the
maximum brightness (default).  The resulting images will be displayed on a
Conrac 7211 monitor. In this mode (radiance) Galsos must produce images
in radiance units.

  VICAR>GLLCOLOR INP=(INP.ORA,INP.CLR,INP.GRE) OUT=(OUT.RED,OUT.GRE,OUT.BLU)    VICAR>+ COLORS=(11/7,7/6,5/7) WEIGHTS=(3.,2.,1.) 'TV
 
PROGRAM HISTORY

WRITTEN BY: 		R. BRILL, 9 MARCH, 1988
COGNIZANT PROGRAMMER:	J Lorre, Nov 90
REVISIONS:
  2 Dec 93  FFM  Ported to Unix.
                 Put the internal functions minvert, mdet, mcov of
                 subroutine XYZTORBG in line, and rename them as 
                 mainvert, madet, and macof.
                 Add IF statements for POW, & LOG, in order to work 
                 on UNIX.
 24 Sep 98  GMY  Updated test script.  Added call to GETPROJ.  AR 100884
                 Initialized histogram hists.
                 Made ANSI_C compatible.
!


PARAMETERS:


INP

input image files

OUT

output image files

COLORS

special colors

WEIGHTS

special color weights

CONV

input image conversion factors for radiance.

IOVF

input image conversion factors for reflectance.

FILTER

GLL filter positions.

SCALE

input image maximum (dn * CONV)

THRESHOL

input DN threshold

FILMSCAL

manual override of gross scaling for FILMMODE=0 or 1 option.

REFIT

fine scaling for FILMMODE=1 mode

PERCENT

histogram saturation percentage.

DEVICE

output device

FILMMODE

the method for film.

INC

Line and Sample increment.

EXPO

TV exponent

MAXDN

Max output DN target.

NOAUTO

AUTO scaling or NOAUTO scaling default=AUTO

MINREF

RGB min reflectances

MAXREF

RGB max relectances

TMAX

RGB Tmax buffer

TVMAT

3X3 TV device matrix

FILMMAT

3X3 film device matrix

XINV

3X3 xinv matrix

C0NAME

Name of color 0

C0XYXRAD

XYZ radiance color 0

C0XYZIOF

XYZ reflectance color 0

C0DNRAD

DN's radiance 7 filters for color 0

C0DNIOF

DN's reflectance 7 filters for color 0

C1NAME

Name of color 1

C1XYXRAD

XYZ radiance color 1

C1XYZIOF

XYZ reflectance color 1

C1DNRAD

DN's radiance 7 filters for color 1

C1DNIOF

DN's reflectance 7 filters for color 1

C2NAME

Name of color 2

C2XYXRAD

XYZ radiance color 2

C2XYZIOF

XYZ reflectance color 2

C2DNRAD

DN's radiance 7 filters for color 2

C2DNIOF

DN's reflectance 7 filters for color 2

C3NAME

Name of color 3

C3XYXRAD

XYZ radiance color 3

C3XYZIOF

XYZ reflectance color 3

C3DNRAD

DN's radiance 7 filters for color 3

C3DNIOF

DN's reflectance 7 filters for color 3

C4NAME

Name of color 4

C4XYXRAD

XYZ radiance color 4

C4XYZIOF

XYZ reflectance color 4

C4DNRAD

DN's radiance 7 filters for color 4

C4DNIOF

DN's reflectance 7 filters for color 4

C5NAME

Name of color 5

C5XYXRAD

XYZ radiance color 5

C5XYZIOF

XYZ reflectance color 5

C5DNRAD

DN's radiance 7 filters for color 5

C5DNIOF

DN's reflectance 7 filters for color 5

C6NAME

Name of color 6

C6XYXRAD

XYZ radiance color 6

C6XYZIOF

XYZ reflectance color 6

C6DNRAD

DN's radiance 7 filters for color 6

C6DNIOF

DN's reflectance 7 filters for color 6

C7NAME

Name of color 7

C7XYXRAD

XYZ radiance color 7

C7XYZIOF

XYZ reflectance color 7

C7DNRAD

DN's radiance 7 filters for color 7

C7DNIOF

DN's reflectance 7 filters for color 7

C8NAME

Name of color 8

C8XYXRAD

XYZ radiance color 8

C8XYZIOF

XYZ reflectance color 8

C8DNRAD

DN's radiance 7 filters for color 8

C8DNIOF

DN's reflectance 7 filters for color 8

C9NAME

Name of color 9

C9XYXRAD

XYZ radiance color 9

C9XYZIOF

XYZ reflectance color 9

C9DNRAD

DN's radiance 7 filters for color 9

C9DNIOF

DN's reflectance 7 filters for color 9

See Examples:


Cognizant Programmer: