im_maplut(3) map an image through a lookup table

SYNOPSIS

#include <vips/vips.h>

int im_maplut(in, out, lut)
IMAGE *in, *out, *lut;

DESCRIPTION

im_maplut() maps an image through another image, acting as a LUT (Look Up Table). The lut may have any type, and the output image will be of that type.

The input image must be an unsigned integer types, that is, it must be one of FMTUCHAR, FMTUSHORT or FMTUINT.

If the input is FMTUCHAR, then the LUT must have 256 elements, in other words, lut->Xsize * lut->Ysize == 256.

If the input is FMTUSHORT or FMTUINT, then the lut may have any number of elements, and input pels whose value is greater than lut->Xsize * lut->Ysize are mapped with the last LUT element. The function counts and prints the number of image elements which overflow in this way.

As regards bands, there are three cases:


   - If LUT has one band, then the input may have any number of bands, and
   each band will pass through the same LUT.


   - If LUT has the same number of bands as the input, then each band of the
   input will be LUTed separately.


   - If the input has one band, then the LUT may have any number of bands, and
   the output will have the same number of bands as the LUT.

RETURN VALUE

All functions returns 0 on success and -1 on error.

COPYRIGHT

1995, National Gallery and Birkbeck College

AUTHORS

J. Cupitt, 1995
N. Dessipris - 10/05/1991