1IM_INVERTLUT(3) Library Functions Manual IM_INVERTLUT(3)
2
3
4
6 im_invertlut - turn a set of greyscale measurements into a gamma-cor‐
7 recting LUT
8
10 #include <vips/vips.h>
11
12 int
13 im_invertlut( DOUBLEMASK *input, IMAGE *output, int lut_size )
14
15
17 Given a mask of target values and real values, generate a LUT which
18 will map reals to targets. Handy for linearising images from measure‐
19 ments of a colour chart. All values in [0,1]. Extrapolate head and
20 tail to 0 and 1.
21
22 Eg. input like:
23
24 4 3
25 0.1 0.2 0.3 0.1
26 0.2 0.4 0.4 0.2
27 0.7 0.5 0.6 0.3
28
29 means a patch with 10% reflectance produces an image with 20% in chan‐
30 nel 1, 30% in channel 2, and 10% in channel 3. A patch with 20%
31 reflectance makes an image with 40% red, 40% green and 20% blue, and so
32 on.
33
34 Inputs don't need to be sorted (we do that). Generate any precision LUT
35 ... typically ask for 256 elements.
36
37 It won't work too well for non-monotonic camera responses (should fix
38 this).
39
40 Interpolation is simple piecewise linear; ought to do something better
41 really.
42
43
45 -1 on error, otherwise 0
46
48 im_histgr(3), im_hsp(3), im_heq(3), im_identity(3).
49
51 2001, National Gallery
52
53
54
55 June 2001 IM_INVERTLUT(3)