Interpolating missing values in 3D LUT (3D Lookup Table)

4 次查看(过去 30 天)
Hi
I'm trying to create a 3D LUT to transform the colors of Image.
The LUT file contains 512 lines.
Each line contains 3 values, one for Red, one for Green and one for Blue channels of Image.
Basically, size of 3D LUT is 8 so its index starts at 0 0 0 and ends at 7 7 7. (8*8*8 combinations = 512 points/lines)
Out of 512 points, I have created 42 points.
Now, I want to create values for remaining 470 points using interpolation.
I'm aware of Linear interpolation, but I have no clue how a 3D LUT missing values are calculated.
I would be grateful if anyone help me in filling the missing values. Thank you.

采纳的回答

John D'Errico
John D'Errico 2017-6-17
编辑:John D'Errico 2017-6-17
I think I wrote over 400 pages of technical reports while at Kodak on this, just on how to build, use, populate, estimate, validate, visualize, all applied to 3D luts. :) Plus two US patents on the subject, that should now be expired, at least given the application dates.
There are many possible schemes to populate n-d LUTS, some more viable than others. My gridfit tool (on the file exchange) is essentially one of them, although it is limited to 2 independent variables, thus only 2-d luts. (When I wrote gridfit, my patents on the idea were not yet expired, so I chose not to write it for higher dimensional problems.)
Don't forget there are often issues with color & device gamuts when populating these luts. In fact, I invested man-years of my career in developing methods for gamut mapping. Lots of interesting issues there to trip over, but also some pretty mathematical approaches.
In terms of a tool that can be simply used to solve your problem, since my old tools for 3d LUT estimation are not in the public domain, I'd suggest you might look at the 3-d inpaint NaNs tool I wrote. It too is on the file exchange. You would need to replace the empty cells in a 3-D array with NaNs, then call the tool three times, once for each output channel of your 3D-LUT. The method used in that tool will be important. Thus, to avoid extrapolation, use method 1: the 'springs' option.
Again, beware gamut issues.
  4 个评论
cona mx
cona mx 2017-6-17
Hello, John D'Errico. Here is the code I tried:
lut = dlmread('C:\Users\Cona\Desktop\test.cube', ' ', 0, 0);
d = 8;
lutR = reshape(lut(:,1),d,d,d);
lutG = reshape(lut(:,2),d,d,d);
lutB = reshape(lut(:,3),d,d,d);
R=inpaint_nans3(lutR,1);
G=inpaint_nans3(lutG,1);
B=inpaint_nans3(lutB,1);
Redinterp = reshape(R,512,1);
Greeninterp = reshape(G,512,1);
Blueinterp=reshape(B,512,1);
The interpolation results are not close to my reference LUT which is generated by Photoshop. I guess may be this is because we are interpolating each channel separately.
Here is the link to my reference LUT file: http://www.writeurl.com/publish/b1yhb5ialehzeajh7p61
Please check the reference LUT file to get a clear view of what I'm trying to achieve.
Thanks again.
cona mx
cona mx 2017-6-17
编辑:cona mx 2017-6-17
Thank you for analyzing. Please let me know how to proceed when my data is scattered in 3D space.
One more question, what do you mean by node locations.
sorry for too many questions. Thank you very much for your support.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by