javax.media.jai
Class IHSColorSpace

java.lang.Object
  |
  +--java.awt.color.ColorSpace
        |
        +--javax.media.jai.ColorSpaceJAI
              |
              +--javax.media.jai.IHSColorSpace
All Implemented Interfaces:
Serializable

public final class IHSColorSpace
extends ColorSpaceJAI

Singleton class representing the IHS (Intensity, Hue, Saturation) color space (also known as HSI or HIS).

The RGB-to-IHS transformation is defined by the equations:

where the R, G, B values have been normalized to the range [0.0, 1.0]. Refer to Practical Algorithms for Image Analysis, Seul, et. al., (Cambridge, 2000), pages 50-55, for more information. The inverse transformation (IHS-to-RGB) is defined as:

When H is in [2PI/3, 4PI/3], R should be the smallest. Then, there exists

R = (1-S)I

and

where c1 = 3I-R and c2 = sqrt(3)(R-I)tg(H)

when H is in [4PI/3, 2PI],

G = (1-S)I

and

where c1 = 3I-G and c2 = sqrt(3)(G-I)tg(H-2PI/3)

when H is in [0, 2PI/3],

B = (1-S)I

and

where c1 = 3I-B and c2 = sqrt(3)(B-I)tg(H-4PI/3)

Methods defined in the superclasses are not commented extensively.

Since:
JAI 1.1
See Also:
ColorSpaceJAI, Serialized Form

Fields inherited from class java.awt.color.ColorSpace
CS_CIEXYZ, CS_GRAY, CS_LINEAR_RGB, CS_PYCC, CS_sRGB, TYPE_2CLR, TYPE_3CLR, TYPE_4CLR, TYPE_5CLR, TYPE_6CLR, TYPE_7CLR, TYPE_8CLR, TYPE_9CLR, TYPE_ACLR, TYPE_BCLR, TYPE_CCLR, TYPE_CMY, TYPE_CMYK, TYPE_DCLR, TYPE_ECLR, TYPE_FCLR, TYPE_GRAY, TYPE_HLS, TYPE_HSV, TYPE_Lab, TYPE_Luv, TYPE_RGB, TYPE_XYZ, TYPE_YCbCr, TYPE_Yxy
 
Constructor Summary
protected IHSColorSpace()
          Constructs an instance of this class with type ColorSpace.TYPE_HSV, 3 components, and preferred intermediary space sRGB.
 
Method Summary
 float[] fromCIEXYZ(float[] colorValue)
          Converts a single color value from CIEXYZ to IHS.
 WritableRaster fromCIEXYZ(Raster src, int[] srcComponentSize, WritableRaster dest, int[] destComponentSize)
          Converts a Raster of colors represented as pixels from CIEXYZ to IHS.
 float[] fromRGB(float[] rgbValue)
          Converts a single color value from sRGB to IHS.
 WritableRaster fromRGB(Raster src, int[] srcComponentSize, WritableRaster dest, int[] destComponentSize)
          Converts a Raster of colors represented as pixels from sRGB to IHS.
static IHSColorSpace getInstance()
          Retrieves the unique instance of this class the construction of which is deferred until the first invocation of this method.
 float[] toCIEXYZ(float[] colorValue)
          Converts a single color value from IHS to CIEXYZ.
 WritableRaster toCIEXYZ(Raster src, int[] srcComponentSize, WritableRaster dest, int[] destComponentSize)
          Converts a Raster of colors represented as pixels from IHS to CIEXYZ.
 float[] toRGB(float[] colorValue)
          Converts a single color value from IHS to sRGB.
 WritableRaster toRGB(Raster src, int[] srcComponentSize, WritableRaster dest, int[] destComponentSize)
          Converts a Raster of colors represented as pixels from IHS to sRGB.
 
Methods inherited from class javax.media.jai.ColorSpaceJAI
checkParameters, CIEXYZToRGB, isRGBPreferredIntermediary, RGBToCIEXYZ
 
Methods inherited from class java.awt.color.ColorSpace
getInstance, getName, getNumComponents, getType, isCS_sRGB
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IHSColorSpace

protected IHSColorSpace()
Constructs an instance of this class with type ColorSpace.TYPE_HSV, 3 components, and preferred intermediary space sRGB.
Method Detail

getInstance

public static IHSColorSpace getInstance()
Retrieves the unique instance of this class the construction of which is deferred until the first invocation of this method.

fromCIEXYZ

public float[] fromCIEXYZ(float[] colorValue)
Converts a single color value from CIEXYZ to IHS.
Overrides:
fromCIEXYZ in class ColorSpace

fromRGB

public float[] fromRGB(float[] rgbValue)
Converts a single color value from sRGB to IHS.
Overrides:
fromRGB in class ColorSpace

toCIEXYZ

public float[] toCIEXYZ(float[] colorValue)
Converts a single color value from IHS to CIEXYZ.
Overrides:
toCIEXYZ in class ColorSpace

toRGB

public float[] toRGB(float[] colorValue)
Converts a single color value from IHS to sRGB.
Overrides:
toRGB in class ColorSpace

fromCIEXYZ

public WritableRaster fromCIEXYZ(Raster src,
                                 int[] srcComponentSize,
                                 WritableRaster dest,
                                 int[] destComponentSize)
Converts a Raster of colors represented as pixels from CIEXYZ to IHS.
Overrides:
fromCIEXYZ in class ColorSpaceJAI
Following copied from class: javax.media.jai.ColorSpaceJAI
Parameters:
src - the source Raster to be converted.
srcComponentSize - array that specifies the number of significant bits per source color component; ignored for floating point data. If null defaults to the value returned by src.getSampleModel().getSampleSize().
dest - the destination WritableRaster, or null.
destComponentSize - array that specifies the number of significant bits per destination color component; ignored for floating point data. If null, defaults to the value returned by dest.getSampleModel().getSampleSize(), or the sample size of the newly created destination WritableRaster if dest is null.
Returns:
dest color converted from src or a new, WritableRaster containing the converted pixels if dest is null.
Throws:
IllegalArgumentException - if src is null, the number of source or destination bands does not equal the number of components of the respective color space, or either component size array is non-null and has length not equal to the number of bands in the respective Raster.

fromRGB

public WritableRaster fromRGB(Raster src,
                              int[] srcComponentSize,
                              WritableRaster dest,
                              int[] destComponentSize)
Converts a Raster of colors represented as pixels from sRGB to IHS.
Overrides:
fromRGB in class ColorSpaceJAI
Following copied from class: javax.media.jai.ColorSpaceJAI
Parameters:
src - the source Raster to be converted.
srcComponentSize - array that specifies the number of significant bits per source color component; ignored for floating point data. If null defaults to the value returned by src.getSampleModel().getSampleSize().
dest - the destination WritableRaster, or null.
destComponentSize - array that specifies the number of significant bits per destination color component; ignored for floating point data. If null, defaults to the value returned by dest.getSampleModel().getSampleSize(), or the sample size of the newly created destination WritableRaster if dest is null.
Returns:
dest color converted from src or a new, WritableRaster containing the converted pixels if dest is null.
Throws:
IllegalArgumentException - if src is null, the number of source or destination bands does not equal the number of components of the respective color space, or either component size array is non-null and has length not equal to the number of bands in the respective Raster.

toCIEXYZ

public WritableRaster toCIEXYZ(Raster src,
                               int[] srcComponentSize,
                               WritableRaster dest,
                               int[] destComponentSize)
Converts a Raster of colors represented as pixels from IHS to CIEXYZ.
Overrides:
toCIEXYZ in class ColorSpaceJAI
Following copied from class: javax.media.jai.ColorSpaceJAI
Parameters:
src - the source Raster to be converted.
srcComponentSize - array that specifies the number of significant bits per source color component; ignored for floating point data. If null defaults to the value returned by src.getSampleModel().getSampleSize().
dest - the destination WritableRaster, or null.
destComponentSize - array that specifies the number of significant bits per destination color component; ignored for floating point data. If null, defaults to the value returned by dest.getSampleModel().getSampleSize(), or the sample size of the newly created destination WritableRaster if dest is null.
Returns:
dest color converted from src or a new, WritableRaster containing the converted pixels if dest is null.
Throws:
IllegalArgumentException - if src is null, the number of source or destination bands does not equal the number of components of the respective color space, or either component size array is non-null and has length not equal to the number of bands in the respective Raster.

toRGB

public WritableRaster toRGB(Raster src,
                            int[] srcComponentSize,
                            WritableRaster dest,
                            int[] destComponentSize)
Converts a Raster of colors represented as pixels from IHS to sRGB.
Overrides:
toRGB in class ColorSpaceJAI
Following copied from class: javax.media.jai.ColorSpaceJAI
Parameters:
src - the source Raster to be converted.
srcComponentSize - array that specifies the number of significant bits per source color component; ignored for floating point data. If null defaults to the value returned by src.getSampleModel().getSampleSize().
dest - the destination WritableRaster, or null.
destComponentSize - array that specifies the number of significant bits per destination color component; ignored for floating point data. If null, defaults to the value returned by dest.getSampleModel().getSampleSize(), or the sample size of the newly created destination WritableRaster if dest is null.
Returns:
dest color converted from src or a new, WritableRaster containing the converted pixels if dest is null.
Throws:
IllegalArgumentException - if src is null, the number of source or destination bands does not equal the number of components of the respective color space, or either component size array is non-null and has length not equal to the number of bands in the respective Raster.