IIMDPCM invierts the image codification given by IMDPCM each pixel given a lineal combination of the neighbours (in a neighbouthood of N^2 size). / N \ est(I([i,j]))= round | sum w(d)*I([i,j]-d) | \ d=1 / It gives back the prediction error for each point: e([i,j])=I(i,j)-est(I([i,j])) Given this error, the original signal can be reconstructed using IIMDPCM USE: I=iimdpcm(e,[w(1) w(2) w(3)...],valor_relleno);
0001 % IIMDPCM invierts the image codification given by IMDPCM 0002 % each pixel given a lineal combination of the neighbours 0003 % (in a neighbouthood of N^2 size). 0004 % 0005 % / N \ 0006 % est(I([i,j]))= round | sum w(d)*I([i,j]-d) | 0007 % \ d=1 / 0008 % 0009 % It gives back the prediction error for each point: 0010 % 0011 % e([i,j])=I(i,j)-est(I([i,j])) 0012 % 0013 % Given this error, the original signal can be reconstructed using IIMDPCM 0014 % 0015 % USE: I=iimdpcm(e,[w(1) w(2) w(3)...],valor_relleno); 0016 0017 function I=iimdpcm(e,w,valor_relleno) 0018 0019 l=length(w); 0020 s=size(e); 0021 a=valor_relleno*ones(l,s(2)+2*l); 0022 i=valor_relleno*ones(s(1),l); 0023 d=valor_relleno*ones(s(1),l); 0024 b=valor_relleno*ones(l,s(2)+2*l); 0025 e=[a;i e d;b]; 0026 estI=e; 0027 I=valor_relleno*ones(s(1)+2*l,s(2)+2*l); 0028 0029 W=simrev([w(1) w]); 0030 W(1,1)=0; 0031 W=rot90(W,2); 0032 W=W/sum(sum(W)); 0033 0034 for i=l+1:s(1)+l 0035 0036 for j=l+1:s(2)+l 0037 bloc=I(i-l:i,j-l:j); 0038 estI(i,j)=round(sum(sum(W.*bloc))); 0039 I(i,j)=estI(i,j)+e(i,j); 0040 end 0041 end 0042 I=sacasub(I,[s(1)/2+l s(2)/2+l],[s(1) s(2)],0);