1IM_COL_XYZ2RGB(3)          Library Functions Manual          IM_COL_XYZ2RGB(3)
2
3
4

NAME

6       im_col_Lab2LCh,    im_col_LCh2ab,    im_col_Lab2XYZ,    im_col_XYZ2Lab,
7       im_col_pythagoras,  im_col_display,   im_col_XYZ2rgb,   im_col_rgb2XYZ,
8       im_col_L2Lucs,     im_col_Lucs2L,     im_col_C2Cucs,     im_col_Cucs2C,
9       im_col_Ch2hucs, im_col_Chucs2h, im_col_make_tables_UCS, im_col_dECMC  -
10       colour space conversion
11

SYNOPSIS

13       #include <vips/vips.h>
14       #include <vips/colour.h>
15
16
17       int im_col_ab2Ch( a, b, C, h )
18       float a, b, *C, *h;
19
20
21       int im_col_Ch2ab( C, h, a, b )
22       float C, h, *a, *b;
23
24       int im_col_Lab2XYZ( L, a, b, X, Y, Z )
25       float L, a, b, *X, *Y, *Z;
26
27       int im_col_XYZ2Lab( X, Y, Z, L, a, b )
28       float X, Y, Z, *L, *a, *b;
29
30       float im_col_pythagoras( L1, a1, b1, L2, a2, b2 )
31       float L1, a1, b1, L2, a2, b2;
32
33       extern struct im_col_display *im_col_displays[];
34
35       struct im_col_tab_disp *im_col_make_tables_RGB( im, display )
36       IMAGE *im;
37       struct im_col_display *display;
38
39       int im_col_XYZ2rgb( display, table, X, Y, Z, r, g, b, oflow )
40       struct im_col_display *display;
41       struct im_col_tab_disp *table;
42       float X, Y, Z;
43       int *r, *g, *b;
44       int *oflow;
45
46
47       int im_col_rgb2XYZ( display, table, r, g, b, X, Y, Z )
48       struct im_col_display *display;
49       struct im_col_tab_disp *table;
50       int r, g, b;
51       float *X, *Y, *Z;
52
53       float im_col_L2Lucs( L )
54       float L;
55
56       float im_col_Lucs2L( Lucs )
57       float Lucs;
58
59       float im_col_C2Cucs( C )
60       float C;
61
62       float im_col_Cucs2C( Cucs )
63       float Cucs;
64
65       float im_col_Ch2hucs( C, h )
66       float h, C;
67
68       float im_col_Chucs2h( C, hucs )
69       float hucs, C;
70
71       void im_col_make_tables_UCS( void )
72
73       float im_col_dECMC( L1, a1, b1, L2, a2, b2 )
74       float L1, a1, b1, L2, a2, b2;
75
76

DESCRIPTION

78       Colour space conversion.  These functions convert colour values between
79       four different formats: XYZ (float), Lab (float), UCS (float), and  RGB
80       (unsigned  char)  displayable.  Additionally, functions are provided to
81       move from (a,b)-style rectangular  colour  coordinates  to  (C,h)-style
82       coordinates. h is always in degrees.
83
84       UCS  is a colour space derived from the CMC(1:1) equations. There is no
85       easy analytical conversion from UCS to Lab, so look-up tables are used.
86       These  have  to  be built with a call to im_col_make_tables_UCS(). Once
87       built, these tables are shared by  all  UCS  functions.  You  may  call
88       im_col_make_tables_UCS()  many  times  -  tables  are only built on the
89       first call.
90
91       im_col_pythagoras() returns the pythagoran distance between two  points
92       in  a  colour  space.  It  can  be  used  for finding CIELAB delta E's.
93       im_col_dECMC() returns the colour difference between two LAB points  in
94       CMC(1:1).
95
96       An   im_col_display   structure   characterises   a   CRT  screen  (see
97       <vips/colour.h>).  You can make up your own (if you can find a TV anal‐
98       yser),  or use one of the structures provied by VIPS in the NULL-termi‐
99       nated array im_col_displays[]. See the source for disp2XYZ(1) for ideas
100       on extracting a display struct from this list.
101
102       im_make_tables_RGB(3)  has  a  display  type as argument, and returns a
103       pointer to the  structure  im_col_tab_RGB.  This  latter  contains  the
104       matrices  to go from XYZ to luminances (and back), and the tables to go
105       from the luminances (in r, g, b) to the effective signal values  to  be
106       applied  to  the monitor input (and back). The function returns NULL on
107       error. The IMAGE argument is passed on to im_malloc() to make the space
108       required for the tables. Pass either NULL (if you need to free the mem‐
109       ory yourself) or an IMAGE descriptor (if you  want  the  memory  to  be
110       freed automatically when that descriptor is closed).
111
112       im_col_XYZ2rgb() takes a display, a look-up table and an XYZ coordinate
113       are returns three values in the range 0-255. The extra value  oflow  is
114       set  to 0 if the specified XYZ position aflls within the display gamut,
115       and to 1 if the point lies outside the gamut. im_col_rgb2XYZ()  is  the
116       reverse transformation.
117

RETURN VALUE

119       The functions (usually) return 0 on success and -1 on error.
120

SEE ALSO

122       im_XYZ2disp(3), im_dE_fromdisp(3).
123
125       National Gallery, 1990-1993.
126

AUTHOR

128       D. Saunders - 1988
129       J.Ph. Laurent - 2/12/1992
130       J.Cupitt - 21/7/93
131
132
133
134                                2 December 1992              IM_COL_XYZ2RGB(3)
Impressum