Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1
A Numerical Tour of Signal Processing_ Image Denoising With Linear Methods

A Numerical Tour of Signal Processing_ Image Denoising With Linear Methods

Ratings: (0)|Views: 43|Likes:
Published by Nazeer Saadi
good book
good book

More info:

Published by: Nazeer Saadi on Aug 06, 2013
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less





A Numerical Tour of Signal Processing: Image Denoising with Linear Methods - File Exchange - MATLAB Centralhttp://www.mathworks.com/matlabcentral/fileexchange/9554-a-numerical-tour-of-signal-processing/content/numerical-tour/denoising_linear/index.html[7/29/2013 7:31:52 PM]
Search:File Exchange Create Account Log In
Highlights from
[p,ellipse]=phantom(varar...PHANTOM Generate a headphantom image.b=dct(a,n)DCT Discrete cosine transform.b=dct2(arg1,mrows,ncols)DCT2 Compute 2-D discrete cosinetransform.cat3(d, a,b)cat3 - synonymous with catcconv(x,h,d)cconv - spatial domain circularconvolutioncell_add(A,B,a,b)cell_add - add two cell arrayscell_get(x,i)cell_get - get valuecell_set(x,i,v)cell_set - assign valuecell_sub(x,sel)cell_sub - extract a sub-cell arrayclamp(x,a,b)compute_conditional_histo...compute_conditional_histogram -compute conditional histogramscompute_entropy(M,T)compute_entropy - compute theentropy of a signalcompute_gaussian_filter(n...compute_gaussian_filter - computea 1D or 2D Gaussian filter.compute_histogram(M, opti...compute_histogram - compute the(symmetric) histogram of a vectorafter threshold.compute_hufftree(p)compute_hufftree - build a huffmantreecompute_l2err(MF, donorma...compute_l2err - non linearapproximation errorcompute_max(X,d)compute_max - compute maximumalong dimension dcompute_min(X,d)compute_min - compute min alongdimension dcompute_quadsel(j,q, opti...compute_quadsel - compute theindices for selecting subband of awavelet transform.compute_shape_boundary(M)compute_shape_boundary - extractboundary points of a shapecompute_total_variation(y...compute_total_variation - computethe total variation of an imagecompute_wavelet_filter(Ty...compute_wavelet_filter - GenerateOrthonormal QMF Filter forWavelet Transformcrop(M,n,c)crop - crop an image to reduce itssizedet3(A)det3 - 3x3 determinantdiv(Px,Py, options)div - divergence operatorextend_stack_size(mult)does nothinggamrnd(a,b,m,n);GAMRND Random matrices fromDownload SubmissionCode covered by theBSD License from
byGabriel Peyre A set of Matlab experiments that illustrates advancedcomputational signal and image processing.
Image Denoising with Linear Methods
Installing toolboxes and setting up the path.Noise in Signal and Image
 This numerical tour introduces some basics about image denoising. You need to download thegeneral purpose toolbox and thesignal toolbox.  You need to unzip these toolboxes in your working directory, so that you have
inyour directory.
For Scilab user:
you must replace the Matlab comment '%' by its Scilab counterpart '//'.
You should create a text file named for instance
(in Scilab) or
(in Matlab) to write all the Scilab/Matlab commands you want to execute. Then, simply run
(in Scilab) or
(in Matlab) to run the commands.Execute this line only if you are using Matlab.
getd =@(p)path(path,p);%scilab users must *not* execute this
 Then you can add these toolboxes to the path.
%Add some directories to the pathgetd('toolbox_signal/');getd('toolbox_general/');
In these numerical tour, we simulate noisy acquisition by adding some white noise (each pixel is corrupted by adding anindependant Gaussian variable). This is helpful since we know the original, clean, image, and can test and compare severalalgorihtms by computing the recovery error.We load a signal.
name ='piece-regular';n =1024;x0 =load_signal(name,n);x0 =rescale(x0);
We add some noise to it.
sigma =.04;%noise levelx =x0 +sigma*randn(size(x0));clf;subplot(2,1,1);plot(x0); axis([1 n -.05 1.05]);subplot(2,1,2);plot(x); axis([1 n -.05 1.05]);
File Exchange
A Numerical Tour of Signal Processing: Image Denoising with Linear Methods - File Exchange - MATLAB Centralhttp://www.mathworks.com/matlabcentral/fileexchange/9554-a-numerical-tour-of-signal-processing/content/numerical-tour/denoising_linear/index.html[7/29/2013 7:31:52 PM]
gamma distribution.getoptions(options, name,...getoptions - retrieve optionsparametergrad(M, options)grad - gradient, forward differenceshuffman_gencode(T)huffman_gencode - generate acode associated to a Hufmann tree Tidct(b,n)IDCT Inverse discrete cosinetransform.idct2(arg1,mrows,ncols)IDCT2 Compute 2-D inversediscrete cosine transform.image_resize(M,p1,q1,r1)image_resize - resize an imageusing bicubic interpolationimageplot(M,str, a,b,c)imageplot - diplay an image and atitleiradon(varargin)IRADON Compute inverse Radontransform.load_image(type, n, optio...load_image - load benchmarkimages.load_signal(name, n, opti...load_signal - load a 1D signalload_sound(name, n0, opti...mad(x,flag)MAD Mean/median absolutedeviation.make_sparse(i,j,x)make_sparse - synonymous withsparse(i,j,x)max3(x,v)max3 - synonymouse with maxnb_dims(x)nb_dims - debugged version of ndims.peform_wiener_filtering(x...peform_wiener_filtering - performWiener filteringperform_arith_coding(xC, ...perform_arithmetic_coding_slow -perform adaptive arithmetic codingperform_arith_fixed(x, h, n)perform_arith_fixed - arithmeticcodingperform_blurring(M, sigma...perform_blurring - gaussian blursan imageperform_cg(A,y,options)perform_convolution(x,h, ...perform_convolution - computeconvolution with centered filter.perform_faces_reorientati...perform_faces_reorientation -reorient the faces with respect tothe center of the meshperform_haar_transf(f, Jm...perform_haar_transf - peform fastHaar transformperform_hist_eq(x,y,options)perform_histogram_equalization -perform histogram equalizationperform_homotopy(D,y,opti...perform_homotopy - compute theL1 regularization pathperform_huffcoding(x,T,dir)perform_huffcoding - performhuffman codingperform_median_filtering(...perform_median_filtering - performmoving average medianperform_omp(D,Y,options)
Linear Signal Denoising
We load an image.
name ='boat';n =256;M0 =load_image(name,n);M0 =rescale( M0, .05, .95 );
 Then we add some gaussian noise to it.
sigma =.08;%noise levelM=M0 +sigma*randn(size(M0));clf;imageplot(M0,'Original', 1,2,1);imageplot(clamp(M),'Noisy', 1,2,2);
A translation invariant linear denoising is necessarely a convolution with a kernel
. It correspond to a linear diagonal operationover the Fourier domain that multiply each noisy Fourier coefficient by the Fourier transform of 
.In practice, one uses a Gaussian fitler
, and the only parameter is the width (variance) of the filter.
%width of the filtermu =4;%compute a Gaussian filter of width mut =(-length(x)/2:length(x)/2-1)';h =exp( -(t.^2)/(2*mu^2) );h =h/sum(h(:));
 The Fourier transform of a Gaussian discrete filter is nearly a Gaussian whose width is proportional to
%Fourier transformof the (centered) filterhf =real( fft(fftshift(h)) );hf =fftshift(hf);%displayclf;subplot(2,1,1);plot( t,h ); axis('tight');title('Filter h');
A Numerical Tour of Signal Processing: Image Denoising with Linear Methods - File Exchange - MATLAB Centralhttp://www.mathworks.com/matlabcentral/fileexchange/9554-a-numerical-tour-of-signal-processing/content/numerical-tour/denoising_linear/index.html[7/29/2013 7:31:52 PM]
perform_omp - perform orthogonalmatching pursuitperform_saturation(x,tau,...perform_saturation - saturate avector for better contrastperform_stft(x, w,q, opti...perform_stft - compute a localFourier transformperform_tensor_decomp(T,o...perform_tensor_decomp - performan eigendecomposition.perform_tensor_recomp(e1,...perform_tensor_recomp - createthe tensor field corresponding tothe given eigendecomposition.perform_thresholding(x, t...perform_thresholding - performhard or soft thresholdingperform_tv_denoising(x,op...perform_tv_denoising - denoisingwith TV minimizationperform_wavelet_transf(x,...perform_wavelet_transf - peformfast lifting transformperform_wavortho_transf(f...perform_wavortho_transf - computeorthogonal wavelet transformplot_dictionnary(D,X,nb, ...plot_dictionnary - display adictionary of imagesplot_hufftree(T,p)plot_hufftree - plot a huffman treeplot_levelset(M,t,A)plot_levelset - display the level setof an imageplot_sparse_diracs(x, opt...plot_sparse_diracs - plot sparsesets of diracsplot_spectrogram(S,f, opt...plot_spectrogram - display thespectrogramplot_vf(vf, M, options)plot_vf - plot a vector field withplot_wavelet(M, Jmin, opt...plot_wavelet - plot 2D wavelettransform stored using Mallat'sordering.poissrnd(lambda,m,n)POISSRND Random matrices fromPoisson distribution.progressbar(n,N,w)progressbar - display a progressbarpsnr(x,y, vmax)psnr - compute the Peack Signal toNoise Ratior=binornd(n,p,mm,nn)BINORND Random matrices from abinomial distribution.radon(IMG, THETA) This MATLAB function takes animage matrix and vector of anglesand thenrand_discr(p, m)rand_discr - discrete randomgeneratorread_bin(name,options)read_bin - read bin filerescale(x,a,b)reverse(x)flip a vectorset_axis(v)set_axis - draw axis on/off set_colormap(a)set_colormap - set colors fordisplayset_graphic_sizes(h,fs,lw)set_graphic_sizes - enlarge thesize of the fontsset_label(xstr,ystr,zstr)set_label - set the label for a plotset_linewidth(h,lw)set_rand_seeds(a,b)set_rand_seeds - initialize randand randnsnr(x,y)snr - signal to noise ratiosubsampling(x,d,p)
subplot(2,1,2);plot( t,hf ); axis('tight');title('Fourier transform');
Since we use periodic boundary condition, the convolution of 
can be computer over the Fourier domain.
%Fourier coefficients of the noisy signalxf =fft(x);%Fourier coefficients of the denoised signalxhf =xf .* fft(fftshift(h));%Denoised signalxh =real( ifft(xhf) );
We display the denoised signal. Although most of the noise is removed, the singularity have been blurred.
clf;subplot(2,1,1);plot( t,x ); axis('tight');title('Noisy');subplot(2,1,2);plot( t,xh ); axis('tight');title('Denoised');
We display the noisy and denoised Fourier coefficients. One can see that the denoising remove the high frequency coefficients.
%log of Fourier transformsepsilon =1e-10;L0 =log10(epsilon+abs(fftshift(fft(x0))));L =log10(epsilon+abs(fftshift(xf)));Lh =log10(epsilon+abs(fftshift(xhf)));%display Fourier transformsclf;subplot(2,1,1);plot( t, L,'-');axis([-length(x)/2 length(x)/2 -4 max(L)]);title('log of noisy Fourier coefs.');subplot(2,1,2);plot( t, Lh,'-');axis([-length(x)/2 length(x)/2 -4 max(L)]);title('log of denoised Fourier coefs.');

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->