3D interpolation using LUT very slow, alternative method

8 views (last 30 days)
Hello,
In image processing, converting XYZ(CIE 1931 XYZ space) to display RGB, We have created a LUT for our display. it is 3d cubic interpolation based and our results are correct. But the issue is that our code is extremly slow becasue it is pixel by pixel based. The function is such that
[rgbOut]=MyDisplayXYZ2RGB(NewXYZ, XYZlut,RGBlut);
where NewXYZ are XYZ value for which RGB are to be interpolated. XYZlut and RGBlut are the values which are used to interpolate using cubic interpolation method. We cacluate CIELAB DE and use it as criteria for the rgbOut.
Our image size is 4053x2050 and our LUT routine takes 2hours to complate because uses loop.
My question is that, if Matlab interp3 or some other function can interpolate like this? Will it be faster?
Can you please guide me how can I use interp3 for this data interpolation? Actually, I do not understand how can I input my LUTs in the interp3. Thank you.
Seoncd option for me, If, I hare my matlab code, can be fixed to take whole vector instead pixel?
Note:
NewXYZ is mx3 dimension
XYZlut [X Y Z] ] and RGBlut [R G B] are nx3 dimension
rgbOut must be mx3 dimension having R,G,B values
----Sample data
XYZlut=[ 0.085954 0.097486 0.13636
0.19496 0.16676 0.62822
0.30154 0.19816 1.3158
0.68737 0.35471 3.4668
1.5699 0.69064 8.4565
3.052 1.2449 16.831
6.2012 2.4245 34.592
12.034 4.5791 67.462
22.04 8.2393 123.88
39.937 14.723 224.99];
RGBlut=[0 0 0
0 0 19
0 0 38
0 0 57
0 0 76
0 0 95
0 0 114
0 0 133
0 0 152
0 0 171] ;
NewXYZ= [62.10263 66.39005 169.7117
76.8211 82.24026 201.0852
73.61543 78.18117 195.2129
71.9406 76.70645 190.4692];
  2 Comments
KSSV
KSSV on 16 Apr 2019
My question is that, if Matlab interp3 or some other function can interpolate like this?
Very much possible...
Will it be faster?
Definetely it will be faster.
Abdulllah
Abdulllah on 16 Apr 2019
Edited: Abdulllah on 16 Apr 2019
Thank KSSV for your reply. Actually I tried interp3 but I could not get success in using interp3. Can you please guide me how can I use interp3 for this data interpolation? Actually, I do not understand how can I input my LUTs in the interp3. Thank you.

Sign in to comment.

Answers (0)

Categories

Find more on Interpolation in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!