wenhance.m
上传用户:jxhj103
上传日期:2022-03-22
资源大小:1k
文件大小:1k
源码类别:

波变换

开发平台:

Visual C++

  1. function y{1:wl+1}{:}=wenhance(im,y{1:wl+1}{:},wl) 
  2. [co,s] = wavedec2(im,wl,'db1');
  3. lrow = s(1,1);
  4. lcol = s(1,2);
  5. s1p = s(1,1)*s(1,2);
  6. for i=2:wl+1 
  7.     scl=wl-i+2;    % is the coefficients of scale wl-i+2
  8.     if i==2
  9.        s2p=s(2,1)*s(2,2);
  10.        d=positionh(co,s2p,s1p);
  11.        hf=s1p; %record the position of ch's first element
  12.        ch=reshape(d,lrow,lcol);
  13.        d=0;
  14.        d=positionh(co,s2p,s2p+s1p);
  15.        vf=s1p+s2p;
  16.        cv=reshape(d,lrow,lcol);
  17.     else
  18.         hrow=s(i,1);
  19.         hcol=s(i,2);
  20.         and=account(s,wl,i);
  21.         b=s1p+3*and;
  22.         sclp=s(i,1)*s(i,2);
  23.         d=positionh(co,sclp,b);
  24.         hf=b;
  25.         ch=reshape(d,hrow,hcol);
  26.         d=0;
  27.         d=positionh(co,sclp,b+sclp);
  28.         vf=b+sclp;
  29.         cv=reshape(d,hrow,hcol);
  30.     end
  31.         g=sqrt(ch.^2+cv.^2);
  32.         mj=700; 
  33.         c=3;
  34.         p=0.4;
  35.         [chr,chl]=size(ch);
  36.         for i=1:chr
  37.           for j=1:chl
  38.             if g(i,j)<c
  39.                ex=(mj/c)^p;
  40.            elseif g(i,j)>=mj
  41.                ex=1;
  42.            else ex=(mj/g(i,j))^p;
  43.            end
  44.            ch(i,j)=ex*ch(i,j);
  45.            cv(i,j)=ex*cv(i,j);
  46.            co(hf+(j-1)*chl+i)=ch(i,j);
  47.            co(vf+(j-1)*chl+i)=cv(i,j);
  48.           end
  49.         end
  50. end
  51. y{1:wl+1}{:} = vec2pdfb(co, s);