function lamb=estima_lambda(Imobservada,B,lambdas,M,F,Nbloques); Given an observed degraded image (given by 'K' and additive noise) , it regularizes using the a penalization operator F and reguilarization parameter 'lambdas'. N is the block size and M is the block size plus the boundary (in order to avoid boundary effects in the reconstruction. It gives back also the image blocks in order to perform the overlapping. i.e. N=16; M=44; Nlambdas=70; lambdas=logspace(-2,2,Nlambdas); operador=fft2(filt2dsegder,M,M); figure,lamb=estima_lambda(BlurredNoisy,PSF,lambdas,M,operador,Nbloques);
0001 % function lamb=estima_lambda(Imobservada,B,lambdas,M,F,Nbloques); 0002 % 0003 % 0004 % Given an observed degraded image (given by 'K' and additive noise) 0005 % , it regularizes using the a penalization operator F and reguilarization parameter 0006 % 'lambdas'. 0007 % N is the block size and M is the block size plus the boundary 0008 % (in order to avoid boundary effects in the reconstruction. 0009 % It gives back also the image blocks in order to perform the overlapping. 0010 % 0011 % i.e. 0012 % 0013 % N=16; 0014 % M=44; 0015 % Nlambdas=70; 0016 % lambdas=logspace(-2,2,Nlambdas); 0017 % operador=fft2(filt2dsegder,M,M); 0018 % 0019 % figure,lamb=estima_lambda(BlurredNoisy,PSF,lambdas,M,operador,Nbloques); 0020 % 0021 0022 function lamb=estima_lambda(Imobservada,B,lambdas,M,N,F,Nbloques); 0023 0024 [fil,col]=size(Imobservada); 0025 0026 a=(M-N)/2; 0027 0028 Im2=ampliaconborde(Imobservada,a); 0029 0030 filas = round(N/2 + rand(Nbloques,1)*(fil-N)); 0031 columnas = round(N/2 + rand(Nbloques,1)*(col-N)); 0032 0033 filas,columnas 0034 0035 lamb = 0; 0036 0037 for i=1:Nbloques 0038 0039 observado=Im2(filas(i)+a-M/2+1:filas(i)+a+M/2,columnas(i)+a-M/2+1:columnas(i)+a+M/2); 0040 0041 [sol,lambda]=restaura_block(observado,B,F,M,N,lambdas,2); 0042 0043 lamb = lamb + lambda; 0044 0045 end 0046 0047 lamb = lamb / Nbloques; 0048 0049