RGB

IHS to RGB conversion


EnvironmentsPYTHON :: EASI :: MODELER
Batch ModeYes
Quick linksDescription :: Parameters :: Parameter descriptions :: Details :: Algorithm :: References :: Related

Back to top

Description


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 functions to perform data fusion.
Back to top

Parameters


Name Type Length Value range
InputI: Input intensity channel * Raster port 1 - 1  
InputH: Input hue channel Raster port 0 - 1  
InputS: Input saturation channel Raster port 0 - 1  
OutputR: Output red channel Raster port 0 - 1  
OutputG: Output green channel Raster port 0 - 1  
OutputB: Output blue channel Raster port 0 - 1  
IHS Model String 0 - 1 CYLINDER | HEXCONE
Default: CYLINDER
Output Type: Output channel type Text port 0 - 4  

* Required parameter
Back to top

Parameter descriptions

InputI: Input intensity channel

Specifies the input channel to be interpreted as the intensity component of a color image.

The input channels (InputI, InputH, and InputS) must either be all 8-bit or any combination of 16-bit and 32-bit. See the Details section for more information about channel types.

Duplicate channels are allowed.

InputH: Input hue channel

Specifies the input channel to be interpreted as the hue component of a color image.

The input channels (InputI, InputH, and InputS) must either be all 8-bit or any combination of 16-bit and 32-bit. See the Details section for more information about channel types.

Duplicate channels are allowed.

InputS: Input saturation channel

Specifies the input channel to be interpreted as the saturation component of a color image.

The input channels (InputI, InputH, and InputS) must either be all 8-bit or any combination of 16-bit and 32-bit. See the Details section for more information about channel types.

Duplicate channels are allowed.

OutputR: Output red channel

Specifies the output raster channel to be interpreted as the red component of a color image.

The output channels may be of any type; see the Details section for more information about channel types.

Duplicate output channels are NOT allowed.

OutputG: Output green channel

Specifies the output raster channel to be interpreted as the green component of a color image.

The output channels may be of any type; see the Details section for more information about channel types.

Duplicate output channels are NOT allowed.

OutputB: Output blue channel

Specifies the output raster channel to be interpreted as the blue component of a color image.

The output channels may be of any type; see the Details section for more information about channel types.

Duplicate output channels are NOT allowed.

IHS Model

Specifies the type of IHS color model to use.

Supported color models are:

See the Details section for more information about these IHS models.

Output Type: Output channel type

Specifies the image data type of the output channels.

Supported output types are:
Back to top

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 colors for a given set of red/green/blue imagery. RGB is the inverse of the IHS function.

RGB is used by the FUSE and FUSEPCT functions to perform data fusion of color 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.

The IHSMODEL parameter 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 functions in older PCI software releases (version 6.0.1 and earlier). The Hexcone model is used by many commercial Image Processing software applications. One model may 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 may 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 is 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 is not scaled. The output channels may be of any type. If the output values are outside the range that the output channels can support, the values are truncated.

Back to top

Algorithm

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

Cylinder

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

I = Intensity, H = Hue, S = Saturation
R = Red, G = Green, B = Blue

If the input channels are all 8-bit, 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)

For more information on the above algorithm, please see Kruse, F.A. and G.L. Raines, and Bonham-Carter, Graeme F. in the References section.

Hexcone

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

I = Intensity, H = Hue, S = Saturation
R = Red, G = Green, B = Blue

If the input channels are all 8-bit, 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)

For more information on the above algorithm, please see Foley, J.D., A. van Dam, S.K. Feiner and J.F. Hughes in the References section.

Back to top

References

Kruse, F.A. and G.L. Raines, (1984). A Technique For Enhancing Digital Color Images by Contrast Stretching in Munsell Color Space. In 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 Information Systems for Geoscientists: Modelling with GIS. Computer Methods in the Geosciences, Volume 13, published by Pergamon (Elsevier Science Ltd), pp. 120-125.

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.

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.