📄 hvsynthesis.m
字号:
% wavelet synthesis of a image region% f0: synthesis lowpass f1: synthesis highpass% Ain: input image [M x N]% [sr, sc] and [er, ec] specify the rect region of Ain% to be decomposed. % diret: horizontal =1 , vertical=-1; % A: output images, only the region is changed% function [A]=synthesis(f0, f1, Ain, sr, sc, er, ec, diret)function [A]=hvsynthesis(Ain,sr,sc,er,ec,diret)f0=[0.037828, -0.023849, -0.110624, 0.377402, 0.852699, 0.377402, -0.110624, -0.023849, 0.037828] ;f1=[0.064539, -0.040689,-0.418092, 0.788486, -0.418092, -0.040689, 0.064539];RRM=(sr+er-1)/2;CCM=(sc+ec-1)/2;if (diret < 0),% disp(' vertical synthesis....'); clen=(er-sr)+1; w1=zeros(clen,1); w2=zeros(clen,1); for cn=sc:ec, w1(2:2:clen)=0; w1(1:2:clen)=Ain(sr:RRM, cn); w2(1:2:clen)=0; w2(2:2:clen)=Ain((RRM+1):er, cn); Ain(sr:er, cn)=(mfilter(f0,w1)+mfilter(f1,w2)); endelse% disp(' horizontal synthesis....'); rlen=ec-sc+1; w1=zeros(1, rlen); w2=zeros(1, rlen); for rn=sr:er, w1(2:2:rlen)=0; w1(1:2:rlen)=Ain(rn, sc:CCM); w2(1:2:rlen)=0; w2(2:2:rlen)=Ain(rn, (CCM+1):ec); Ain(rn, sc:ec)=(mfilter(f0,w1)+mfilter(f1,w2)); endendA=Ain;return;%*---------------------------------function [y]=mfilter(B, x)len=length(x);y=zeros(1, len);[RN CN]=size(x);if CN==1, x=x';endflen=length(B);xe=[ fliplr(x(2:len)), x, fliplr( x(1:(len-1)))];dd=(flen-1)/2;yt=filter(B,1, xe);y=yt( (len+dd):(len+len-1+dd));if CN==1, y=y';endreturn;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -