RGB

IHS to RGB conversion


EnvironmentsPYTHON :: EASI :: MODELER
Quick linksDescription :: Parameters :: Parameter descriptions :: Details :: Example :: 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 Caption Length Value range
FILE* String Input file name 1 - 192  
DBIC* Integer Input IHS channels 3 - 3  
DBOC* Integer Output RGB channels 3 - 3  
DBIW Integer Input window 0 - 4 Xoffset, Yoffset, Xsize, Ysize
IHSMODEL String IHS Model 0 - 8 CYLINDER | HEXCONE
Default: CYLINDER
MONITOR String Monitor mode 0 - 3 ON, OFF
Default: ON

* Required parameter
Back to top

Parameter descriptions

FILE

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

DBIC

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

Input channels 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.

Ranges of channels or segments can be specified with negative values. For example, {1,-4,10} is internally expanded to {1,2,3,4,10}. When you are not specifying a range in this way, only 48 numbers can be specified explicitly.

DBOC

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

Output channels may be of any type; see the Details section for more information on channel types.

Duplicate channels are NOT allowed.

Ranges of channels or segments can be specified with negative values. For example, {1,-4,10} is internally expanded to {1,2,3,4,10}. When you are not specifying a range in this way, only 48 numbers can be specified explicitly.

DBIW

Specifies the rectangular window (Xoffset, Yoffset, Xsize, Ysize) that is read from the input channels. If this parameter is not specified, the entire image is used by default.

Xoffset, Yoffset define the upper-left starting pixel coordinates of the window. Xsize is the number of pixels that define the window width. Ysize is the number of lines that define the window height.

IHSMODEL

Specifies the type of IHS color model to use.

Supported color models are:

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

MONITOR

The program progress can be monitored by printing the percentage of processing completed. A system parameter, MONITOR, controls this activity.

Available options 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.

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

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

Example

See the Example section of the IHS function for an example of how to use the IHS and RGB functions to perform data fusion.

EASI>FILE	=	"irvine.pix"
EASI>DBIC	=	7,8,9	! use input image channels 7,8,9
EASI>DBOC	=	7,8,9	! output channels for RGB image
EASI>DBIW	=		! process entire image
EASI>IHSMODEL	=	'CYLINDER'

EASI>RUN RGB
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.®, 2024. All rights reserved.