Soft_B_denois_4_numeric

PURPOSE ^

It 'cleans' an image using bayesian formulation with laplacian prior

SYNOPSIS ^

function [IMM,S,P]=Soft_B_denois_4_numeric(Im2,Var)

DESCRIPTION ^

 It 'cleans' an image using bayesian formulation with laplacian prior
 as explained in Simoncelli '99.
 "Bayesian denoising of visual images in the wavelet domain."

 USE: [IMM,S,P]=Soft_B_denois_4_numeric(Im2,Var)

 INPUTS
 Im2 = noisy image;
 Var = noise variance

 OUTPUT
 IMM es la imagen limpiada;
 S and P are the estimated values that define the prior distributions
 for each wavelet scale

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % It 'cleans' an image using bayesian formulation with laplacian prior
0002 % as explained in Simoncelli '99.
0003 % "Bayesian denoising of visual images in the wavelet domain."
0004 %
0005 % USE: [IMM,S,P]=Soft_B_denois_4_numeric(Im2,Var)
0006 %
0007 % INPUTS
0008 % Im2 = noisy image;
0009 % Var = noise variance
0010 %
0011 % OUTPUT
0012 % IMM es la imagen limpiada;
0013 % S and P are the estimated values that define the prior distributions
0014 % for each wavelet scale
0015 
0016 function [IMM,S,P]=Soft_B_denois_4_numeric(Im2,Var)
0017 
0018 S=[]
0019 ImDeg = Im2;
0020 desviacion=sqrt(Var);
0021 NW=4;
0022 [pyrDeg,indDeg]=buildwpyr(double(ImDeg),NW);
0023 
0024 orientaciones=cell(3,1);
0025 
0026 orientaciones{1}='H';
0027 orientaciones{2}='V';
0028 orientaciones{3}='D';
0029 
0030 estimado=zeros(size(pyrDeg));
0031 
0032 cont=1;
0033 
0034 for escala=1:NW
0035     escala
0036     for ori=1:3
0037         orientacion=orientaciones{ori}
0038 
0039         switch lower(orientacion)
0040             case 'h'
0041                 sub=1;
0042             case 'v'
0043                 sub=2;
0044             case 'd'
0045                 sub=3;
0046         end
0047 
0048         [histograma,valores,subbanda,subbandacrop]=marginal_2(Im2,escala,orientacion,256);
0049         QQ=1
0050         for s=logspace(-1,2,25)
0051             for p=linspace(0.35,1.45,25)
0052                 l=likelihooddegradedaB([s p],subbanda,Var);
0053                 MM(1,QQ)=s;
0054                 MM(2,QQ)=p;
0055                 MM(3,QQ)=l;
0056                 escala
0057                 QQ=QQ+1
0058             end
0059         end
0060         [MN,IN]=min(MM(3,:));
0061         S(escala,ori)=MM(1,IN);
0062         P(escala,ori)=MM(2,IN);
0063 
0064         pyrsubDeg = wpyrBand(pyrDeg, indDeg, escala, sub);
0065         pyrsubDeg = pyrsubDeg(:);
0066 
0067         lookup = [];
0068 
0069         pasox=0.5;
0070         rango = [round(min(pyrsubDeg))-30:pasox:round(max(pyrsubDeg))+30];
0071         num2=[];den2=[];
0072         for valor=rango
0073             num = sum(pasox.*blsnum(rango,valor,S(escala,ori),P(escala,ori),desviacion));
0074             denom = sum(pasox.*blsdenom(rango,valor,S(escala,ori),P(escala,ori),desviacion));
0075             num2=[num2 num];
0076             den2=[den2 denom];
0077             lookup = [lookup num/denom];
0078         end
0079 
0080         for indice=1:length(pyrsubDeg)
0081             estimado(cont) = interp1(rango,lookup,pyrsubDeg(indice));
0082             cont=cont+1;
0083         end
0084 
0085     end
0086 end
0087 
0088 estimado(cont:end) = pyrDeg(cont:end);
0089 
0090 IMM=reconWpyr(estimado,indDeg);
0091

Generated on Fri 07-Mar-2014 13:28:33 by m2html © 2005