int
im_invertlut( DOUBLEMASK *input, IMAGE *output, int lut_size )
Eg. input like:
4 3
0.1 0.2 0.3 0.1
0.2 0.4 0.4 0.2
0.7 0.5 0.6 0.3
means a patch with 10% reflectance produces an image with 20% in channel 1, 30% in channel 2, and 10% in channel 3. A patch with 20% reflectance makes an image with 40% red, 40% green and 20% blue, and so on.
Inputs don't need to be sorted (we do that). Generate any precision LUT ... typically ask for 256 elements.
It won't work too well for non-monotonic camera responses (should fix this).
Interpolation is simple piecewise linear; ought to do something better really.