I’m trying to apply a LUT on a cv::Mat image.
I read the documentation for cv::LUT here OpenCV: Operations on arrays but I don’t understand what “look-up table of 256 elements;” means: Is it that the LUT can have maximum 256 segmentations?

What format should the InputArray have?(values of 0-1, 0-255?)

single channel, uchar [0…255].
think of each entry as an index into the table.
one application of it is ‘color mapping’, where you map grayscale[0…255] values to (false) colors, e.g. a heatmap

Thanks, so the cv::LUT function is channel independent. It cannot apply complicated luts that need trilinear interpolation.
I’m wonder if I can achieve this using cv::cuda::LookUpTable.

I need to apply a lut that I take from a .cube file to a cv::Mat.

From what I tested and from what I understand cv::LUT is cahnnel independent which means that it transforms the value in a channel independent of the other 2 channels.
For example the value 23 of the R channel will always map to x no matter of the values of G and B.

The steps for applying a more complex LUT are:
For each pixel:

Search the closest points in the LUT(the result will be 8 points that form a parallelepiped)

Do trilinear interpolation between the points found which will result in the new pixel value.

I’m searching for ways to implement this with functions that already exist.

I hope that it is more clear now and thank you for looking into this.

I could not find any such post, the best solution that I found was to use an OpenGL shader. I took into consideration using CUDA, but I needed something cross platform.
It was more complicated than I expected, if anyone knows a better solution, I would be curious to learn it.