fdct_wrapping_dispcoef.m

来自「Fast Discrete Curvelet Transform有正反变换,各个」· M 代码 · 共 75 行

M
75
字号
function img = fdct_wrapping_dispcoef(C)% fdct_wrapping_dispcoef - returns an image containing all the curvelet coefficients%% Inputs%     C         Curvelet coefficients %% Outputs%     img       Image containing all the curvelet coefficients. The coefficents are rescaled so that%       the largest coefficent in each subband has unit norm.%    [m,n] = size(C{end}{1});  nbscales = floor(log2(min(m,n)))-3;  %nbscales = 3;  img = C{1}{1};  img = img/max(max(abs(img))); %normalize  for sc=2:nbscales-1    nd = length(C{sc})/4;    wcnt = 0;        ONE = [];    [u,v] = size(C{sc}{wcnt+1});    for w=1:nd      ONE = [ONE, fdct_wrapping_dispcoef_expand(u,v,C{sc}{wcnt+w})];    end    wcnt = wcnt+nd;        TWO = [];    [u,v] = size(C{sc}{wcnt+1});    for w=1:nd      TWO = [TWO; fdct_wrapping_dispcoef_expand(u,v,C{sc}{wcnt+w})];    end    wcnt = wcnt+nd;        THREE = [];    [u,v] = size(C{sc}{wcnt+1});    for w=1:nd      THREE = [fdct_wrapping_dispcoef_expand(u,v,C{sc}{wcnt+w}), THREE];    end    wcnt = wcnt+nd;        FOUR = [];    [u,v] = size(C{sc}{wcnt+1});    for w=1:nd      FOUR = [fdct_wrapping_dispcoef_expand(u,v,C{sc}{wcnt+w}); FOUR];    end    wcnt = wcnt+nd;        [p,q] = size(img);    [a,b] = size(ONE);    [g,h] = size(TWO);    m = 2*a+g;    n = 2*h+b; %size of new image    scale = max(max( max(max(abs(ONE))),max(max(abs(TWO))) ), max(max(max(abs(THREE))), max(max(abs(FOUR))) )); %scaling factor        new = 0.5 * ones(m,n);%background value    new(a+1:a+g,1:h) = FOUR/scale;    new(a+g+1:2*a+g,h+1:h+b) = THREE/scale;    new(a+1:a+g,h+b+1:2*h+b) = TWO/scale;    new(1:a,h+1:h+b) = ONE/scale;%normalize        dx = floor((g-p)/2);    dy = floor((b-q)/2);        new(a+1+dx:a+p+dx,h+1+dy:h+q+dy) = img;        img = new;  endfunction A = fdct_wrapping_dispcoef_expand(u,v,B)  A = zeros(u,v);  [p,q] = size(B);  A(1:p,1:q) = B;      

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?