RGB -- IHS to RGB Conversion

Converts intensity, hue, and saturation (IHS) image channels to red, green, and blue (RGB) image channels.

The RGB program is the inverse of the IHS program.

The Red-Green-Blue transformation is used by the FUSE and FUSEPCT procedures to perform data fusion.

Progress of this program can be monitored. See MONITOR section.

See Also: IHS, FUSE, FUSEPCT

PARAMETERS

RGB is controlled by the following global parameters:

Name     Prompt                                  Count     Type
FILE     Database File Name                      1-64      Char
DBIC     Database Input Channel List             3         Int
DBOC     Database Output Channel List            3         Int
DBOW     Database Input Window                   0-4       Int
IHSMODEL IHS Model: CYLINDER/HEXCONE             1-8       Char

FILE

Specifies the name of the PCIDSK image file containing the Intensity-Hue-Saturation input and Red-Green-Blue output image channels.

 EASI>FILE="filename"

DBIC

Specifies three input channels to be interpreted as the intensity, hue and saturation components of a colour image.

 EASI>DBIC=intensity,hue,saturation

DBOC

Specifies three output channels to be interpreted as the red, green, and blue components of a colour image.

 EASI>DBOC=red,green,blue

DBIW

Specifies the rectangular window of image data to be transformed.

 EASI>DBIW=Xoffset,Yoffset,Xsize,Ysize
 EASI>DBIW=                     | transform entire image

IHSMODEL

  Valid Values:   CYLINDER, HEXCONE
  Default:        CYLINDER
Specifies which type of IHS colour model to use.

 EASI>IHSMODEL="HEXCONE"        | Hexcone model
 EASI>IHSMODEL=                 | defaults to CYLINDER
 EASI>IHSMODEL="CYLINDER"       | Cylinder model (original method)
See the BACKGROUND and ALGORITHM sections for more information about these IHS models.

DETAILS

RGB converts intensity, hue, and saturation image channels to red, green, and blue image channels. This is useful for enhancing and controlling the output colours for a given set of red/green/blue imagery.

RGB is used by the FUSE and FUSEPCT procedures to perform data fusion of colour imagery with a black-and-white image.

The three input channels represent the intensity, hue, and saturation channels. The three output channels are used for the output of red, green, and blue channels.

A specified rectangular window of image data (DBIW) can be transformed.

IHSMODEL specifies the IHS model (HEXCONE or CYLINDER) that was originally used to transform RGB values to IHS values. CYLINDER was the original method used by the IHS and RGB programs in older PCI software releases (Version 6.0.1 and before). The Hexcone model is used by many commercial Image Processing software packages. One model can produce more visually pleasing results than the other, depending on the circumstances. The Hexcone model runs about 15% faster than the Cylinder model.

Input channels may be used as output channels, in which case the original input image is overwritten by the output image. Duplicate channel numbers can be specified for input channels, but NOT for output channels.

Only the following configurations of input and output channel types are allowed:

 Input channels (DBIC)                 Output channels (DBOC)

 Scaled results:  8-bit channels      -->  3 any-type channels
 Exact  results:  16/32-bit channels  -->  3 any-type channels
When all three input channels are 8-bit, the IHS data are linearly scaled between 0 and 255. When the three input channels are any combination of 16-bit signed, 16-bit unsigned, or 32-bit real, the IHS data are not scaled. The output channels may be any type. If the output values are outside the range the output channels can support, the values are truncated.

MONITOR

Program progress can be monitored by printing the percentage of completed processing in odometer fashion. A system parameter, MONITOR, controls this activity:

 EASI>MONITOR="ON"           | turn monitor ON  (default)
 EASI>MONITOR="OFF"          | turn monitor OFF (recommended if
                             | running in batch/background mode)

ACKNOWLEDGEMENT

The software for the original Cylinder IHS model is based on a program written by Mit Tilkov of Cominco Ltd., developed using PCI's Software Toolbox package at B.C. Research's facilities.

BACKGROUND

Refer to the BACKGROUND section in the documentation for the IHS program for background information on the RGB-to-IHS and IHS-to-RGB transformations.

ALGORITHM

The equations used to convert Intensity, Hue, and Saturation colour values to Red, Green, and Blue colour values for both the Cylinder and the Hexcone IHS models are given below.

CYLINDER

The following algorithm is used to convert IHS to RGB values using the cylinder colour model.

 I = Intensity, H = Hue, S = Saturation
 R = Red, G = Green, B = Blue
If input channels are all 8-bit, then scaled Intensity, Hue and Saturation values are unscaled first:

 I = I * (442 / 255)
 H = H * (360 / 255)
 S = S * (208.2066 / 255)

 K2 = 1 / sqrt(2)
 K3 = 1 / sqrt(3)
 K6 = 1 / sqrt(6)
 PI is the constant PI (3.14159)
 DegToRad = PI / 180 (factor to convert degrees to radians)

 B1 = S * cos(DegToRad * H)
 X1 = S * sin(DegToRad * H)

 R = (K3 * I) - (K6 * B1) - (K2 * X1)
 G = (K3 * I) - (K6 * B1) + (K2 * X1) 
 B = (K3 * I) + (2 * K6 * B1)
The above algorithm was derived from the following references:

 Kruse, F.A. and G.L. Raines, 1984. "A Technique For Enhancing Digital
 Colour Images by Contrast Stretching in Munsell Colour Space",
 Proceedings of the International Symposium on Remote Sensing of
 Environment, 3rd Thematic Conference, Environmental Research Institute
 of Michigan, Colorado Springs, Colorado, pp. 755-773.

 Bonham-Carter, Graeme F., 1994.  Geographic Informations Systems for
 Geoscientists: Modelling with GIS. Computer Methods in the
 Geosciences, Volume 13, published by Pergamon (Elsevier Science Ltd),
 pp. 120-125.

HEXCONE

The following algorithm is used to convert IHS to RGB values using the single-hexcone colour model.

 I = Intensity, H = Hue, S = Saturation
 R = Red, G = Green, B = Blue
If input channels are all 8-bit, then scaled Hue and Saturation values are unscaled first:

 H = H * (360 / 255)
 S = S * (1 / 255)

 If (S = 0) (R,G,B) = (I,I,I)

 If (S > 0) then
     H = H / 60
     J = floor(H)
     F = H - J
     P = I * (1 - S)
     Q = V * (1 - (S * F))
     T = V * (1 - (S * (1 - F)))
     If (J = 0) (R,G,B) = (I,T,P)
     If (J = 1) (R,G,B) = (Q,I,P)
     If (J = 2) (R,G,B) = (P,I,T)
     If (J = 3) (R,G,B) = (P,Q,I)
     If (J = 4) (R,G,B) = (T,P,I)
     If (J = 5) (R,G,B) = (I,P,Q)
The above algorithm was obtained from page 593 of the following text book:

 Foley, J.D., A. van Dam, S.K. Feiner and J.F. Hughes, 1990.
 Computer Graphics: Principles and Practice (second edition).
 Addison-Wesley Publishing Company.

EXAMPLE

See the EXAMPLE section of the IHS program for a good example of how to use the IHS and RGB programs to perform data fusion.


About PCI Help Gateway