This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[FAQ] TDA4VM: How to create lens shading correction LUT for VPAC-VISS-LSC?

Part Number: TDA4VM

Tool/software:

How can I create lens shading correction LUT for VPAC-VISS-LDC?

  • LSC in TDA4x/AM6xA VPAC-VISS can support independent color shading correction.
    Each color channel (e.g., in RGGB) may have its own shading property and image center location.
    The following Matlab script may take a text file for input of lens shading property and calculate the 2D LSC LUT.

    function gen_lsc_lut(spec_file, pitch_in_mm, W, H, hc, vc, N, Q, lut_out)
    % spec_file         LSC shading property file
    % pitch_in_mm       sensor pixel pitch
    % W                 image width
    % H                 image height
    % hc                horiztonal image center (1x1 or 4x1)
    % vc                vertical image center (1x1 or 4x1)
    % N                 LSC LUT down-sampling factor (8, 16, 32, 64, or 128)
    % Q                 LSC LUT integer encoding format (5, 6, 7, or 8) with +1
    % lut_out           output 2D LSC LUT text file
    
    % read lens shading spec file
    spec_lut_4c = read_spec(spec_file, pitch_in_mm);
    
    % calculate LSC LUT table size
    h_end = ceil(W / N) * N;
    v_end = ceil(H / N) * N;
    [xx, yy] = meshgrid(0:N:h_end, 0:N:v_end);
    g_tbl_4c = zeros([size(xx,1), size(xx,2)*4]);
    for i = 1:4
        r = sqrt ((xx - hc(i)).^2 + (yy - vc(i)).^2);
        r = min(r, spec_lut_4c(end, 1));
        
        % calculate LSC LUT
        gain = interp1(spec_lut_4c(:,1), spec_lut_4c(:,i+1), r);
        g_tbl_4c(:,i:4:end) = round ((gain - 1) * 2^Q);
    end
    g_tbl_4c = min(255, max(g_tbl_4c, 0));
    
    % write LUT into a text file with 4 color channels
    dlmwrite(lut_out, g_tbl_4c, 'delimiter', ' ');
    
    % read spec file for 4 colors in 5 columns
    function [spec_lut_4c] = read_spec(spec_file, pitch_in_mm)
    spec_lut = dlmread(spec_file);
    spec_lut_4c = zeros(size(spec_lut,1), 5);
    if size(spec_lut, 2) == 5
        spec_lut_4c = spec_lut;
    elseif size(spec_lut, 2) == 2
        spec_lut_4c(:,1:2) = spec_lut;
        spec_lut_4c(:,3) = spec_lut(:,2);
        spec_lut_4c(:,4) = spec_lut(:,2);
        spec_lut_4c(:,5) = spec_lut(:,2);
    else
        error('spec lut file format is wrong');
    end
    
    spec_lut_4c(:, 1) = spec_lut_4c(:, 1) / pitch_in_mm;
    for i = 2:5
        spec_lut_4c(:, i) = spec_lut_4c(1, i) ./ spec_lut_4c(:, i);
    end

    The lens shading spec file may have 2 or 5 columns (for color independent shading and color dependent shading).
    The first column is for distance from image center for shading (scaled by the pitch_in_mm) and the other columns are for the amount of shading.
    In the example below, the first column is in the unit of pixels (i.e., pitch_in_mm=1) and the other columns are the same for all RGGB colors for simplicity.

               0    1.0000      1.0000       1.0000      1.0000
               3    1.0000      1.0000       1.0000      1.0000
               6    0.9999      0.9999       0.9999      0.9999
               9    0.9999      0.9999       0.9999      0.9999
              12    0.9999      0.9999       0.9999      0.9999
              15    0.9998      0.9998       0.9998      0.9998
              18    0.9998      0.9998       0.9998      0.9998
              21    0.9998      0.9998       0.9998      0.9998
              24    0.9998      0.9998       0.9998      0.9998
              27    0.9997      0.9997       0.9997      0.9997
              30    0.9997      0.9997       0.9997      0.9997
              33    0.9997      0.9997       0.9997      0.9997
              36    0.9996      0.9996       0.9996      0.9996
              39    0.9996      0.9996       0.9996      0.9996
              42    0.9996      0.9996       0.9996      0.9996
              45    0.9995      0.9995       0.9995      0.9995
              48    0.9995      0.9995       0.9995      0.9995
              51    0.9995      0.9995       0.9995      0.9995
              54    0.9995      0.9995       0.9995      0.9995
              57    0.9994      0.9994       0.9994      0.9994
              60    0.9994      0.9994       0.9994      0.9994
              63    0.9994      0.9994       0.9994      0.9994
              66    0.9993      0.9993       0.9993      0.9993
              69    0.9993      0.9993       0.9993      0.9993
              72    0.9993      0.9993       0.9993      0.9993
              75    0.9992      0.9992       0.9992      0.9992
              78    0.9992      0.9992       0.9992      0.9992
              81    0.9992      0.9992       0.9992      0.9992
              84    0.9991      0.9991       0.9991      0.9991
              87    0.9991      0.9991       0.9991      0.9991
              90    0.9991      0.9991       0.9991      0.9991
              93    0.9991      0.9991       0.9991      0.9991
              96    0.9990      0.9990       0.9990      0.9990
              99    0.9990      0.9990       0.9990      0.9990
             102    0.9990      0.9990       0.9990      0.9990
             105    0.9989      0.9989       0.9989      0.9989
             108    0.9989      0.9989       0.9989      0.9989
             111    0.9989      0.9989       0.9989      0.9989
             114    0.9988      0.9988       0.9988      0.9988
             117    0.9988      0.9988       0.9988      0.9988
             120    0.9988      0.9988       0.9988      0.9988
             123    0.9987      0.9987       0.9987      0.9987
             126    0.9987      0.9987       0.9987      0.9987
             129    0.9987      0.9987       0.9987      0.9987
             132    0.9987      0.9987       0.9987      0.9987
             135    0.9986      0.9986       0.9986      0.9986
             138    0.9986      0.9986       0.9986      0.9986
             141    0.9986      0.9986       0.9986      0.9986
             144    0.9985      0.9985       0.9985      0.9985
             147    0.9985      0.9985       0.9985      0.9985
             150    0.9985      0.9985       0.9985      0.9985
             153    0.9984      0.9984       0.9984      0.9984
             156    0.9984      0.9984       0.9984      0.9984
             159    0.9984      0.9984       0.9984      0.9984
             162    0.9984      0.9984       0.9984      0.9984
             165    0.9983      0.9983       0.9983      0.9983
             168    0.9983      0.9983       0.9983      0.9983
             171    0.9983      0.9983       0.9983      0.9983
             174    0.9982      0.9982       0.9982      0.9982
             177    0.9982      0.9982       0.9982      0.9982
             180    0.9982      0.9982       0.9982      0.9982
             183    0.9981      0.9981       0.9981      0.9981
             186    0.9981      0.9981       0.9981      0.9981
             189    0.9981      0.9981       0.9981      0.9981
             192    0.9980      0.9980       0.9980      0.9980
             195    0.9973      0.9973       0.9973      0.9973
             198    0.9966      0.9966       0.9966      0.9966
             201    0.9959      0.9959       0.9959      0.9959
             204    0.9952      0.9952       0.9952      0.9952
             207    0.9945      0.9945       0.9945      0.9945
             210    0.9938      0.9938       0.9938      0.9938
             213    0.9931      0.9931       0.9931      0.9931
             216    0.9925      0.9925       0.9925      0.9925
             219    0.9918      0.9918       0.9918      0.9918
             222    0.9911      0.9911       0.9911      0.9911
             225    0.9904      0.9904       0.9904      0.9904
             228    0.9897      0.9897       0.9897      0.9897
             231    0.9890      0.9890       0.9890      0.9890
             234    0.9883      0.9883       0.9883      0.9883
             237    0.9877      0.9877       0.9877      0.9877
             240    0.9870      0.9870       0.9870      0.9870
             243    0.9863      0.9863       0.9863      0.9863
             246    0.9856      0.9856       0.9856      0.9856
             249    0.9849      0.9849       0.9849      0.9849
             252    0.9843      0.9843       0.9843      0.9843
             255    0.9836      0.9836       0.9836      0.9836
             258    0.9829      0.9829       0.9829      0.9829
             261    0.9822      0.9822       0.9822      0.9822
             264    0.9815      0.9815       0.9815      0.9815
             267    0.9809      0.9809       0.9809      0.9809
             270    0.9802      0.9802       0.9802      0.9802
             273    0.9795      0.9795       0.9795      0.9795
             276    0.9789      0.9789       0.9789      0.9789
             279    0.9782      0.9782       0.9782      0.9782
             282    0.9775      0.9775       0.9775      0.9775
             285    0.9768      0.9768       0.9768      0.9768
             288    0.9762      0.9762       0.9762      0.9762
             291    0.9755      0.9755       0.9755      0.9755
             294    0.9748      0.9748       0.9748      0.9748
             297    0.9742      0.9742       0.9742      0.9742
             300    0.9735      0.9735       0.9735      0.9735
             303    0.9729      0.9729       0.9729      0.9729
             306    0.9722      0.9722       0.9722      0.9722
             309    0.9715      0.9715       0.9715      0.9715
             312    0.9709      0.9709       0.9709      0.9709
             315    0.9702      0.9702       0.9702      0.9702
             318    0.9696      0.9696       0.9696      0.9696
             321    0.9689      0.9689       0.9689      0.9689
             324    0.9682      0.9682       0.9682      0.9682
             327    0.9676      0.9676       0.9676      0.9676
             330    0.9669      0.9669       0.9669      0.9669
             333    0.9663      0.9663       0.9663      0.9663
             336    0.9656      0.9656       0.9656      0.9656
             339    0.9650      0.9650       0.9650      0.9650
             342    0.9643      0.9643       0.9643      0.9643
             345    0.9636      0.9636       0.9636      0.9636
             348    0.9629      0.9629       0.9629      0.9629
             351    0.9623      0.9623       0.9623      0.9623
             354    0.9616      0.9616       0.9616      0.9616
             357    0.9610      0.9610       0.9610      0.9610
             360    0.9603      0.9603       0.9603      0.9603
             363    0.9597      0.9597       0.9597      0.9597
             366    0.9590      0.9590       0.9590      0.9590
             369    0.9584      0.9584       0.9584      0.9584
             372    0.9578      0.9578       0.9578      0.9578
             375    0.9571      0.9571       0.9571      0.9571
             378    0.9565      0.9565       0.9565      0.9565
             381    0.9558      0.9558       0.9558      0.9558
             384    0.9552      0.9552       0.9552      0.9552
             387    0.9543      0.9543       0.9543      0.9543
             390    0.9534      0.9534       0.9534      0.9534
             393    0.9525      0.9525       0.9525      0.9525
             396    0.9516      0.9516       0.9516      0.9516
             399    0.9507      0.9507       0.9507      0.9507
             402    0.9498      0.9498       0.9498      0.9498
             405    0.9489      0.9489       0.9489      0.9489
             408    0.9480      0.9480       0.9480      0.9480
             411    0.9471      0.9471       0.9471      0.9471
             414    0.9462      0.9462       0.9462      0.9462
             417    0.9452      0.9452       0.9452      0.9452
             420    0.9443      0.9443       0.9443      0.9443
             423    0.9434      0.9434       0.9434      0.9434
             426    0.9425      0.9425       0.9425      0.9425
             429    0.9416      0.9416       0.9416      0.9416
             432    0.9407      0.9407       0.9407      0.9407
             435    0.9398      0.9398       0.9398      0.9398
             438    0.9390      0.9390       0.9390      0.9390
             441    0.9381      0.9381       0.9381      0.9381
             444    0.9372      0.9372       0.9372      0.9372
             447    0.9363      0.9363       0.9363      0.9363
             450    0.9355      0.9355       0.9355      0.9355
             453    0.9346      0.9346       0.9346      0.9346
             456    0.9337      0.9337       0.9337      0.9337
             459    0.9327      0.9327       0.9327      0.9327
             462    0.9319      0.9319       0.9319      0.9319
             465    0.9310      0.9310       0.9310      0.9310
             468    0.9301      0.9301       0.9301      0.9301
             471    0.9293      0.9293       0.9293      0.9293
             474    0.9284      0.9284       0.9284      0.9284
             477    0.9276      0.9276       0.9276      0.9276
             480    0.9267      0.9267       0.9267      0.9267
             483    0.9258      0.9258       0.9258      0.9258
             486    0.9250      0.9250       0.9250      0.9250
             489    0.9241      0.9241       0.9241      0.9241
             492    0.9233      0.9233       0.9233      0.9233
             495    0.9224      0.9224       0.9224      0.9224
             498    0.9216      0.9216       0.9216      0.9216
             501    0.9206      0.9206       0.9206      0.9206
             504    0.9198      0.9198       0.9198      0.9198
             507    0.9189      0.9189       0.9189      0.9189
             510    0.9181      0.9181       0.9181      0.9181
             513    0.9173      0.9173       0.9173      0.9173
             516    0.9164      0.9164       0.9164      0.9164
             519    0.9156      0.9156       0.9156      0.9156
             522    0.9147      0.9147       0.9147      0.9147
             525    0.9139      0.9139       0.9139      0.9139
             528    0.9131      0.9131       0.9131      0.9131
             531    0.9122      0.9122       0.9122      0.9122
             534    0.9114      0.9114       0.9114      0.9114
             537    0.9106      0.9106       0.9106      0.9106
             540    0.9098      0.9098       0.9098      0.9098
             543    0.9088      0.9088       0.9088      0.9088
             546    0.9080      0.9080       0.9080      0.9080
             549    0.9072      0.9072       0.9072      0.9072
             552    0.9064      0.9064       0.9064      0.9064
             555    0.9056      0.9056       0.9056      0.9056
             558    0.9047      0.9047       0.9047      0.9047
             561    0.9039      0.9039       0.9039      0.9039
             564    0.9031      0.9031       0.9031      0.9031
             567    0.9023      0.9023       0.9023      0.9023
             570    0.9015      0.9015       0.9015      0.9015
             573    0.9007      0.9007       0.9007      0.9007
             576    0.8998      0.8998       0.8998      0.8998
             579    0.8985      0.8985       0.8985      0.8985
             582    0.8971      0.8971       0.8971      0.8971
             585    0.8957      0.8957       0.8957      0.8957
             588    0.8945      0.8945       0.8945      0.8945
             591    0.8931      0.8931       0.8931      0.8931
             594    0.8917      0.8917       0.8917      0.8917
             597    0.8904      0.8904       0.8904      0.8904
             600    0.8890      0.8890       0.8890      0.8890
             603    0.8878      0.8878       0.8878      0.8878
             606    0.8864      0.8864       0.8864      0.8864
             609    0.8851      0.8851       0.8851      0.8851
             612    0.8838      0.8838       0.8838      0.8838
             615    0.8825      0.8825       0.8825      0.8825
             618    0.8812      0.8812       0.8812      0.8812
             621    0.8799      0.8799       0.8799      0.8799
             624    0.8786      0.8786       0.8786      0.8786
             627    0.8773      0.8773       0.8773      0.8773
             630    0.8760      0.8760       0.8760      0.8760
             633    0.8747      0.8747       0.8747      0.8747
             636    0.8734      0.8734       0.8734      0.8734
             639    0.8721      0.8721       0.8721      0.8721
             642    0.8709      0.8709       0.8709      0.8709
             645    0.8696      0.8696       0.8696      0.8696
             648    0.8684      0.8684       0.8684      0.8684
             651    0.8671      0.8671       0.8671      0.8671
             654    0.8658      0.8658       0.8658      0.8658
             657    0.8646      0.8646       0.8646      0.8646
             660    0.8633      0.8633       0.8633      0.8633
             663    0.8621      0.8621       0.8621      0.8621
             666    0.8608      0.8608       0.8608      0.8608
             669    0.8595      0.8595       0.8595      0.8595
             672    0.8584      0.8584       0.8584      0.8584
             675    0.8571      0.8571       0.8571      0.8571
             678    0.8559      0.8559       0.8559      0.8559
             681    0.8546      0.8546       0.8546      0.8546
             684    0.8534      0.8534       0.8534      0.8534
             687    0.8522      0.8522       0.8522      0.8522
             690    0.8510      0.8510       0.8510      0.8510
             693    0.8498      0.8498       0.8498      0.8498
             696    0.8485      0.8485       0.8485      0.8485
             699    0.8474      0.8474       0.8474      0.8474
             702    0.8462      0.8462       0.8462      0.8462
             705    0.8450      0.8450       0.8450      0.8450
             708    0.8437      0.8437       0.8437      0.8437
             711    0.8425      0.8425       0.8425      0.8425
             714    0.8414      0.8414       0.8414      0.8414
             717    0.8402      0.8402       0.8402      0.8402
             720    0.8390      0.8390       0.8390      0.8390
             723    0.8378      0.8378       0.8378      0.8378
             726    0.8366      0.8366       0.8366      0.8366
             729    0.8355      0.8355       0.8355      0.8355
             732    0.8343      0.8343       0.8343      0.8343
             735    0.8331      0.8331       0.8331      0.8331
             738    0.8319      0.8319       0.8319      0.8319
             741    0.8308      0.8308       0.8308      0.8308
             744    0.8297      0.8297       0.8297      0.8297
             747    0.8285      0.8285       0.8285      0.8285
             750    0.8273      0.8273       0.8273      0.8273
             753    0.8262      0.8262       0.8262      0.8262
             756    0.8251      0.8251       0.8251      0.8251
             759    0.8239      0.8239       0.8239      0.8239
             762    0.8228      0.8228       0.8228      0.8228
             765    0.8216      0.8216       0.8216      0.8216
             768    0.8205      0.8205       0.8205      0.8205
             771    0.8192      0.8192       0.8192      0.8192
             774    0.8179      0.8179       0.8179      0.8179
             777    0.8166      0.8166       0.8166      0.8166
             780    0.8153      0.8153       0.8153      0.8153
             783    0.8140      0.8140       0.8140      0.8140
             786    0.8127      0.8127       0.8127      0.8127
             789    0.8114      0.8114       0.8114      0.8114
             792    0.8101      0.8101       0.8101      0.8101
             795    0.8089      0.8089       0.8089      0.8089
             798    0.8076      0.8076       0.8076      0.8076
             801    0.8063      0.8063       0.8063      0.8063
             804    0.8050      0.8050       0.8050      0.8050
             807    0.8038      0.8038       0.8038      0.8038
             810    0.8025      0.8025       0.8025      0.8025
             813    0.8013      0.8013       0.8013      0.8013
             816    0.8000      0.8000       0.8000      0.8000
             819    0.7987      0.7987       0.7987      0.7987
             822    0.7975      0.7975       0.7975      0.7975
             825    0.7962      0.7962       0.7962      0.7962
             828    0.7950      0.7950       0.7950      0.7950
             831    0.7938      0.7938       0.7938      0.7938
             834    0.7926      0.7926       0.7926      0.7926
             837    0.7913      0.7913       0.7913      0.7913
             840    0.7901      0.7901       0.7901      0.7901
             843    0.7889      0.7889       0.7889      0.7889
             846    0.7877      0.7877       0.7877      0.7877
             849    0.7865      0.7865       0.7865      0.7865
             852    0.7853      0.7853       0.7853      0.7853
             855    0.7841      0.7841       0.7841      0.7841
             858    0.7829      0.7829       0.7829      0.7829
             861    0.7817      0.7817       0.7817      0.7817
             864    0.7805      0.7805       0.7805      0.7805
             867    0.7793      0.7793       0.7793      0.7793
             870    0.7781      0.7781       0.7781      0.7781
             873    0.7769      0.7769       0.7769      0.7769
             876    0.7757      0.7757       0.7757      0.7757
             879    0.7746      0.7746       0.7746      0.7746
             882    0.7734      0.7734       0.7734      0.7734
             885    0.7723      0.7723       0.7723      0.7723
             888    0.7711      0.7711       0.7711      0.7711
             891    0.7699      0.7699       0.7699      0.7699
             894    0.7688      0.7688       0.7688      0.7688
             897    0.7676      0.7676       0.7676      0.7676
             900    0.7665      0.7665       0.7665      0.7665
             903    0.7653      0.7653       0.7653      0.7653
             906    0.7642      0.7642       0.7642      0.7642
             909    0.7631      0.7631       0.7631      0.7631
             912    0.7619      0.7619       0.7619      0.7619
             915    0.7607      0.7607       0.7607      0.7607
             918    0.7596      0.7596       0.7596      0.7596
             921    0.7585      0.7585       0.7585      0.7585
             924    0.7574      0.7574       0.7574      0.7574
             927    0.7563      0.7563       0.7563      0.7563
             930    0.7552      0.7552       0.7552      0.7552
             933    0.7540      0.7540       0.7540      0.7540
             936    0.7530      0.7530       0.7530      0.7530
             939    0.7518      0.7518       0.7518      0.7518
             942    0.7508      0.7508       0.7508      0.7508
             945    0.7496      0.7496       0.7496      0.7496
             948    0.7486      0.7486       0.7486      0.7486
             951    0.7474      0.7474       0.7474      0.7474
             954    0.7464      0.7464       0.7464      0.7464
             957    0.7453      0.7453       0.7453      0.7453
             960    0.7442      0.7442       0.7442      0.7442
             963    0.7430      0.7430       0.7430      0.7430
             966    0.7418      0.7418       0.7418      0.7418
             969    0.7406      0.7406       0.7406      0.7406
             972    0.7394      0.7394       0.7394      0.7394
             975    0.7382      0.7382       0.7382      0.7382
             978    0.7370      0.7370       0.7370      0.7370
             981    0.7358      0.7358       0.7358      0.7358
             984    0.7346      0.7346       0.7346      0.7346
             987    0.7334      0.7334       0.7334      0.7334
             990    0.7322      0.7322       0.7322      0.7322
             993    0.7310      0.7310       0.7310      0.7310
             996    0.7299      0.7299       0.7299      0.7299
             999    0.7287      0.7287       0.7287      0.7287
            1002    0.7275      0.7275       0.7275      0.7275
            1005    0.7264      0.7264       0.7264      0.7264
            1008    0.7252      0.7252       0.7252      0.7252
            1011    0.7241      0.7241       0.7241      0.7241
            1014    0.7229      0.7229       0.7229      0.7229
            1017    0.7218      0.7218       0.7218      0.7218
            1020    0.7206      0.7206       0.7206      0.7206
            1023    0.7195      0.7195       0.7195      0.7195
            1026    0.7183      0.7183       0.7183      0.7183
            1029    0.7172      0.7172       0.7172      0.7172
            1032    0.7161      0.7161       0.7161      0.7161
            1035    0.7149      0.7149       0.7149      0.7149
            1038    0.7138      0.7138       0.7138      0.7138
            1041    0.7127      0.7127       0.7127      0.7127
            1044    0.7116      0.7116       0.7116      0.7116
            1047    0.7105      0.7105       0.7105      0.7105
            1050    0.7094      0.7094       0.7094      0.7094
            1053    0.7083      0.7083       0.7083      0.7083
            1056    0.7072      0.7072       0.7072      0.7072
            1059    0.7061      0.7061       0.7061      0.7061
            1062    0.7050      0.7050       0.7050      0.7050
            1065    0.7039      0.7039       0.7039      0.7039
            1068    0.7028      0.7028       0.7028      0.7028
            1071    0.7018      0.7018       0.7018      0.7018
            1074    0.7007      0.7007       0.7007      0.7007
            1077    0.6996      0.6996       0.6996      0.6996
            1080    0.6985      0.6985       0.6985      0.6985
            1083    0.6974      0.6974       0.6974      0.6974
            1086    0.6964      0.6964       0.6964      0.6964
            1089    0.6953      0.6953       0.6953      0.6953
            1092    0.6943      0.6943       0.6943      0.6943
            1095    0.6932      0.6932       0.6932      0.6932
            1098    0.6921      0.6921       0.6921      0.6921
            1101    0.6911      0.6911       0.6911      0.6911
            1104    0.6900      0.6900       0.6900      0.6900
            1107    0.6890      0.6890       0.6890      0.6890
            1110    0.6879      0.6879       0.6879      0.6879
            1113    0.6869      0.6869       0.6869      0.6869
            1116    0.6859      0.6859       0.6859      0.6859
            1119    0.6848      0.6848       0.6848      0.6848
            1122    0.6838      0.6838       0.6838      0.6838
            1125    0.6828      0.6828       0.6828      0.6828
            1128    0.6818      0.6818       0.6818      0.6818
            1131    0.6807      0.6807       0.6807      0.6807
            1134    0.6797      0.6797       0.6797      0.6797
            1137    0.6787      0.6787       0.6787      0.6787
            1140    0.6777      0.6777       0.6777      0.6777
            1143    0.6767      0.6767       0.6767      0.6767
            1146    0.6757      0.6757       0.6757      0.6757
            1149    0.6747      0.6747       0.6747      0.6747
            1152    0.6737      0.6737       0.6737      0.6737
            1155    0.6724      0.6724       0.6724      0.6724
            1158    0.6712      0.6712       0.6712      0.6712
            1161    0.6700      0.6700       0.6700      0.6700
            1164    0.6688      0.6688       0.6688      0.6688
            1167    0.6676      0.6676       0.6676      0.6676
            1170    0.6664      0.6664       0.6664      0.6664
            1173    0.6652      0.6652       0.6652      0.6652
            1176    0.6640      0.6640       0.6640      0.6640
            1179    0.6628      0.6628       0.6628      0.6628
            1182    0.6616      0.6616       0.6616      0.6616
            1185    0.6604      0.6604       0.6604      0.6604
            1188    0.6592      0.6592       0.6592      0.6592
            1191    0.6580      0.6580       0.6580      0.6580
            1194    0.6569      0.6569       0.6569      0.6569
            1197    0.6557      0.6557       0.6557      0.6557
            1200    0.6545      0.6545       0.6545      0.6545
            1203    0.6534      0.6534       0.6534      0.6534
            1206    0.6522      0.6522       0.6522      0.6522
            1209    0.6510      0.6510       0.6510      0.6510
            1212    0.6499      0.6499       0.6499      0.6499
            1215    0.6488      0.6488       0.6488      0.6488
            1218    0.6476      0.6476       0.6476      0.6476
            1221    0.6465      0.6465       0.6465      0.6465
            1224    0.6453      0.6453       0.6453      0.6453
            1227    0.6442      0.6442       0.6442      0.6442
            1230    0.6431      0.6431       0.6431      0.6431
            1233    0.6420      0.6420       0.6420      0.6420
            1236    0.6409      0.6409       0.6409      0.6409
            1239    0.6398      0.6398       0.6398      0.6398
            1242    0.6386      0.6386       0.6386      0.6386
            1245    0.6375      0.6375       0.6375      0.6375
            1248    0.6364      0.6364       0.6364      0.6364
            1251    0.6353      0.6353       0.6353      0.6353
            1254    0.6342      0.6342       0.6342      0.6342
            1257    0.6332      0.6332       0.6332      0.6332
            1260    0.6320      0.6320       0.6320      0.6320
            1263    0.6310      0.6310       0.6310      0.6310
            1266    0.6299      0.6299       0.6299      0.6299
            1269    0.6288      0.6288       0.6288      0.6288
            1272    0.6277      0.6277       0.6277      0.6277
            1275    0.6267      0.6267       0.6267      0.6267
            1278    0.6256      0.6256       0.6256      0.6256
            1281    0.6245      0.6245       0.6245      0.6245
            1284    0.6235      0.6235       0.6235      0.6235
            1287    0.6224      0.6224       0.6224      0.6224
            1290    0.6214      0.6214       0.6214      0.6214
            1293    0.6203      0.6203       0.6203      0.6203
            1296    0.6193      0.6193       0.6193      0.6193
            1299    0.6182      0.6182       0.6182      0.6182
            1302    0.6172      0.6172       0.6172      0.6172
            1305    0.6162      0.6162       0.6162      0.6162
            1308    0.6152      0.6152       0.6152      0.6152
            1311    0.6141      0.6141       0.6141      0.6141
            1314    0.6131      0.6131       0.6131      0.6131
            1317    0.6121      0.6121       0.6121      0.6121
            1320    0.6111      0.6111       0.6111      0.6111
            1323    0.6101      0.6101       0.6101      0.6101
            1326    0.6091      0.6091       0.6091      0.6091
            1329    0.6081      0.6081       0.6081      0.6081
            1332    0.6071      0.6071       0.6071      0.6071
            1335    0.6060      0.6060       0.6060      0.6060
            1338    0.6050      0.6050       0.6050      0.6050
            1341    0.6040      0.6040       0.6040      0.6040
            1344    0.6031      0.6031       0.6031      0.6031
            1347    0.6015      0.6015       0.6015      0.6015
            1350    0.6001      0.6001       0.6001      0.6001
            1353    0.5986      0.5986       0.5986      0.5986
            1356    0.5971      0.5971       0.5971      0.5971
            1359    0.5956      0.5956       0.5956      0.5956
            1362    0.5941      0.5941       0.5941      0.5941
            1365    0.5927      0.5927       0.5927      0.5927
            1368    0.5912      0.5912       0.5912      0.5912
            1371    0.5898      0.5898       0.5898      0.5898
            1374    0.5883      0.5883       0.5883      0.5883
            1377    0.5869      0.5869       0.5869      0.5869
            1380    0.5855      0.5855       0.5855      0.5855
            1383    0.5840      0.5840       0.5840      0.5840
            1386    0.5826      0.5826       0.5826      0.5826
            1389    0.5812      0.5812       0.5812      0.5812
            1392    0.5798      0.5798       0.5798      0.5798
            1395    0.5784      0.5784       0.5784      0.5784
            1398    0.5771      0.5771       0.5771      0.5771
            1401    0.5757      0.5757       0.5757      0.5757
            1404    0.5743      0.5743       0.5743      0.5743
            1407    0.5729      0.5729       0.5729      0.5729
            1410    0.5716      0.5716       0.5716      0.5716
            1413    0.5702      0.5702       0.5702      0.5702
            1416    0.5689      0.5689       0.5689      0.5689
            1419    0.5675      0.5675       0.5675      0.5675
            1422    0.5662      0.5662       0.5662      0.5662
            1425    0.5649      0.5649       0.5649      0.5649
            1428    0.5636      0.5636       0.5636      0.5636
            1431    0.5622      0.5622       0.5622      0.5622
            1434    0.5609      0.5609       0.5609      0.5609
            1437    0.5596      0.5596       0.5596      0.5596
            1440    0.5583      0.5583       0.5583      0.5583
            1443    0.5570      0.5570       0.5570      0.5570
            1446    0.5558      0.5558       0.5558      0.5558
            1449    0.5545      0.5545       0.5545      0.5545
            1452    0.5532      0.5532       0.5532      0.5532
            1455    0.5519      0.5519       0.5519      0.5519
            1458    0.5507      0.5507       0.5507      0.5507
            1461    0.5494      0.5494       0.5494      0.5494
            1464    0.5482      0.5482       0.5482      0.5482
            1467    0.5469      0.5469       0.5469      0.5469
            1470    0.5457      0.5457       0.5457      0.5457
            1473    0.5445      0.5445       0.5445      0.5445
            1476    0.5432      0.5432       0.5432      0.5432
            1479    0.5420      0.5420       0.5420      0.5420
            1482    0.5408      0.5408       0.5408      0.5408
            1485    0.5396      0.5396       0.5396      0.5396
            1488    0.5384      0.5384       0.5384      0.5384
            1491    0.5372      0.5372       0.5372      0.5372
            1494    0.5360      0.5360       0.5360      0.5360
            1497    0.5348      0.5348       0.5348      0.5348
            1500    0.5336      0.5336       0.5336      0.5336
            1503    0.5324      0.5324       0.5324      0.5324
            1506    0.5313      0.5313       0.5313      0.5313
            1509    0.5301      0.5301       0.5301      0.5301
            1512    0.5289      0.5289       0.5289      0.5289
            1515    0.5278      0.5278       0.5278      0.5278
            1518    0.5266      0.5266       0.5266      0.5266
            1521    0.5255      0.5255       0.5255      0.5255
            1524    0.5243      0.5243       0.5243      0.5243
            1527    0.5232      0.5232       0.5232      0.5232
            1530    0.5221      0.5221       0.5221      0.5221
            1533    0.5209      0.5209       0.5209      0.5209
            1536    0.5198      0.5198       0.5198      0.5198
            1539    0.5181      0.5181       0.5181      0.5181
            1542    0.5164      0.5164       0.5164      0.5164
            1545    0.5147      0.5147       0.5147      0.5147
            1548    0.5130      0.5130       0.5130      0.5130
            1551    0.5114      0.5114       0.5114      0.5114
            1554    0.5097      0.5097       0.5097      0.5097
            1557    0.5081      0.5081       0.5081      0.5081
            1560    0.5064      0.5064       0.5064      0.5064
            1563    0.5048      0.5048       0.5048      0.5048
            1566    0.5032      0.5032       0.5032      0.5032
            1569    0.5016      0.5016       0.5016      0.5016
            1572    0.5000      0.5000       0.5000      0.5000
            1575    0.4984      0.4984       0.4984      0.4984
            1578    0.4968      0.4968       0.4968      0.4968
            1581    0.4953      0.4953       0.4953      0.4953
            1584    0.4937      0.4937       0.4937      0.4937
            1587    0.4922      0.4922       0.4922      0.4922
            1590    0.4907      0.4907       0.4907      0.4907
            1593    0.4891      0.4891       0.4891      0.4891
            1596    0.4876      0.4876       0.4876      0.4876
            1599    0.4861      0.4861       0.4861      0.4861
            1602    0.4846      0.4846       0.4846      0.4846
            1605    0.4831      0.4831       0.4831      0.4831
            1608    0.4816      0.4816       0.4816      0.4816
            1611    0.4802      0.4802       0.4802      0.4802
            1614    0.4787      0.4787       0.4787      0.4787
            1617    0.4773      0.4773       0.4773      0.4773
            1620    0.4758      0.4758       0.4758      0.4758
            1623    0.4744      0.4744       0.4744      0.4744
            1626    0.4730      0.4730       0.4730      0.4730
            1629    0.4716      0.4716       0.4716      0.4716
            1632    0.4701      0.4701       0.4701      0.4701
            1635    0.4688      0.4688       0.4688      0.4688
            1638    0.4674      0.4674       0.4674      0.4674
            1641    0.4660      0.4660       0.4660      0.4660
            1644    0.4646      0.4646       0.4646      0.4646
            1647    0.4632      0.4632       0.4632      0.4632
            1650    0.4619      0.4619       0.4619      0.4619
            1653    0.4605      0.4605       0.4605      0.4605
            1656    0.4592      0.4592       0.4592      0.4592
            1659    0.4579      0.4579       0.4579      0.4579
            1662    0.4565      0.4565       0.4565      0.4565
            1665    0.4552      0.4552       0.4552      0.4552
            1668    0.4539      0.4539       0.4539      0.4539
            1671    0.4526      0.4526       0.4526      0.4526
            1674    0.4513      0.4513       0.4513      0.4513
            1677    0.4500      0.4500       0.4500      0.4500
            1680    0.4487      0.4487       0.4487      0.4487
            1683    0.4474      0.4474       0.4474      0.4474
            1686    0.4462      0.4462       0.4462      0.4462
            1689    0.4449      0.4449       0.4449      0.4449
            1692    0.4437      0.4437       0.4437      0.4437
            1695    0.4424      0.4424       0.4424      0.4424
            1698    0.4412      0.4412       0.4412      0.4412
            1701    0.4400      0.4400       0.4400      0.4400
            1704    0.4387      0.4387       0.4387      0.4387
            1707    0.4375      0.4375       0.4375      0.4375
            1710    0.4363      0.4363       0.4363      0.4363
            1713    0.4351      0.4351       0.4351      0.4351
            1716    0.4339      0.4339       0.4339      0.4339
            1719    0.4327      0.4327       0.4327      0.4327
            1722    0.4315      0.4315       0.4315      0.4315
            1725    0.4303      0.4303       0.4303      0.4303
            1728    0.4292      0.4292       0.4292      0.4292
            1731    0.4272      0.4272       0.4272      0.4272
            1734    0.4253      0.4253       0.4253      0.4253
            1737    0.4234      0.4234       0.4234      0.4234
            1740    0.4215      0.4215       0.4215      0.4215
            1743    0.4197      0.4197       0.4197      0.4197
            1746    0.4179      0.4179       0.4179      0.4179
            1749    0.4160      0.4160       0.4160      0.4160
            1752    0.4142      0.4142       0.4142      0.4142
            1755    0.4124      0.4124       0.4124      0.4124
            1758    0.4106      0.4106       0.4106      0.4106
            1761    0.4088      0.4088       0.4088      0.4088
            1764    0.4071      0.4071       0.4071      0.4071
            1767    0.4054      0.4054       0.4054      0.4054
            1770    0.4036      0.4036       0.4036      0.4036
            1773    0.4019      0.4019       0.4019      0.4019
            1776    0.4002      0.4002       0.4002      0.4002
            1779    0.3985      0.3985       0.3985      0.3985
            1782    0.3969      0.3969       0.3969      0.3969
            1785    0.3952      0.3952       0.3952      0.3952
            1788    0.3936      0.3936       0.3936      0.3936
            1791    0.3920      0.3920       0.3920      0.3920
            1794    0.3904      0.3904       0.3904      0.3904
            1797    0.3888      0.3888       0.3888      0.3888
            1800    0.3872      0.3872       0.3872      0.3872
            1803    0.3856      0.3856       0.3856      0.3856
            1806    0.3841      0.3841       0.3841      0.3841
            1809    0.3825      0.3825       0.3825      0.3825
            1812    0.3810      0.3810       0.3810      0.3810
            1815    0.3794      0.3794       0.3794      0.3794
            1818    0.3779      0.3779       0.3779      0.3779
            1821    0.3764      0.3764       0.3764      0.3764
            1824    0.3750      0.3750       0.3750      0.3750
            1827    0.3735      0.3735       0.3735      0.3735
            1830    0.3720      0.3720       0.3720      0.3720
            1833    0.3706      0.3706       0.3706      0.3706
            1836    0.3691      0.3691       0.3691      0.3691
            1839    0.3677      0.3677       0.3677      0.3677
            1842    0.3663      0.3663       0.3663      0.3663
            1845    0.3649      0.3649       0.3649      0.3649
            1848    0.3635      0.3635       0.3635      0.3635
            1851    0.3621      0.3621       0.3621      0.3621
            1854    0.3607      0.3607       0.3607      0.3607
            1857    0.3594      0.3594       0.3594      0.3594
            1860    0.3580      0.3580       0.3580      0.3580
            1863    0.3566      0.3566       0.3566      0.3566
            1866    0.3553      0.3553       0.3553      0.3553
            1869    0.3540      0.3540       0.3540      0.3540
            1872    0.3527      0.3527       0.3527      0.3527
            1875    0.3514      0.3514       0.3514      0.3514
            1878    0.3501      0.3501       0.3501      0.3501
            1881    0.3488      0.3488       0.3488      0.3488
            1884    0.3475      0.3475       0.3475      0.3475
            1887    0.3462      0.3462       0.3462      0.3462
            1890    0.3450      0.3450       0.3450      0.3450
            1893    0.3437      0.3437       0.3437      0.3437
            1896    0.3425      0.3425       0.3425      0.3425
            1899    0.3413      0.3413       0.3413      0.3413
            1902    0.3401      0.3401       0.3401      0.3401
            1905    0.3388      0.3388       0.3388      0.3388
            1908    0.3376      0.3376       0.3376      0.3376
            1911    0.3364      0.3364       0.3364      0.3364
            1914    0.3353      0.3353       0.3353      0.3353
            1917    0.3341      0.3341       0.3341      0.3341
            1920    0.3329      0.3329       0.3329      0.3329
    

    If you use the DCC tuning tool for LSC tuning, you may see that the tool only supports color-independent input (i.e., the LUT above has only 2 columns rather than 5).
    You may use the tuning tool to generate a valid xml file with the first 2 columns of above LUT.
    Then you may use the 2D LSC LUT from matlab/octave code above to replace 2D LUT inside the xml file.
    That will make your LSC xml file color dependent.

    Note

    If you are working with a WDR sensor with more than 16-bit dynamic range, there is a pre-gamma compression applied to the raw image pixels.
    For LSC 2D LUT, the gain values has to be gamma corrected in the same way.

    You would have to adjust your LSC shading values with the same gamma value.
    e.g., 0.9 (10% loss) with 0.5 gamma becomes "0.9^0.5 = 0.94868".