[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

| Color Space Conversions |

## Modules

| Polar Color Coordinates

## Classes

class | Lab2RGBFunctor< T >
| Convert perceptual uniform CIE L*a*b* into linear (raw) RGB. More...
class | Lab2RGBPrimeFunctor< T >
| Convert perceptual uniform CIE L*a*b* into non-linear (gamma corrected) R'G'B'. More...
class | Lab2XYZFunctor< T >
| Convert perceptual uniform CIE L*a*b* into standardized tri-stimulus XYZ. More...
class | Luv2RGBFunctor< T >
| Convert perceptual uniform CIE L*u*v* into linear (raw) RGB. More...
class | Luv2RGBPrimeFunctor< T >
| Convert perceptual uniform CIE L*u*v* into non-linear (gamma corrected) R'G'B'. More...
class | Luv2XYZFunctor< T >
| Convert perceptual uniform CIE L*u*v* into standardized tri-stimulus XYZ. More...
class | RGB2LabFunctor< T >
| Convert linear (raw) RGB into perceptual uniform CIE L*a*b*. More...
class | RGB2LuvFunctor< T >
| Convert linear (raw) RGB into perceptual uniform CIE L*u*v*. More...
class | RGB2RGBPrimeFunctor< From, To >
| Convert linear (raw) RGB into non-linear (gamma corrected) R'G'B'. More...
class | RGB2sRGBFunctor< From, To >
| Convert linear (raw) RGB into standardized sRGB. More...
class | RGB2XYZFunctor< T >
| Convert linear (raw) RGB into standardized tri-stimulus XYZ. More...
class | RGBPrime2LabFunctor< T >
| Convert non-linear (gamma corrected) R'G'B' into perceptual uniform CIE L*a*b*. More...
class | RGBPrime2LuvFunctor< T >
| Convert non-linear (gamma corrected) R'G'B' into perceptual uniform CIE L*u*v*. More...
class | RGBPrime2RGBFunctor< From, To >
| Convert non-linear (gamma corrected) R'G'B' into non-linear (raw) RGB. More...
class | RGBPrime2XYZFunctor< T >
| Convert non-linear (gamma corrected) R'G'B' into standardized tri-stimulus XYZ. More...
class | RGBPrime2YPrimeCbCrFunctor< T >
| Convert non-linear (gamma corrected) R'G'B' into Y'CbCr color difference components. More...
class | RGBPrime2YPrimeIQFunctor< T >
| Convert non-linear (gamma corrected) R'G'B' into Y'IQ components. More...
class | RGBPrime2YPrimePbPrFunctor< T >
| Convert non-linear (gamma corrected) R'G'B' into Y'PbPr color difference components. More...
class | RGBPrime2YPrimeUVFunctor< T >
| Convert non-linear (gamma corrected) R'G'B' into Y'UV components. More...
class | sRGB2RGBFunctor< From, To >
| Convert standardized sRGB into non-linear (raw) RGB. More...
class | XYZ2LabFunctor< T >
| Convert standardized tri-stimulus XYZ into perceptual uniform CIE L*a*b*. More...
class | XYZ2LuvFunctor< T >
| Convert standardized tri-stimulus XYZ into perceptual uniform CIE L*u*v*. More...
class | XYZ2RGBFunctor< T >
| Convert standardized tri-stimulus XYZ into linear (raw) RGB. More...
class | XYZ2RGBPrimeFunctor< T >
| Convert standardized tri-stimulus XYZ into non-linear (gamma corrected) R'G'B'. More...
class | YPrimeCbCr2RGBPrimeFunctor< T >
| Convert Y'CbCr color difference components into non-linear (gamma corrected) R'G'B'. More...
class | YPrimeIQ2RGBPrimeFunctor< T >
| Convert Y'IQ color components into non-linear (gamma corrected) R'G'B'. More...
class | YPrimePbPr2RGBPrimeFunctor< T >
| Convert Y'PbPr color difference components into non-linear (gamma corrected) R'G'B'. More...
class | YPrimeUV2RGBPrimeFunctor< T >
| Convert Y'UV color components into non-linear (gamma corrected) R'G'B'. More...

## Detailed Description

Convert between RGB, sRGB, R'G'B', XYZ, L*a*b*, L*u*v*, Y'PbPr, Y'CbCr, Y'IQ, and Y'UV color spaces.

#include <vigra/colorconversions.hxx>
Namespace: vigra

- RGB/sRGB/R'G'B'
  linear and non-linear (gamma corrected) additive color

  - vigra::RGB2sRGBFunctor
  - vigra::sRGB2RGBFunctor
  - vigra::RGB2RGBPrimeFunctor
  - vigra::RGBPrime2RGBFunctor

- XYZ
  device independent color representation (according to Publication CIE No 15.2 "Colorimetry" and ITU-R Recommendation BT.709)

  - vigra::RGB2XYZFunctor
  - vigra::RGBPrime2XYZFunctor
  - vigra::XYZ2RGBFunctor
  - vigra::XYZ2RGBPrimeFunctor

- L*a*b*
  perceptually uniform color representation (according to Publication CIE No 15.2 "Colorimetry" and ITU-R Recommendation BT.709)

  - vigra::RGB2LabFunctor
  - vigra::RGBPrime2LabFunctor
  - vigra::XYZ2LabFunctor
  - vigra::Lab2RGBFunctor
  - vigra::Lab2RGBPrimeFunctor
  - vigra::Lab2XYZFunctor
  - polar2Lab()
  - lab2Polar()

- L*u*v*
  perceptually uniform color representation (according to Publication CIE No 15.2 "Colorimetry" and ITU-R Recommendation BT.709)

  - vigra::RGB2LuvFunctor
  - vigra::RGBPrime2LuvFunctor
  - vigra::XYZ2LuvFunctor
  - vigra::Luv2RGBFunctor
  - vigra::Luv2RGBPrimeFunctor
  - vigra::Luv2XYZFunctor
  - polar2Luv()
  - luv2Polar()

- Y'PbPr and Y'CbCr
  color difference coding (according to ITU-R Recommendation BT. 601)

  - vigra::RGBPrime2YPrimePbPrFunctor
  - vigra::YPrimePbPr2RGBPrimeFunctor
  - polar2YPrimePbPr()
  - yPrimePbPr2Polar()
  - vigra::RGBPrime2YPrimeCbCrFunctor
  - vigra::YPrimeCbCr2RGBPrimeFunctor
  - polar2YPrimeCbCr()
  - yPrimeCbCr2Polar()

- Y'UV and Y'IQ
  analog video coding according to NTSC and PAL standards

  - vigra::RGBPrime2YPrimeUVFunctor
  - vigra::YPrimeUV2RGBPrimeFunctor
  - polar2YPrimeUV()
  - yPrimeUV2Polar()
  - vigra::RGBPrime2YPrimeIQFunctor
  - vigra::YPrimeIQ2RGBPrimeFunctor
  - polar2YPrimeIQ()
  - yPrimeIQ2Polar()

This module provides conversion from RGB/R'G'B' into more perceptually uniform color spaces. In image analysis, colors are usually converted into another color space in order to get good estimates of perceived color differences by just calculating Euclidean distances between the transformed colors. The L*a*b* and L*u*v* were designed with exactly this application in mind and thus give the best results. But these conversions are also the most computationally demanding. The Y'PbPr color difference space (designed for coding digital video) is computationally much cheaper, and almost as good. Y'CbCr represents essentially the same transformation, but the color values are scaled so that they can be stored with 8 bits per channel with minimal loss of information. The other transformations are of lesser interest here: XYZ is a device independent (but not perceptually uniform) color representation, and Y'IQ and Y'UV are the color spaces used by the PAL and NTSC analog video standards. Detailed information about these color spaces and their transformations can be found in Charles Poynton's Color FAQ

When you want to perform a color conversion, you must first know in which color space the data are given. Although this sounds trivial, it is quite often done wrong, because the distinction between RGB and sRGB (still images) or R'G'B' (digital video) is frequently overlooked: nowadays, most still images are stored in sRGB space, and treating them as RGB leads to wrong results (although the color primaries are named the same). RGB and R'G'B' are related by a so called gamma correction:

where C represents one of the color channels R, G, and B, and usually equals 255. The sRGB color space realizes a slight enhancement of this definition:

sRGB has now become a widely accepted international standard (IEC 61966-2.1) which is used by most consumer products (digital cameras, printers, and screens). In practice, you can distinguish between linear and gamma-corrected red, green, and blue by displaying the images: if they look too dark, they are probably RGB, if they are OK, they are likely sRGB. (However, there are still a few older graphics cards and display programs which silently apply an additional gamma correction to every image, so that RGB appears correct and sRGB is too bright.) Whether or not the data are represented in the sRGB color space can also be seen in the color space tag of an image's EXIF data, if available.

The distinction between RGB and R'G'B' is important because some conversions start at RGB (XYZ, L*a*b*, L*u*v*), while others start at R'G'B' (Y'PbPr, Y'CbCr, Y'IQ, and Y'UV). The names of VIGRA's color conversion functors always make clear to which color space they must be applied.

In addition VIGRA provides a polar coordinate interface to several color spaces (L*a*b*, L*u*v*, Y'PbPr, Y'CbCr, Y'IQ, and Y'UV). This interface makes use of the fact that these color spaces are conceptually similar: they represent colors by a "brightness" coordinate (L* or Y') and a pair of "chromaticity" coordinates that span a plane of colors with equal brightness. The polar representation transforms chroma coordinates into a color "angle" (similar to hue in the HSV system) and a "saturation". The polar coordinates are normalized so that a color angle of 0 degrees is always associated with red (green is at about 120 degrees, blue at about 240 degrees - exact values differ between color spaces). A saturation of 1 is the highest saturation that any RGB color in the unit cube can have after transformation into the respective color space, and saturation 0 corresponds to gray. Polar coordinates provide a more intuitive interface to color specification by users and make different color spaces somewhat comparable.

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany | html generated using doxygen and Python vigra 1.10.0