美文网首页
matlab——生成查找表LUT

matlab——生成查找表LUT

作者: LCCCC_0523 | 来源:发表于2017-05-02 12:33 被阅读0次

    依据左超论文建立查找表

    原理图

    生成条纹级次可能项

    -floor(width1) <= K1 <=floor (width1)

    -floor(width2) <= K2 <= floor(width2)

    按照条纹宽度赋当前k值

    按照公式

    生成查找表LUT = [ k1 k2 k2p1-k1p2 ]

    去除重复值获得查找表LUT。

    fun_LUT.m

    %生成查找表

    function [ lut ] = fun_LUT( width1,width2 )

    %!!!注意:width1 > width2

    %

    show = 1;

    Lcm = lcm(width1,width2);

    number1 = Lcm/width1;

    number2 = Lcm/width2;

    for i = -floor(number1/2):floor(number1/2)

    n = i - (-floor(number1/2))+1;

    start = width1*(n-1)+1;

    en_d = width1*n;

    A(1,start:en_d) = i;

    end

    for i = -floor(number2/2):floor(number2/2)

    n = i - (-floor(number2/2))+1;

    start = width2*(n-1)+1;

    en_d = width2*(n);

    B(1,start:en_d) = i;

    end

    if rem(width1,2) == 0

    [nouse,length_A] = size(A);

    AA = zeros(1,2*length_A);

    for n = 1:length_A

    AA(2*n-1:2*n) = A(1,n);

    end

    [nouse,length_B] = size(B);

    BB = zeros(1,2*length_B);

    for n = 1:length_B

    BB(2*n-1:2*n) = B(1,n);

    end

    dif = length_B-length_A;%(2*length_B-2*length_A)/2;

    BB = BB(dif+1:end-dif);

    lut = [AA;BB;BB(1,:)*number1-AA(1,:)*number2];

    if show == 1

    figure;

    juxing(1:2*length_A,lut(3,:));

    end

    %去除重复值

    lut = unique(lut','rows');

    lut = sortrows(lut,3);

    else

    lut = [A;B;B(1,:)*number1-A(1,:)*number2];

    if show == 1

    juxing(1:Lcm,lut(3,:));

    end

    %去除重复值

    lut = unique(lut','rows');

    lut = sortrows(lut,3);

    end

    end

    相关文章

      网友评论

          本文标题:matlab——生成查找表LUT

          本文链接:https://www.haomeiwen.com/subject/pxsctxtx.html