Image denoising by solving a diffusion PDE using the FEM method
www.cs.ualberta.ca/~kpopuri/assign4/image_diffusion.pdf
Karteek Popuri and Martin Jägersand
Please take a look at the ``helper code'' for this assignment at:
www.cs.ualberta.ca/~kpopuri/assign4/helper_code
Helper code
A digital image is a collection of pixels arranged in a rectangular two
dimensional (2D) array. For a gray-scale (black and white) image, we obtain a scalar
intensity value at each of the pixel locations. These intensity values are usually quantized
between 0
and
. Hence, a digital image corresponds to a matrix of discrete values
in the range of
. For example, see Figure 1.
Figure:
A digital image is essentially a matrix of integers in
.
|
Images captured of the real world objects (scenes) are prone to random fluctuations in
the observed intensity values. This variation in the intensity values is refered to as
image noise. It is an unavoidable by-product of the image capture process and it
predominantly arises from the sensor and circuity of the digital camera. Figure
2 shows a noisy image.
Figure 2:
(left) The ``office'' image WITHOUT noise. (Right) The ``office'' image
corrupted WITH noise.
|
The process of removing noise from an image is known as noise reduction or denoising.
A standard denoising technique is the convolution (see section 5.1 for an explanation) of the image with a 2D Gaussian
distribution. The zero mean 2D Gaussian distribution function is given in Figure 3:
Figure 3:
A zero mean 2D Gaussian with
.
|
In practice as the image contains discrete pixel locations, the Gaussian distribution needs to
be approximated using a convolution kernel before the convolution operation can be
performed. Figure 4 shows a 2D Gaussian convolution kernel.
Figure 4:
The
convolution kernel of a Gaussian with
.
|
As described in section 5.1, the Gaussian convolution operation basically replaces the
intensity values of the pixels in the original noisy image with a weighted average of the
intensity values of the pixels in their respective neighborhoods (defined by the size of
the kernel). Thus, the Gaussian smoothing technique incorporates the intensity information
from the neighboring pixels to reduce noise in the image. In fact, the idea of using neighborhood
pixel intensity information for noise reduction is at the core of image denoising
techniques in general.
Gaussian smoothing can be performed very easily using MATLAB as follows:
I = imread('office_noisy.png'); %load the noisy image
h = fspecial('gaussian',[3*ceil(sigma) 3*ceil(sigma)],sigma);
%create the 3\sigma X
%3\sigma Gaussian kernel with \sigma = 1
I_smooth = imfilter(I,h); %perform Gaussian smoothing
figure; %display the images
subplot(1,2,1);imshow(I,[]);title('Noisy image');
subplot(1,2,2);imshow(I_smooth,[]);title('Smooth image')
- Question 0
:
- Setting the parameter
respectively perform Gaussian smoothing on the input noisy ``office'' image. Looking at the
sequence of output images corresponding to the increasing
values answer the following:
-
- How does the increase in parameter
effect the noise reduction
performance of Gaussian smoothing ? What happens to the edges (discontinuities) and other details in the
image with the increase of
?
-
- Now can you guess why denoising by a Gaussian kernel is also
called Gaussian smoothing (or in general denoising is also refered to as smoothing)?
In this problem, we consider a linear isotropic diffusion process (see section 5.2
for notes on diffusion) on an image domain for the task of denoising. The linear isotropic diffusion process can be described by:
where
is a scalar constant diffusivity,
is the initial noisy image,
is the image obtained after a diffusion time
. Note that here
represents the evolving intensity distribution corresponding to the evolving concentration distribution
in section 5.2.
- Question 1
- Using the MATLAB PDE toolbox solve the diffusion PDE in equation 1 by
the FEM method. Your initial condition is the noisy ``office'' image. Choose
. Report the
output images obtained after a diffusion time
. What type of
boundary conditions should you choose here ?
Note: You should use a sufficiently refined mesh so as to avoid any ``triangular'' artifacts in the
output image.
Now looking at the sequence of output images obtained from the above answer the following:
-
- Are the output images less noisy (``smoother'') than the
input image ? In other words, is the diffusion process really performing noise
reduction on the input image ?
-
- If your answer is yes to the above question, what is the
effect of diffusion time on denoising ? What happens to the edges (discontinuities)
and other details in the with increase in diffusion time ?
- Question 2
- Now solve the diffusion PDE in equation 1 using
and compare the output images at
. What is the effect of
on
deniosing ?
- Question 3
- It can be proved that a unique solution exists for the PDE in equation
1 which is given by:
 |
(2) |
where
is the Gaussian kernel. This proves that performing isotropic linear
diffusion for a time
with
is exactly equivalent to performing Gaussian smoothing with a
. Verify this fact using the noisy ``office'' image.
In this problem, we consider a non-linear isotropic diffusion process (see section 5.2
for notes on diffusion) on an image domain for the task of denoising. The non-linear isotropic diffusion process can be described by:
Here,
is not a constant but varies across the image domain. A popular choice is
the Perona-Malik diffusivity which is given as :
where
is the contrast parameter.
is the gradient of the image at
pixel
- Question 4
- Using the MATLAB PDE toolbox solve the diffusion PDE in equation
3 by the FEM method. Your initial condition is the noisy ``office''
image. Report the output images obtained after a diffusion time
. Use
. What type of boundary conditions should you choose here ?
Note: You should use a sufficiently refined mesh so as to avoid any ``triangular'' artifacts in the
output image.
Now looking at the sequence of output images obtained from the above answer the following:
-
- Are the output images less noisy (``smoother'') than the
input image ? In other words, is the diffusion process really performing noise
reduction on the input image ?
-
- If your answer is yes to the above question, what is the
effect of diffusion time on denoising ? What happens to the edges (discontinuities)
and other details in the with increase in diffusion time ?
-
- Non-linear diffusion with a diffusivity like the
Perona-Malik diffusivity is called ``edge-preserving'' diffusion. This is because the
value of the Perona-Malik diffusivity is low in the presence of edges, i.e. when
is large
is small (see 4). For
, compute the diffusivity
on the ``office'' image WITHOUT noise in Figure
2 and visualize the diffusivity as a gray-scale image. What do
you observe in this diffusivity ``image'' ?
-
- Compare the edges
in the output images obtained from non-linear diffusion with the corresponding
output images obtained from linear diffusion in the previous problem. In which of the
images are the edges better preserved ?
- Question 5
- Now solve the diffusion PDE in equation 1 using
and compare the output images at
. What is the effect of the
contrast parameter
on deniosing and edge preservation ?
(While preparing this assignment, I refered to Dr.Weickert`s notes from the course
Differential equations in Image processing and Computer vision [1]. You can
access the relevant lectures from here www.cs.ualberta.ca/~kpopuri/dic/.
Convolution
Figure 5:
The convolution of a
image with a
kernel.
|
In the convolution operation illustrated in Figure 5, the intensity value
at the pixel
in the convolved image is computed as follows:
Similarly, the intensity values
,
,
are computed as:
In general, given a kernel of size
and an image of size
, the intensity value
at the pixel
in the convolved image is given by:
Hence, the basic idea of the convolution operation is to replace the intensity value at
a particular pixel by a weighted average of all the pixels in its
neighborhood.
Notes on Diffusion
Diffusion is the flow of molecules (mass) from a place of high concentration to a place of
low concentration. Some examples of diffusion are: diffusion of perfume molecules
from one part of the room to the other when a bottle of perfume is opened, the diffusion
of tea molecules into the surrounding water when a tea bag is inserted into a cup of
water. Diffusion processes strive to equilibrate the concentration differences in the
system whilst preserving the total mass of the system.
Fick`s law of diffusion relates the diffusive flux to the concentration gradient:
where
is the diffusive flux,
is the concentration and
is the
diffusivity. The diffusivity
is a scalar in the case of isotropic diffusion
(considered in this assignment) and it is a matrix in the case of anisotropic diffusion.
The principle of conservation of mass states that:
Combining the above two equations we obtain a the diffusion PDE:
In the case of isotropic diffusion we have following two cases:
- Linear diffusion
is a constant, i.e.
, a scalar constant for all
in the problem domain.
- Non-Linear diffusion
-
is scalar but varies over the problem domain.
- 1
-
Dr. Joachim Weickert.
Differential equtions in image processing and computer vision,
lecture notes apr-aug, 2009.
http://www.mia.uni-saarland.de/Teaching/dic09.shtml.
Image denoising by solving a diffusion PDE using the FEM method
www.cs.ualberta.ca/~kpopuri/assign4/image_diffusion.pdf
This document was generated using the
LaTeX2HTML translator Version 2002-2-1 (1.71)
Copyright © 1993, 1994, 1995, 1996,
Nikos Drakos,
Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999,
Ross Moore,
Mathematics Department, Macquarie University, Sydney.
The command line arguments were:
latex2html -split 0 image_diffusion
The translation was initiated by Karteek Popuri on 2010-04-08
Karteek Popuri
2010-04-08