File Exchange

## Nonlinear Diffusion Toolbox

version 1.0.0.0 (145 KB) by
Set of functions to perform nonlinear diffusion on images.

Updated 26 Mar 2004

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

### Cite As

Frederico D'Almeida (2021). Nonlinear Diffusion Toolbox (https://www.mathworks.com/matlabcentral/fileexchange/3710-nonlinear-diffusion-toolbox), MATLAB Central File Exchange. Retrieved .

Braiki Marwa

Hello, can any one explain : cedif.m at line 143 and 144:

% Diffusion tensor autovalues
c1 = gamma;
c2 = gamma + (1-gamma)*exp(-Cm./ ( (alfa+eps)./lambda(i) ).^m );
Because normally the equation is

c2 = / gamma+(1-gamma)*exp(-lambda/(mi1-mi2)^m ) , mi ~= mi2
% \ gamma

Thanks a lot!

Braiki Marwa

It would be great if you add Weickert's Edge Enhancing Anisotropic Diffusion

hello, how can I check if this code work or not ?!

amin ta

wonderfull!!
just one error in demos
replace Title with title.

NICE JOB

Pham Hung

great work!

Stone

Thank you very much

Hengfei Cui

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

Royi Avital

What about implementing the following method:

https://github.com/JarnoRalli/PDE-based-image-processing/issues/1

Cai

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
%else
% dy = isodifstep(y, g);
% y = y + stepsize(i) * dy; % updating
%end
tmp = y;
tmp1 = aosiso(y, g, 2) - tmp;
dy = isodifstep(y, g);
ios_step = tmp1 / dy;
=======

Thanks

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.

ray li

good,thanks.

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_grid=meshgrid(kernel_index,kernel_index)
kernel = exp(-.5*(kernel_grid./sigma).^2)
kernel=kernel/sum(kernel)

then you do convolution

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 aadarshmalviya@gmail.com

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.

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

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.

Anil N

Solaree Shi

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

tg tg

good

NEgar Sani

good

Chris Coello

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

Zhiming Wang

Excellent work. Thank you!

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.

jianfei ge

Good!Thank you!!!

dileep kumar

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

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);

Viton Vitanis

Thanks for sharing!

soheil kya

Chao Wang

Thanks for sharing.

Nat Anga

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

Matthias Schabel

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

François Aspert

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

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.

Sharat Chikkerur

Just what I was looking for..Thanks!

Ramesh Sen

zhongchao shi

very valuable implementation of nonlinear diffusion filtering.

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!

Robert Schiessl

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

lin pan

good

A good toolbox.

A god toolbox.

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 .

Simon Robidas

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

Michael Bach

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

Amin Charaniya

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

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?

Mylene Farias

Real nice demos.

##### MATLAB Release Compatibility
Created with R13
Compatible with any release
##### Platform Compatibility
Windows macOS Linux