Transform an image with a gray-value look-up-table
lut_trans transforms an image Image by using a gray value look-up-table Lut. This table acts as a transformation function. In the case of byte-images, Lut has to be a tuple of length 256. In the case of int2-images, Lut has to be a tuple of length 256 <= length <= 65536. If the length of the Lut is <= 32768, the transformation is applied to the positive gray values only, i.e., the first element of the Lut specifies the new gray value for the gray value 0. If the Lut is longer than 32768, exactly 65536 must be passed. In this case, the positive and negative gray values are transformed. In this case, the first element indicates the new gray value for the gray value -32768 of the input image, while the last element of the tuple indicates the new gray value for the gray value 32767. In all cases, the gray values of values outside the range of Lut are set to 0. In the case of uint2-images, Lut has to be a tuple of length 256 <= length <= 65536. Gray values outside the range of Lut are set to 0.
|
Image (input_object) |
(multichannel-)image(-array) -> object : byte / int2 / uint2 |
| Image whose gray values are to be transformed. | |
|
ImageResult (output_object) |
(multichannel-)image(-array) -> object : byte / int2 / uint2 |
| Transformed image. | |
|
Lut (input_control) |
integer-array -> integer |
| Table containing the transformation. | |
/* To get the inverse of an image: */
read_image(Image,'wald1')
def_tab(Tab,0)
lut_trans(Image,Invers,Tab,1,1)
def_tab(Tab,I) :- I=255
Tab = 0
def_tab([Tk|Ts],I) :-
Tk is 255 - I
Iw is I -1
def_tab(Ts,Iw)
The operator lut_trans returns the value 2 (H_MSG_TRUE) if the parameters are correct. Otherwise an exception is raised.
lut_trans is reentrant and automatically parallelized (on tuple level, channel level, domain level).
Image filters