Image.LUT#
- Image.LUT(lut: Any, colororder: str | dict[str, Any] | None = None) Image[source]#
Apply lookup table
- Parameters:
lut (array_like(256), ndarray(256,N)) – lookup table
colororder (str or dict) – colororder for output image, optional
- Returns:
transformed image
- Return type:
For a greyscale image the LUT can be:
(256,)
(256,N) in which case the resulting image has
Nplanes created by applying the I’th column of the LUT to the input image
For a color image the LUT can be:
(256,) and applied to every plane, or
(256,N) where the LUT columns are applied to the
Nplanes of the input image.
Example:
>>> from machinevisiontoolbox import Image >>> import numpy as np >>> img = Image([[100, 150], [200, 250]]) >>> img.LUT(np.arange(255, -1, -1, dtype='uint8')).A array([[155, 105], [ 55, 5]], dtype=uint8)
Note
Works only for
uint8andint8image and LUT.- References:
Important
Uses OpenCV function
cv2.LUTwhich accepts multiple-channel, CV_8U images.- Seealso: