View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Nonlinear Diffusion Toolbox

Join the 15-year community celebration.

Play games and win prizes!

» Learn more

4.6 | 33 ratings Rate this file 16 Downloads (last 30 days) File Size: 145 KB File ID: #3710 Version: 1.0

Nonlinear Diffusion Toolbox



10 Jul 2003 (Updated )

Set of functions to perform nonlinear diffusion on images.

| Watch this File

File Information

This toolbox has functions to perform nonlinear diffusion on images. This kind of image filtering is particularly useful for reducing noise and to simplify images for further segmentation. Much of these functions are based on Perona and Malick's work, and also on J. Weickert's papers. The fast AOS diffusion is implemented. There is also 3D diffusion functions, color image diffusion and Coherence-Enhancing diffusion


This file inspired Detail Preserving Anosotropic Diffusion For Speckle Filtering (Dpad) and Nonlinear Coupled Diffusion.

MATLAB release MATLAB 6.5 (R13)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (42)
26 Feb 2016 Hengfei Cui

Any one can write this function anidifstep(x, a, b, c) to 3D case. Thanks a lot!

Comment only
18 May 2014 Royi Avital

What about implementing the following method:

Comment only
20 Sep 2012 Cai

Cai (view profile)

Hi Frederico,

I am trying "nldif" function, and find that there are two options for diffusion: one is "AOS" by aosiso.m and the other is "iso" by isodifstep.
For "AOS", the result is good when I choose stepSize = 2; But for "iso", I cannot get good result for any stepSize (from 0.01 to 1...).
I want to know what value of stepSize for "iso" case can get the same result as "aos". I suppose "aos" and "iso" should get the same result when choose proper stepSize. The only different should be the speed. Is it correct?
And when I try to feed back from "aos" result to "iso" stepSize ( (aosiso(y, g, 2) - y)/dy ), but I can not get a uniform stepSize value.

Can you help me to explain above case?

code for feedback:
% Calculate dy/dt
%if aos
% if plotflux
% yo = y;
% end
% y = aosiso(y,g,stepsize(i)); % updating
% dy = isodifstep(y, g);
% y = y + stepsize(i) * dy; % updating
tmp = y;
tmp1 = aosiso(y, g, 2) - tmp;
dy = isodifstep(y, g);
ios_step = tmp1 / dy;


Comment only
24 Aug 2012 Royi Avital

I wish someone would implement "Fast Anisotropic Smoothing of Multi-Valued Images using Curvature-Preserving PDE’s"

By David Tschumperlé into this toolbox.

Comment only
15 Nov 2011 ray li

ray li (view profile)


28 Jan 2011 Ding Yuan

Hi Frederico,

I am translating your matlab code in to IDL, I find that in the convolution step ('gsderiv.m'), the gaussian kernel is not normalized. It is done in 1D 'kernel=kernel/sum(kernel)', however, it is important that you do it like this:
kernel = exp(-.5*(kernel_grid./sigma).^2)

then you do convolution

22 Dec 2010 Aadarsh Malviya

theres some problem in linear diffusion. I am getting colored images in nonlinear.

How can i reduce the diffusion and I am unable to undrstand the inputs takn can any one help me please

Comment only
18 Oct 2010 Xiuli À=

nice work!
but there is a tiny question, the function name of 3d nonlinear diffusion should be nldif3, not nldif, this maybe a typo.

Comment only
27 Sep 2010 mops zaki

there is bug in almost all file for example
Input argument "x" is undefined.
in fileaosiso at 16
y = zeros(size(x));

Input argument "x" is undefined.
in file aosiso1 at 16
y = zeros(size(x));
i cant under stand why these are are coming as im using the higher version of matlab. R14

Comment only
11 Aug 2010 Sun SHENG

It is really great helpful to those who are doing PDE image process. The author is also a good gentlman . He had helped me many times about the toolbox's function.

05 May 2009 Anil N

Anil N (view profile)

11 Sep 2008 Solaree Shi

It gave a great help in image segmentation for my further research.

28 Aug 2008 tg tg


Comment only
30 Apr 2008 NEgar Sani

no comments

21 Mar 2008 kavita Jagadal


Comment only
29 Jan 2008 Chris Coello

Really useful toolbox, working perfectly and intelligently coded. Thanks, a lot of time saved !!

09 Aug 2007 Zhiming Wang

Excellent work. Thank you!

16 Jul 2007 rasoul khayati

Your toolbox is good. But, let me know, how do you calculate Cm constant in nldif.m? your comment in head of this file is not sufficient. Please mail me any documentation about Cm. computation. thanks.

07 Apr 2007 jianfei ge

Good!Thank you!!!

21 Mar 2007 dileep kumar

Excellent was very useful for bigginer like me.All lines are well commented.
Thanks alot

06 Sep 2006 Changhua Wu

This toolkit is good. However I found a bug in cedif.m

I tried it on two images and each time it generates a divide-by-zero warning. I belive this two line cause the trouble:
line 158:
dd = ( c2_m_c1 .* s1_m_s2 )./(alfa);
line 161:
d12 = -(c2_m_c1).*s12./(alfa);

15 Aug 2006 Viton Vitanis

Thanks for sharing!

16 Jun 2006 soheil kya  
24 May 2006 Chao Wang

Thanks for sharing.

25 Apr 2006 Nat Anga

Great! Very well explained, very useful. Obtained very good results!!

05 Dec 2005 Matthias Schabel

Very nice work - almost trivial to use the code for my application.

04 Nov 2005 François Aspert

Very nice toolbox that save me a lot of time. With great demos and clear explanations.

01 Aug 2005 Francesco Brun

I may be wrong, but I think that in cedif.m at line 158 and 161 you have to divide by (alfa + eps) instead of (alfa). Anyway, you made a marvellous work. It would be great if you add Weickert's Edge Enhancing Anisotropic Diffusion too. I notice in documentation you put a reference to eedif.m but it's not included.

11 Mar 2005 Sharat Chikkerur

Just what I was looking for..Thanks!

20 Feb 2005 Ramesh Sen

That was very helpful.

01 Jul 2004 zhongchao shi

very valuable implementation of nonlinear diffusion filtering.

14 Jun 2004 Fredrick Mauser

Excellent and fast implementation of latest NL diffusion schemes. Particularly impressed with Coherence enhancing algorithm. Uses the optimal AOS technique. Very impressive work. Thank you for the contribution!

13 May 2004 Robert Schiessl

Good stuff. Implements fast, good algorithms for
nonlinear diffusion ... never saw something nearly as good!

29 Apr 2004 lin pan


22 Apr 2004 KISSI Adelaïde

A good toolbox.

22 Apr 2004 KISSI Adelaïde

A god toolbox.

12 Apr 2004 ali iskurt

Really wonderful,
I was trying to implement nonlinear diffusion filters based on transactions when I have seen this nonlinear diffusion filters' code , I caught the way how to do it .

07 Apr 2004 Simon Robidas

Wonderful toolbox. Great demos, useful comments. I especially like the nldif2demo. Saved me so much time!

25 Mar 2004 Michael Bach

This toolbox saved me a couple of days, probably weeks.
It is highly appreciated!

06 Dec 2003 Amin Charaniya

Very useful toolbox. Was wondering how much more work would it be to extend it to n-dim.

04 Dec 2003 Alessandro Tomasi

An excellent tool! It really helps to gain a better understanding of the processes involved. Fast execution, clear comments, useful diagrams, and working examples (demos) provided. What more do you want?

03 Dec 2003 Mylene Farias

Real nice demos.

11 Aug 2003

File updating due to bug reported by users

12 Aug 2003

File updating due to bug reported by users

Contact us