imlut(img, lut, kind, order, colorScheme)

This function applies a 1D or 3D LUT to an image for color gradient calibration.
897 Downloads
Updated 2 Jul 2015

View License

This function applies 1D or 3D LUTs to image data for color gradient calibration.
A good description of LUTs can be found here:
http://www.lightillusion.com/luts.html

Syntax: [img_lut] = imlut(img,lut,kind,order)

Inputs:
img - the image on which the lut shall be applied, format double,
uint8 or uint16
lut - the color lookup table (either 1D or 3D)
kind - a string '1D' or '3D' specifying whether a 1D LUT or 3D LUT is used
order - order of LUT entries. We differentiate between 'standard' (default) and 'inverse' order. Examples:
Standard Order Inverse Order
R G B R G B
0 0 0 0 0 0
1 0 0 0 0 1
2 0 0 0 0 2
0 1 0 0 1 0
1 1 0 0 1 1
2 1 0 0 1 2
0 2 0 0 2 0
... ...
2 2 2 2 2 2

Outputs:
img_lut - image after colors are changed according to LUT,
format double, uint8 or uint16 depending on LUT values

Example:
img = imread('path_to_image');
lut = dlmread('path_to_lut.cube', ' ', 4, 0);
[img_lut] = imlut(img, lut, '3D', 'standard')
imshow(img_lut)

Cite As

Christopher (2024). imlut(img, lut, kind, order, colorScheme) (https://www.mathworks.com/matlabcentral/fileexchange/43004-imlut-img-lut-kind-order-colorscheme), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2015a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.2.0.0

Error reported by Timofey Goloborodko fixed. Thanks for the hint!

1.1.0.0

added a screenshot

1.0.0.0