MATLAB Examples

Remove noise from image with INLA

The 'peppers' image is corrupted with Gaussian additive noise with and cleaned using INLA.

Note that INLA is called through R, so this example file cannot produce the shown output by itself. To obtain INLA follow the installation instructions on http://www.r-inla.org Note that you need a version of INLA that supports a user defined offset for in the stochastic volatility model (the testing version at the time of writing).

Contents

Load image

X = imread('peppers.png');
I = im2double( X );

imshow(I)

dwtmode('per', 'nodisp');
wavelet = 'db4';

Generate noisy image

noise_dev = 0.1;
J = I + noise_dev*randn(size(I));

imshow(J)

[C, S] = wavedec2( J, 3, wavelet );
noisy_tree = dwt2_to_cell( C, S );

fprintf('PSNR, noisy image: %f\n', psnr(I, J));
PSNR, noisy image: 19.040317

Using INLA...

Exporting the noisy wavelet coefficients to a text file that R/INLA reads and processes.

If you want to do this yourself, run the following command in R: source("noise_removal.R")

If you do not want to do this, the output ".." is in the current folder and you can continue.

The cleaned image