regu_naive

PURPOSE ^

function [objeto] = regu_naive(Imobservada,b,N,M);

SYNOPSIS ^

function [restaurada]=regu_naive(Imobservada,b,N,M);

DESCRIPTION ^

 function [objeto] = regu_naive(Imobservada,b,N,M);

   Given an observed degraded image (given by 'b' and additive noise)
   it regularizes using the pseudoinverse in the frequency domain.
   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;
      val = 0.1;

      figure,[Irest] = regu_naive(BlurredNoisy,PSF,N,M);

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % function [objeto] = regu_naive(Imobservada,b,N,M);
0002 %
0003 %   Given an observed degraded image (given by 'b' and additive noise)
0004 %   it regularizes using the pseudoinverse in the frequency domain.
0005 %   N is the block size and M is the block size plus the boundary
0006 %   (in order to avoid boundary effects in the reconstruction.
0007 %   It gives back also the image blocks in order to perform the overlapping.
0008 %
0009 %      i.e.
0010 %      N = 16;
0011 %      M = 44;
0012 %      val = 0.1;
0013 %
0014 %      figure,[Irest] = regu_naive(BlurredNoisy,PSF,N,M);
0015 
0016 function [restaurada]=regu_naive(Imobservada,b,N,M);
0017 
0018 [fil,col]=size(Imobservada);
0019 
0020 objeto=rand([fil,col]);
0021 
0022 nver = fil/N;
0023 nhor = col/N;
0024 
0025 objetoparaoverlapping = rand(nver*M,nhor*N);
0026 
0027 a=(M-N)/2;
0028 
0029 Im2=ampliaconborde(Imobservada,a);
0030 
0031 B=freqz2(b,M,M);
0032 
0033 B=ifftshift(B);
0034 
0035 BB = abs(B).^2;
0036 Bconj = conj(B);
0037 
0038 contadorfilas=1;
0039 
0040 for i=M/2:N:fil+a
0041    i
0042    contadorcolumnas=1;
0043    for j=M/2:N:col+a
0044 
0045       observado=Im2(i-M/2+1:i+M/2,j-M/2+1:j+M/2);
0046 
0047       cub=fft2(observado);
0048 
0049       Hinv=Bconj./BB;
0050 
0051       fftsol = Hinv.*cub;
0052 
0053       sol=real(ifft2(fftsol));
0054 
0055       solefectiva=sol(a+1:a+N,a+1:a+N);
0056 
0057       objeto(i-a-N/2+1:i-a+N/2,j-a-N/2+1:j-a+N/2)=solefectiva;
0058 
0059       objetoparaoverlapping((contadorfilas-1)*M+1:contadorfilas*M,(contadorcolumnas-1)*M+1:contadorcolumnas*M) = sol;
0060 
0061       contadorcolumnas=contadorcolumnas+1;
0062    end
0063    contadorfilas=contadorfilas+1;
0064 end
0065 
0066 restaurada = do_overlap(objetoparaoverlapping,M,N,4);
0067

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