colorspace/colorspace.c File Reference

#include <math.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "colorspace.h"
Include dependency graph for colorspace.c:

Go to the source code of this file.

Defines

#define MIN(A, B)   (((A) <= (B)) ? (A) : (B))
 Min of A and B.
#define MAX(A, B)   (((A) >= (B)) ? (A) : (B))
 Max of A and B.
#define MIN3(A, B, C)   (((A) <= (B)) ? MIN(A,C) : MIN(B,C))
 Min of A, B, and C.
#define MAX3(A, B, C)   (((A) >= (B)) ? MAX(A,C) : MAX(B,C))
 Max of A, B, and C.
#define M_PI   3.14159265358979323846264338327950288
 The constant pi.
#define GAMMACORRECTION(t)
 sRGB gamma correction, transforms R to R' http://en.wikipedia.org/wiki/SRGB
#define INVGAMMACORRECTION(t)
 Inverse sRGB gamma correction, transforms R' to R.
#define LABF(t)
 CIE L*a*b* f function (used to convert XYZ to L*a*b*) http://en.wikipedia.org/wiki/Lab_color_space.
#define LABINVF(t)
 CIE L*a*b* inverse f function http://en.wikipedia.org/wiki/Lab_color_space.
#define WHITEPOINT_U
 u'v' coordinates of the white point for CIE Lu*v*
#define WHITEPOINT_V
#define UNKNOWN_SPACE   0
 Enumeration of the supported color spaces.
#define RGB_SPACE   1
#define YUV_SPACE   2
#define YCBCR_SPACE   3
#define JPEGYCBCR_SPACE   4
#define YPBPR_SPACE   5
#define YDBDR_SPACE   6
#define YIQ_SPACE   7
#define HSV_SPACE   8
#define HSL_SPACE   9
#define HSI_SPACE   10
#define XYZ_SPACE   11
#define LAB_SPACE   12
#define LUV_SPACE   13
#define LCH_SPACE   14
#define CAT02LMS_SPACE   15
#define NUM_TRANSFORM_PAIRS   18

Functions

void Rgb2Yuv (num *Y, num *U, num *V, num R, num G, num B)
 Convert sRGB to NTSC/PAL Y'UV Luma + Chroma.
void Yuv2Rgb (num *R, num *G, num *B, num Y, num U, num V)
 Convert NTSC/PAL Y'UV to sRGB.
void Rgb2Ycbcr (num *Y, num *Cb, num *Cr, num R, num G, num B)
 sRGB to Y'CbCr Luma + Chroma
void Ycbcr2Rgb (num *R, num *G, num *B, num Y, num Cr, num Cb)
 Y'CbCr to sRGB.
void Rgb2Jpegycbcr (num *Y, num *Cb, num *Cr, num R, num G, num B)
 sRGB to JPEG-Y'CbCr Luma + Chroma
void Jpegycbcr2Rgb (num *R, num *G, num *B, num Y, num Cb, num Cr)
 JPEG-Y'CbCr to sRGB.
void Rgb2Ypbpr (num *Y, num *Pb, num *Pr, num R, num G, num B)
 sRGB to Y'PbPr Luma (ITU-R BT.601) + Chroma
void Ypbpr2Rgb (num *R, num *G, num *B, num Y, num Pb, num Pr)
 Y'PbPr to sRGB.
void Rgb2Ydbdr (num *Y, num *Db, num *Dr, num R, num G, num B)
 sRGB to SECAM Y'DbDr Luma + Chroma
void Ydbdr2Rgb (num *R, num *G, num *B, num Y, num Db, num Dr)
 SECAM Y'DbDr to sRGB.
void Rgb2Yiq (num *Y, num *I, num *Q, num R, num G, num B)
 sRGB to NTSC YIQ
void Yiq2Rgb (num *R, num *G, num *B, num Y, num I, num Q)
 Convert NTSC YIQ to sRGB.
void Rgb2Hsv (num *H, num *S, num *V, num R, num G, num B)
 Convert an sRGB color to Hue-Saturation-Value (HSV).
void Hsv2Rgb (num *R, num *G, num *B, num H, num S, num V)
 Convert a Hue-Saturation-Value (HSV) color to sRGB.
void Rgb2Hsl (num *H, num *S, num *L, num R, num G, num B)
 Convert an sRGB color to Hue-Saturation-Lightness (HSL).
void Hsl2Rgb (num *R, num *G, num *B, num H, num S, num L)
 Convert a Hue-Saturation-Lightness (HSL) color to sRGB.
void Rgb2Hsi (num *H, num *S, num *I, num R, num G, num B)
 Convert an sRGB color to Hue-Saturation-Intensity (HSI).
void Hsi2Rgb (num *R, num *G, num *B, num H, num S, num I)
 Convert a Hue-Saturation-Intesity (HSI) color to sRGB.
void Rgb2Xyz (num *X, num *Y, num *Z, num R, num G, num B)
 Transform sRGB to CIE XYZ with the D65 white point.
void Xyz2Rgb (num *R, num *G, num *B, num X, num Y, num Z)
 Transform CIE XYZ to sRGB with the D65 white point.
void Xyz2Lab (num *L, num *a, num *b, num X, num Y, num Z)
void Lab2Xyz (num *X, num *Y, num *Z, num L, num a, num b)
void Xyz2Luv (num *L, num *u, num *v, num X, num Y, num Z)
void Luv2Xyz (num *X, num *Y, num *Z, num L, num u, num v)
void Xyz2Lch (num *L, num *C, num *H, num X, num Y, num Z)
void Lch2Xyz (num *X, num *Y, num *Z, num L, num C, num H)
void Xyz2Cat02lms (num *L, num *M, num *S, num X, num Y, num Z)
 XYZ to CAT02 LMS.
void Cat02lms2Xyz (num *X, num *Y, num *Z, num L, num M, num S)
 CAT02 LMS to XYZ.
void Rgb2Lab (num *L, num *a, num *b, num R, num G, num B)
void Lab2Rgb (num *R, num *G, num *B, num L, num a, num b)
void Rgb2Luv (num *L, num *u, num *v, num R, num G, num B)
void Luv2Rgb (num *R, num *G, num *B, num L, num u, num v)
void Rgb2Lch (num *L, num *C, num *H, num R, num G, num B)
void Lch2Rgb (num *R, num *G, num *B, num L, num C, num H)
void Rgb2Cat02lms (num *L, num *M, num *S, num R, num G, num B)
void Cat02lms2Rgb (num *R, num *G, num *B, num L, num M, num S)
static int IdFromName (const char *Name)
 Convert a color space name to an integer ID.
int GetColorTransform (colortransform *Trans, const char *TransformString)
 Given a transform string, returns a colortransform struct.
void ApplyColorTransform (colortransform Trans, num *D0, num *D1, num *D2, num S0, num S1, num S2)
 Apply a colortransform.

Variables

struct {
   int   Space [2]
   void(*   Fun [2])(num *, num *, num *, num, num, num)
TransformPair [NUM_TRANSFORM_PAIRS]
 Table representing all transformations in this file.

Detailed Description

Author:
Pascal Getreuer 2005-2010 <getreuer@gmail.com>

== Summary == This file implements routines for color transformations between the spaces sRGB, Y'UV, Y'CbCr, Y'PbPr, Y'DbDr, Y'IQ, HSV, HSL, HSI, CIEXYZ, CIELAB, CIELUV, CIELCH, and CIECAT02 LMS.

== Usage == First call GetColorTransform, specifying the source and destination color spaces as "dest<-src" or "src->dest". Then call ApplyColorTransform to perform the transform:

       num S[3] = {173, 0.8, 0.5};
       num D[3];
       colortransform Trans;
       
       if(!(GetColorTransform(&Trans, "HSI -> Lab")))
       {
           printf("Invalid syntax or unknown color space\n");
           return;
       }   
       
       ApplyColorTransform(Trans, &D[0], &D[1], &D[2], S[0], S[1], S[2]);

"num" is a typedef defined at the beginning of colorspace.h that may be set to either double or float, depending on the application.

Specific transformation routines can also be called directly. The following converts an sRGB color to CIELAB and then back to sRGB:

     num R = 0.85, G = 0.32, B = 0.5;
     num L, a, b;
     Rgb2Lab(&L, &a, &b, R, G, B);
     Lab2Rgb(&R, &G, &B, L, a, b);

Generally, the calling syntax is

     Foo2Bar(&B0, &B1, &B2, F0, F1, F2);

where (F0,F1,F2) are the coordinates of a color in space "Foo" and (B0,B1,B2) are the transformed coordinates in space "Bar." For any transformation routine, its inverse has the sytax

     Bar2Foo(&F0, &F1, &F2, B0, B1, B2);

The conversion routines are consistently named with the first letter of a color space capitalized with following letters in lower case and omitting prime symbols. For example, "Rgb2Ydbdr" converts sRGB to Y'DbDr. For any transformation routine Foo2Bar, its inverse is Bar2Foo.

All transformations assume a two degree observer angle and a D65 illuminant. The white point can be changed by modifying the WHITEPOINT_X, WHITEPOINT_Y, WHITEPOINT_Z definitions at the beginning of colorspace.h.

== List of transformation routines ==

It is possible to transform between two arbitrary color spaces by first transforming from the source space to sRGB and then transforming from sRGB to the desired destination space. For transformations between CIE color spaces, it is convenient to use XYZ as the intermediate space. This is the strategy used by GetColorTransform and ApplyColorTransform.

== References == The definitions of these spaces and the many of the transformation formulas can be found in

Poynton, "Frequently Asked Questions About Gamma" http://www.poynton.com/notes/colour_and_gamma/GammaFAQ.html

Poynton, "Frequently Asked Questions About Color" http://www.poynton.com/notes/colour_and_gamma/ColorFAQ.html

and Wikipedia articles http://en.wikipedia.org/wiki/SRGB http://en.wikipedia.org/wiki/YUV http://en.wikipedia.org/wiki/YCbCr http://en.wikipedia.org/wiki/YPbPr http://en.wikipedia.org/wiki/YDbDr http://en.wikipedia.org/wiki/YIQ http://en.wikipedia.org/wiki/HSL_and_HSV http://en.wikipedia.org/wiki/CIE_1931_color_space http://en.wikipedia.org/wiki/Lab_color_space http://en.wikipedia.org/wiki/CIELUV_color_space http://en.wikipedia.org/wiki/LMS_color_space

== License (BSD) == Copyright (c) 2005-2010, Pascal Getreuer All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file colorspace.c.


Define Documentation

#define CAT02LMS_SPACE   15

Definition at line 213 of file colorspace.c.

#define GAMMACORRECTION (  ) 
Value:
(((t) <= 0.0031306684425005883) ? \
        (12.92*(t)) : (1.055*pow((t), 0.416666666666666667) - 0.055))

sRGB gamma correction, transforms R to R' http://en.wikipedia.org/wiki/SRGB

Definition at line 164 of file colorspace.c.

#define HSI_SPACE   10

Definition at line 208 of file colorspace.c.

#define HSL_SPACE   9

Definition at line 207 of file colorspace.c.

#define HSV_SPACE   8

Definition at line 206 of file colorspace.c.

#define INVGAMMACORRECTION (  ) 
Value:
(((t) <= 0.0404482362771076) ? \
        ((t)/12.92) : pow(((t) + 0.055)/1.055, 2.4))

Inverse sRGB gamma correction, transforms R' to R.

Definition at line 171 of file colorspace.c.

#define JPEGYCBCR_SPACE   4

Definition at line 202 of file colorspace.c.

#define LAB_SPACE   12

Definition at line 210 of file colorspace.c.

#define LABF (  ) 
Value:
((t >= 8.85645167903563082e-3) ? \
        pow(t,0.333333333333333) : (841.0/108.0)*(t) + (4.0/29.0))

CIE L*a*b* f function (used to convert XYZ to L*a*b*) http://en.wikipedia.org/wiki/Lab_color_space.

Definition at line 179 of file colorspace.c.

#define LABINVF (  ) 
Value:
((t >= 0.206896551724137931) ? \
        ((t)*(t)*(t)) : (108.0/841.0)*((t) - (4.0/29.0)))

CIE L*a*b* inverse f function http://en.wikipedia.org/wiki/Lab_color_space.

Definition at line 187 of file colorspace.c.

#define LCH_SPACE   14

Definition at line 212 of file colorspace.c.

#define LUV_SPACE   13

Definition at line 211 of file colorspace.c.

#define M_PI   3.14159265358979323846264338327950288

The constant pi.

Definition at line 157 of file colorspace.c.

#define MAX ( A,
 )     (((A) >= (B)) ? (A) : (B))

Max of A and B.

Definition at line 147 of file colorspace.c.

#define MAX3 ( A,
B,
 )     (((A) >= (B)) ? MAX(A,C) : MAX(B,C))

Max of A, B, and C.

Definition at line 153 of file colorspace.c.

#define MIN ( A,
 )     (((A) <= (B)) ? (A) : (B))

Min of A and B.

Definition at line 144 of file colorspace.c.

#define MIN3 ( A,
B,
 )     (((A) <= (B)) ? MIN(A,C) : MIN(B,C))

Min of A, B, and C.

Definition at line 150 of file colorspace.c.

#define NUM_TRANSFORM_PAIRS   18

Definition at line 215 of file colorspace.c.

#define RGB_SPACE   1

Definition at line 199 of file colorspace.c.

#define UNKNOWN_SPACE   0

Enumeration of the supported color spaces.

Definition at line 198 of file colorspace.c.

#define WHITEPOINT_U
Value:

u'v' coordinates of the white point for CIE Lu*v*

Definition at line 192 of file colorspace.c.

#define WHITEPOINT_V
Value:

Definition at line 194 of file colorspace.c.

#define XYZ_SPACE   11

Definition at line 209 of file colorspace.c.

#define YCBCR_SPACE   3

Definition at line 201 of file colorspace.c.

#define YDBDR_SPACE   6

Definition at line 204 of file colorspace.c.

#define YIQ_SPACE   7

Definition at line 205 of file colorspace.c.

#define YPBPR_SPACE   5

Definition at line 203 of file colorspace.c.

#define YUV_SPACE   2

Definition at line 200 of file colorspace.c.


Function Documentation

void ApplyColorTransform ( colortransform  Trans,
num D0,
num D1,
num D2,
num  S0,
num  S1,
num  S2 
)

Apply a colortransform.

Parameters:
Trans colortransform struct created by GetColorTransform
D0,D1,D2 pointers to hold the result
S0,S1,S2 the input values

Definition at line 1191 of file colorspace.c.

void Cat02lms2Rgb ( num R,
num G,
num B,
num  L,
num  M,
num  S 
)

Definition at line 964 of file colorspace.c.

Here is the call graph for this function:

void Cat02lms2Xyz ( num X,
num Y,
num Z,
num  L,
num  M,
num  S 
)

CAT02 LMS to XYZ.

Definition at line 897 of file colorspace.c.

Here is the caller graph for this function:

int GetColorTransform ( colortransform Trans,
const char *  TransformString 
)

Given a transform string, returns a colortransform struct.

Parameters:
Trans a colortransform pointer to hold the transform
TransformString string specifying the transformations
Returns:
1 on success, 0 on failure

This function provides a convenient interface to the collection of transform functions in this file. TransformString specifies the source and destination color spaces, TransformString = "dest<-src" or alternatively, TransformString = "src->dest".

Supported color spaces are "RGB" sRGB Red Green Blue (ITU-R BT.709 gamma-corrected), "YPbPr" Luma (ITU-R BT.601) + Chroma, "YCbCr" Luma + Chroma ("digitized" version of Y'PbPr), "JPEG-YCbCr" Luma + Chroma space used in JFIF JPEG, "YUV" NTSC PAL Y'UV Luma + Chroma, "YIQ" NTSC Y'IQ Luma + Chroma, "YDbDr" SECAM Y'DbDr Luma + Chroma, "HSV" or "HSB" Hue Saturation Value/Brightness, "HSL" or "HLS" Hue Saturation Luminance, "HSI" Hue Saturation Intensity, "XYZ" CIE XYZ, "Lab" CIE L*a*b* (CIELAB), "Luv" CIE L*u*v* (CIELUV), "LCH" CIE L*C*H* (CIELCH), "CAT02 LMS" CIE CAT02 LMS. Color space names are case-insensitive and spaces are ignored. When sRGB is the source or destination, it can be omitted. For example "yuv<-" is short for "yuv<-rgb".

The routine returns a colortransform structure representing the transform. The transform is performed by calling GetColorTransform. For example,

       num S[3] = {173, 0.8, 0.5};
       num D[3];
       colortransform Trans;
       
       if(!(GetColorTransform(&Trans, "HSI -> Lab")))
       {
           printf("Invalid syntax or unknown color space\n");
           return;
       }   
       
       ApplyColorTransform(Trans, &D[0], &D[1], &D[2], S[0], S[1], S[2]);

Definition at line 1067 of file colorspace.c.

Here is the call graph for this function:

void Hsi2Rgb ( num R,
num G,
num B,
num  H,
num  S,
num  I 
)

Convert a Hue-Saturation-Intesity (HSI) color to sRGB.

Parameters:
R,G,B pointers to hold the result
H,S,I the input HSI values

The input values are assumed to be scaled as 0 <= H < 360, 0 <= S <= 1, 0 <= I <= 1. The output sRGB values are scaled between 0 and 1. This is the inverse transformation of Rgb2Hsi.

Wikipedia: http://en.wikipedia.org/wiki/HSL_and_HSV

Definition at line 658 of file colorspace.c.

void Hsl2Rgb ( num R,
num G,
num B,
num  H,
num  S,
num  L 
)

Convert a Hue-Saturation-Lightness (HSL) color to sRGB.

Parameters:
R,G,B pointers to hold the result
H,S,L the input HSL values

The input values are assumed to be scaled as 0 <= H < 360, 0 <= S <= 1, 0 <= L <= 1. The output sRGB values are scaled between 0 and 1. This is the inverse transformation of Rgb2Hsl.

Wikipedia: http://en.wikipedia.org/wiki/HSL_and_HSV

Definition at line 558 of file colorspace.c.

Here is the caller graph for this function:

void Hsv2Rgb ( num R,
num G,
num B,
num  H,
num  S,
num  V 
)

Convert a Hue-Saturation-Value (HSV) color to sRGB.

Parameters:
R,G,B pointers to hold the result
H,S,V the input HSV values

The input values are assumed to be scaled as 0 <= H < 360, 0 <= S <= 1, 0 <= V <= 1. The output sRGB values are scaled between 0 and 1. This is the inverse transformation of Rgb2Hsv.

Wikipedia: http://en.wikipedia.org/wiki/HSL_and_HSV

Definition at line 446 of file colorspace.c.

static int IdFromName ( const char *  Name  )  [static]

Convert a color space name to an integer ID.

Definition at line 980 of file colorspace.c.

Here is the caller graph for this function:

void Jpegycbcr2Rgb ( num R,
num G,
num B,
num  Y,
num  Cb,
num  Cr 
)

JPEG-Y'CbCr to sRGB.

Definition at line 313 of file colorspace.c.

Here is the call graph for this function:

void Lab2Rgb ( num R,
num G,
num B,
num  L,
num  a,
num  b 
)

Definition at line 917 of file colorspace.c.

Here is the call graph for this function:

void Lab2Xyz ( num X,
num Y,
num Z,
num  L,
num  a,
num  b 
)

Convert CIE L*a*b* (CIELAB) to CIE XYZ with the D65 white point

Parameters:
X,Y,Z pointers to hold the result
L,a,b the input L*a*b* values

Wikipedia: http://en.wikipedia.org/wiki/Lab_color_space

Definition at line 782 of file colorspace.c.

Here is the caller graph for this function:

void Lch2Rgb ( num R,
num G,
num B,
num  L,
num  C,
num  H 
)

Definition at line 948 of file colorspace.c.

Here is the call graph for this function:

void Lch2Xyz ( num X,
num Y,
num Z,
num  L,
num  C,
num  H 
)

Convert CIE L*C*H* to CIE XYZ with the D65 white point

Parameters:
X,Y,Z pointers to hold the result
L,C,H the input L*C*H* values

Definition at line 877 of file colorspace.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void Luv2Rgb ( num R,
num G,
num B,
num  L,
num  u,
num  v 
)

Definition at line 933 of file colorspace.c.

Here is the call graph for this function:

void Luv2Xyz ( num X,
num Y,
num Z,
num  L,
num  u,
num  v 
)

Convert CIE L*u*v* (CIELUV) to CIE XYZ with the D65 white point

Parameters:
X,Y,Z pointers to hold the result
L,u,v the input L*u*v* values

Wikipedia: http://en.wikipedia.org/wiki/CIELUV_color_space

Definition at line 830 of file colorspace.c.

Here is the caller graph for this function:

void Rgb2Cat02lms ( num L,
num M,
num S,
num  R,
num  G,
num  B 
)

Definition at line 956 of file colorspace.c.

Here is the call graph for this function:

void Rgb2Hsi ( num H,
num S,
num I,
num  R,
num  G,
num  B 
)

Convert an sRGB color to Hue-Saturation-Intensity (HSI).

Parameters:
H,S,I pointers to hold the result
R,G,B the input sRGB values scaled in [0,1]

This routine transforms from sRGB to the cylindrical HSI color space. The sRGB values are assumed to be between 0 and 1. The output values are H = polar hue angle (0 <= H < 360), S = 1 - min(R',G',B')/I (0 <= S <= 1), I = (R'+G'+B')/3 (0 <= I <= 1). The inverse color transformation is given by Hsi2Rgb.

Wikipedia: http://en.wikipedia.org/wiki/HSL_and_HSV

Definition at line 622 of file colorspace.c.

void Rgb2Hsl ( num H,
num S,
num L,
num  R,
num  G,
num  B 
)

Convert an sRGB color to Hue-Saturation-Lightness (HSL).

Parameters:
H,S,L pointers to hold the result
R,G,B the input sRGB values scaled in [0,1]

This routine transforms from sRGB to the double hexcone HSL color space The sRGB values are assumed to be between 0 and 1. The outputs are H = hexagonal hue angle (0 <= H < 360), S = { C/(2L) if L <= 1/2 (0 <= S <= 1), { C/(2 - 2L) if L > 1/2 L = (max(R',G',B') + min(R',G',B'))/2 (0 <= L <= 1), where C = max(R',G',B') - min(R',G',B'). The inverse color transformation is given by Hsl2Rgb.

Wikipedia: http://en.wikipedia.org/wiki/HSL_and_HSV

Definition at line 512 of file colorspace.c.

Here is the caller graph for this function:

void Rgb2Hsv ( num H,
num S,
num V,
num  R,
num  G,
num  B 
)

Convert an sRGB color to Hue-Saturation-Value (HSV).

Parameters:
H,S,V pointers to hold the result
R,G,B the input sRGB values scaled in [0,1]

This routine transforms from sRGB to the hexcone HSV color space. The sRGB values are assumed to be between 0 and 1. The output values are H = hexagonal hue angle (0 <= H < 360), S = C/V (0 <= S <= 1), V = max(R',G',B') (0 <= V <= 1), where C = max(R',G',B') - min(R',G',B'). The inverse color transformation is given by Hsv2Rgb.

Wikipedia: http://en.wikipedia.org/wiki/HSL_and_HSV

Definition at line 400 of file colorspace.c.

void Rgb2Jpegycbcr ( num Y,
num Cb,
num Cr,
num  R,
num  G,
num  B 
)

sRGB to JPEG-Y'CbCr Luma + Chroma

Definition at line 305 of file colorspace.c.

Here is the call graph for this function:

void Rgb2Lab ( num L,
num a,
num b,
num  R,
num  G,
num  B 
)

Definition at line 909 of file colorspace.c.

Here is the call graph for this function:

void Rgb2Lch ( num L,
num C,
num H,
num  R,
num  G,
num  B 
)

Definition at line 940 of file colorspace.c.

Here is the call graph for this function:

void Rgb2Luv ( num L,
num u,
num v,
num  R,
num  G,
num  B 
)

Definition at line 925 of file colorspace.c.

Here is the call graph for this function:

void Rgb2Xyz ( num X,
num Y,
num Z,
num  R,
num  G,
num  B 
)

Transform sRGB to CIE XYZ with the D65 white point.

Parameters:
X,Y,Z pointers to hold the result
R,G,B the input sRGB values

Poynton, "Frequently Asked Questions About Color," page 10 Wikipedia: http://en.wikipedia.org/wiki/SRGB Wikipedia: http://en.wikipedia.org/wiki/CIE_1931_color_space

Definition at line 704 of file colorspace.c.

Here is the caller graph for this function:

void Rgb2Ycbcr ( num Y,
num Cb,
num Cr,
num  R,
num  G,
num  B 
)

sRGB to Y'CbCr Luma + Chroma

Definition at line 284 of file colorspace.c.

void Rgb2Ydbdr ( num Y,
num Db,
num Dr,
num  R,
num  G,
num  B 
)

sRGB to SECAM Y'DbDr Luma + Chroma

Definition at line 340 of file colorspace.c.

void Rgb2Yiq ( num Y,
num I,
num Q,
num  R,
num  G,
num  B 
)

sRGB to NTSC YIQ

Definition at line 358 of file colorspace.c.

void Rgb2Ypbpr ( num Y,
num Pb,
num Pr,
num  R,
num  G,
num  B 
)

sRGB to Y'PbPr Luma (ITU-R BT.601) + Chroma

Definition at line 322 of file colorspace.c.

Here is the caller graph for this function:

void Rgb2Yuv ( num Y,
num U,
num V,
num  R,
num  G,
num  B 
)

Convert sRGB to NTSC/PAL Y'UV Luma + Chroma.

Parameters:
Y,U,V pointers to hold the result
R,G,B the input sRGB values

Wikipedia: http://en.wikipedia.org/wiki/YUV

Definition at line 261 of file colorspace.c.

void Xyz2Cat02lms ( num L,
num M,
num S,
num  X,
num  Y,
num  Z 
)

XYZ to CAT02 LMS.

Definition at line 888 of file colorspace.c.

Here is the caller graph for this function:

void Xyz2Lab ( num L,
num a,
num b,
num  X,
num  Y,
num  Z 
)

Convert CIE XYZ to CIE L*a*b* (CIELAB) with the D65 white point

Parameters:
L,a,b pointers to hold the result
X,Y,Z the input XYZ values

Wikipedia: http://en.wikipedia.org/wiki/Lab_color_space

Definition at line 760 of file colorspace.c.

Here is the caller graph for this function:

void Xyz2Lch ( num L,
num C,
num H,
num  X,
num  Y,
num  Z 
)

Convert CIE XYZ to CIE L*C*H* with the D65 white point

Parameters:
L,C,H pointers to hold the result
X,Y,Z the input XYZ values

CIE L*C*H* is related to CIE L*a*b* by a* = C* cos(H* pi/180), b* = C* sin(H* pi/180).

Definition at line 858 of file colorspace.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void Xyz2Luv ( num L,
num u,
num v,
num  X,
num  Y,
num  Z 
)

Convert CIE XYZ to CIE L*u*v* (CIELUV) with the D65 white point

Parameters:
L,u,v pointers to hold the result
X,Y,Z the input XYZ values

Wikipedia: http://en.wikipedia.org/wiki/CIELUV_color_space

Definition at line 801 of file colorspace.c.

Here is the caller graph for this function:

void Xyz2Rgb ( num R,
num G,
num B,
num  X,
num  Y,
num  Z 
)

Transform CIE XYZ to sRGB with the D65 white point.

Parameters:
R,G,B pointers to hold the result
X,Y,Z the input XYZ values

Official sRGB specification (IEC 61966-2-1:1999) Poynton, "Frequently Asked Questions About Color," page 10 Wikipedia: http://en.wikipedia.org/wiki/SRGB Wikipedia: http://en.wikipedia.org/wiki/CIE_1931_color_space

Definition at line 726 of file colorspace.c.

Here is the caller graph for this function:

void Ycbcr2Rgb ( num R,
num G,
num B,
num  Y,
num  Cr,
num  Cb 
)

Y'CbCr to sRGB.

Definition at line 293 of file colorspace.c.

void Ydbdr2Rgb ( num R,
num G,
num B,
num  Y,
num  Db,
num  Dr 
)

SECAM Y'DbDr to sRGB.

Definition at line 349 of file colorspace.c.

void Yiq2Rgb ( num R,
num G,
num B,
num  Y,
num  I,
num  Q 
)

Convert NTSC YIQ to sRGB.

Definition at line 367 of file colorspace.c.

void Ypbpr2Rgb ( num R,
num G,
num B,
num  Y,
num  Pb,
num  Pr 
)

Y'PbPr to sRGB.

Definition at line 331 of file colorspace.c.

Here is the caller graph for this function:

void Yuv2Rgb ( num R,
num G,
num B,
num  Y,
num  U,
num  V 
)

Convert NTSC/PAL Y'UV to sRGB.

Parameters:
R,G,B pointers to hold the result
Y,U,V the input YUV values

Definition at line 275 of file colorspace.c.


Variable Documentation

void(* Fun[2])(num *, num *, num *, num, num, num)

Definition at line 222 of file colorspace.c.

int Space[2]

Definition at line 221 of file colorspace.c.

struct { ... } TransformPair[NUM_TRANSFORM_PAIRS] [static]

Table representing all transformations in this file.

 All Classes Files Functions Variables Typedefs Defines
Generated on Wed Oct 5 14:39:18 2011 for local color correction by  doxygen 1.6.3