IHS

RGB to IHS conversion


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

Back to top

Description


Converts red, green, and blue (RGB) image channels to intensity, hue, and saturation (IHS) image channels. The IHS program is the inverse of the RGB program. The Intensity-Hue-Saturation transformation is used by the FUSE and FUSEPCT functions to perform data fusion.
Back to top

Parameters


Name Type Length Value range
InputR: Input red channel * Raster port 1 - 1  
InputG: Input green channel * Raster port 1 - 1  
InputB: Input blue channel * Raster port 1 - 1  
OutputI: Output intensity channel Raster port 0 - 1  
OutputH: Output hue channel Raster port 0 - 1  
OutputS: Output saturation 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

InputR: Input red channel

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

If the output channels (OutputI, OutputH, and OutputS) are specified as all 8-bit channels, the input channels must all be 8-bit. If the output channels are 16- or 32-bit, the input channels may be of any type. See the Details section for more information on channel types.

Duplicate channels are allowed.

InputG: Input green channel

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

If the output channels (OutputI, OutputH, and OutputS) are specified as all 8-bit channels, the input channels must all be 8-bit. If the output channels are 16- or 32-bit, the input channels may be of any type. See the Details section for more information on channel types.

Duplicate channels are allowed.

InputB: Input blue channel

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

If the output channels (OutputI, OutputH, and OutputS) are specified as all 8-bit channels, the input channels must all be 8-bit. If the output channels are 16- or 32-bit, the input channels may be of any type. See the Details section for more information on channel types.

Duplicate channels are allowed.

OutputI: Output intensity channel

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

The must be either all 8-bit or all 16- or 32-bit; see the Details section for more information on channel types. Output channels may be the same as the input channels; existing data will be overwritten.

Duplicate output channels are NOT allowed.

OutputH: Output hue channel

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

The must be either all 8-bit or all 16- or 32-bit; see the Details section for more information on channel types. Output channels may be the same as the input channels; existing data will be overwritten.

Duplicate output channels are NOT allowed.

OutputS: Output saturation channel

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

The must be either all 8-bit or all 16- or 32-bit; see the Details section for more information on channel types. Output channels may be the same as the input channels; existing data will be overwritten.

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

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

IHS is used by the FUSE and FUSEPCT functions to perform data fusion of color imagery with a black-and-white image.

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:

 Output channels (DBOC)      Input channels (DBIC)

 Scaled results:  8-bit      8-bit
 Exact  results:  16/32-bit  any type

When all input and output channels are 8-bit, the output data are linearly scaled between 0 and 255. When the three output channels are any combination of 16-bit signed, 16-bit unsigned or 32-bit real, any type of input channel is allowed and the output values are not scaled. If the output channels are 16-bit, unscaled values are truncated to integer values.

The RGB function can be used to convert intensity, hue, and saturation channels output by IHS back to red, green, and blue channels.

Back to top

Algorithm

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

Cylinder

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

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

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

 B1 = K6 * (2*B - R - G)
 X1 = K2 * (G - R)

 I = K3 * (R + G + B)

 If (B1 = 0) then
     If (R <= G) H = 90
     If (G < R)  H = 270

 If (B1 <> 0) then
     H = RadToDeg * atan(X1 / B1) 
     If (G > R and H < 0) H = H + 180
     If (G < R and H > 0) H = H + 180
     If (G = R and R > B) H = 180

 If (H < 0) H = H + 360
 If (H >= 360) H = H - 360
 
 S = sqrt(B1 * B1 + X1 * X1)

If the output channels are all 8-bit, the Intensity, Hue, and Saturation values are scaled between 0 and 255:

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

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 RGB to IHS values using the single-hexcone color model.

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

 Max = Maximum(R,G,B)
 Min = Minimum(R,G,B)
 Delta = Max - Min

 I = Max

 If (Max <> 0) S = Delta / Max
 If (Max = 0)  S = 0

 If (S = 0) H = 0                       (Hue is undefined)

 If (R = Max) H = (G - B) / Delta       (between yellow and magenta)
 If (G = Max) H = 2 + (B - R) / Delta   (between cyan and yellow)
 If (B = Max) H = 4 + (R - G) / Delta   (between magenta and cyan)
 H = H * 60                             (convert Hue to degrees)
 If (H < 0) H = H + 360                 (Hue must be positive)
 If (H >= 360) H = H - 360              (Hue must be less than 360)

If the output channels are all 8-bit, the Hue and Saturation values are scaled between 0 and 255:

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

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.