Stochastic Image Denoising

Noisy input

Denoised result

Noisy input

Denoised result

This page contains our implementation of the Stochastic Image Denoising algorithm desceibed in

UPDATE: We have generated an up-to-date benchmark including feedback received from all our reviewers. The updated benchmark expands and supercedes the results presented in the BMVC paper below. Note that under the new benchmark the Block Matching method shows the best performance of all tested algorithms. Please visit the benchmark page here.

F. Estrada, D. Fleet, and A. Jepson, “Stochastic Image Denoising, British Machine Vision Conference , London 2009.

Large versions of all the figures in the paper are here. A brief overview of the method is given here.

Software Distribution

Stochastic Image Denoising v1.0 (.tgz)

The file above contains executable files for Linux 32 and 64 bits, as well as Windows 32bit. Please download and extract all files to a local directory. Once expanded you will find:

The i386 and ia64 files are for use in Linux 32 and 64 bit respectively, the .exe files are Win32 executables. The versions labeled 'standalone' are meant for console use. They take as input an image in .ppm format, and output a denoised image also in .ppm format.

Please note that the code expects a properly formatted .ppm header. A sample of a properly formatted header is shown below:


# CREATOR: The GIMP's PNM Filter Version 1.0

1280 960


The top line contains the .ppm file identifier 'P6', this is followed by one or more lines of comments preceded by '#'. The next two lines contain the image resolution (x, y), and the maximum value of pixels within the image (typically 255). This is followed by raw binary data for the image (in the case above, 1280x960x3 bytes of RGB pixel colour data). If you're having problems running the software, please check that your images have the proper format. The GIMP image editor produces correctly formatted .ppm files.

A call to the standalone version shows:

USAGE: stochastic_denoise input_name sigma thresh Npaths output_name

input_name - Name of input image in .ppm format

sigma - Standard deviation of noise process (less than 1.0)

larger sigma means stronger denoising but may also

reduce details in textured regions or across soft


thresh - Stopping threshold, losely controls length of random walks

values from .0000001 to .01 give useful results, smaller

values give stronger denoising, but increase runtime

Npaths - Number of trials to run per pixel. Values larger than 10

give stable estimates, increasing Npaths linearly increases

runtime. Values larger than 50 yield no visible improvement

on most images.

output_name - Name of the output file (also in .ppm format).

The other executable files are not for console use, instead, they are meant to be called by a suitable Matlab script. You will need to edit the stochastic_denoise.m script to select the appropriate platform and version of the software. The 'fast' version should work well in most instances, but note that the increased speed comes at the cost of increased memory usage. If you run into out-of-memory problems or you notice that your system is paging from virtual storage, please use the standard version (slower but with a much smaller memory footprint).

The use of stochastic_denoise.m is very similar to that of the standalone denoising executable:

%% function [imD1]=stochastic_denoise(im,sigma,thresh,npaths,NN)


%% Input:


%% im - An input RGB image (for grayscale images, replicate

%% the brightness plane)

%% sigma - Standard deviation of the noise process (less than 1)

%% the larger the value, the stronger the denoising,

%% but also the more likely that texture and soft

%% boundaries will be blurred.

%% thresh - Stopping threshold for random walks. Values from

%% .000001 to .001 yield good results, the smaller

%% the value, the longer the random walks (and

%% usually this yields better results). However

%% using smaller values increases runtime.

%% npaths - Number of trials per pixel, the more trials the

%% more accurate the final estimate of the pixel

%% colour. Values as small as 10 yield stable

%% estimates, while values larger than 50 don't

%% generally produce further improvement.

%% Runtime increases linearly with this value.

%% NN - An integer used to distinguish the temp. files

%% created by this script. Useful when running several

%% instances on the same machine, give each instance

%% a different value, otherwise they will overwrite

%% each other's temp. files.


%% Return values:


%% imD1 - A denoised RGB image with values in [0 1]


Notes: The Linux versions of the code are noticeably faster than the Windows build, tests reported in the paper were carried out using the Linux 64bit version of the code through the matlab interface. You will also obtain slightly different results using the Windows version due to the use of a different random number generator.

Test Data

Please refer to our updated image denoising benchmark found here.

For evaluation purposes, we used the Structured Image Similarity Index (SSIM) by Wang et al., their implementation can be found here.

About this distribution

Software (c) 2009 F. Estrada, D. Fleet, A. Jepson.

This software can be freely copied and distributed for personal or academic use. For any commercial use please contact the authors. For problems with the software or bugs, feel free to email the author at festrada [you-know-what] utsc [little dot] utoronto [little dot] ca. I will take a look at any messages received, though it may take some time to update the software.


Despite our best efforts a small error exists in the version of the paper submitted to the BMVC proceedings. In Fig. 1, the caption states that the variance of the plot is in gray-levels. This is incorrect. The variance is in percent brightness, in the plot a value of .01 corresponds to a 1% variation, equivalent to 2.56 gray-levels. The caption is corrected in the version of the paper linked-to from this page. My bad! F.E. Aug. 2009.