Bayesian Networks for Edge Preserving Salt and Pepper Image Denoising

reverandrunΤεχνίτη Νοημοσύνη και Ρομποτική

7 Νοε 2013 (πριν από 3 χρόνια και 5 μήνες)

103 εμφανίσεις

Bayesian Networks for Edge Preserving Salt and Pepper
Image Denoising
A.Faro,D.Giordano,G.Scarciofalo and C.Spampinato
Department of Informatics and Telecommunication Engineering
University of Catania - Viale Andrea Doria,6 - 95125 - Catania
Abstract—In this paper we propose a two-step filter for
removing salt-and-pepper impulse noise.In the first phase,a
Naive Bayesian Network is used to identify pixels,which are likely
to be contaminated by noise (noise candidates).In the second
phase,the noisy pixels are restored accrding to a regularization
method (based on the optimization of a convex functional) to
apply only to those selected noise candidates.The proposed
method shows a significant improvement compared to other non
linear filters or regularization methods in terms of image details
preservation and noise reduction.Our algorithm is also able to
remove salt-and-pepper-noise with high noise levels since 70%
until 90%.
Keywords—Impulse noise,Naive Bayesian Networks,edge-
preserving regularization.
In the last decades,the image-processing field became
more interesting,sustained by the continuous improvements
in electrical and computer engineering.The increasing of the
computing (processing) power has allowed the researchers
to extend the number of applications in this field.As is
known,a typical image machine vision system consists of
three linked building blocks that perform different tasks.
An important step of the lowest level block is the noise
removal,since it highly influences the performances of the
overall machine vision system.A typical noise,especially in
outdoor video surveillance applications,is Salt and Pepper
[rif1ConcettoTesi],which is an impulsive noise that sets the
corrupted pixel value to the maximum or the minimum of the
pixels variation range (0 or 255 for an 8-bit image).Impulse
noise is caused by malfunctioning pixels in camera sensors,
faulty memory locations in hardware,or transmission in a
noisy channel (e.g.[1]).Many algorithms have been proposed
for the restoration of images corrupted by impulse noise,for
instance,the nonlinear digital filters reviewed in [2].The
median filter is the most popular nonlinear filter for removing
impulse noise,because of its good denoising power [1] and
computational efficiency [3].However,when the noise level is
over 50%,some details and especially the edges of the original
image are smeared by the filter [4].Different remedies for
enhancing the shortcomings of the median filter have been
proposed,e.g.the adaptive median filter [5],the multi-state
median filter [6],the median filter based on homogeneity
information [7],[8],the PSM filter,the Neuro-Fuzzy filter
[9].Most of such algorithms are “decision-based” or “two-
steps” filters thus first they identify the possible noisy pixels
and then they replace such pixels by using the median filter
or its variants,leaving all the other pixels unchanged.These
filters are effective for detecting noise even if the noise per-
centage is high.Their main drawback is that the noisy pixels
are replaced by some median value in their neighborhood
without taking into account local features such as the possible
presence of edges.Therefore,the replacement methods in
these denoising schemes are not able to preserve the features
of the original images.An interesting approach is the one
proposed by Chen,[6],where the authors proposed a novel
nonlinear filter,called tri-state median (TSM) filter,that aims
to preserve image details while effectively suppressing impulse
noise.They incorporated a standard median filter and a center
weighted median filter into a noise detection framework to
determine whether a pixel is corrupted,before applying fil-
tering unconditionally.One of the most effective algorithms
for edge preserving is the one proposed by Nikolova [10] that
applies a variational method for image details preserving.This
method is one of the most powerful for image restoration,
and this is the main reason because we adopted it in our
filter.However,it can be improved by a more effective noisy
pixels identification phase,characterized by a small percentage
of false positives/negatives,so increasing the overall system
In this paper we propose a powerful two-stage scheme
which combines the variational method proposed in [10] with
a method based on Bayesian networks for identifying the
noisy pixels.More precisely,the noise candidates are first
identified by the Naive Bayesian Network,and then these
noise candidates are selectively restored using an objective
function with a data-fidelity term and an edge-preserving
regularization term.Since the edges are preserved for the noise
candidates,and no changes are made to the other pixels,the
performance of our combined approach is much better than the
ones proposed in literature.Salt-and-pepper noise with noise
ratio as high as 90% is cleaned quite efficiently.
The outline of the paper is as follows:the Bayesian network
filter is reviewed in Section II.The edge-preserving method is
presented in Section III.Experimental results and conclusions
are presented in Sections IV and V,respectively.
The proposed filter is a ‘two-steps” algorithm,indeed it
consists of a Naive Bayesian classifier for noisy pixels identi-
fication and of a variational method [10] for restoring all the
pixels that have been identified as noisy pixels by the first
block.More in detail the two stages of the algorithm are:
 Noisy Pixels Identification by using Naive Bayesian Net-
works - Let us note by ^y the map obtained by Naive
classifier that has an one in corrispondence of the position
of the noisy pixels,and 0 in corrispondence of the
uncorrupted pixels.Hence the set of noisy pixels (where
the restoration algorithm has to be applied) consists of
the overall pixels of the original image y whose values
in the ^y map are equal to 1.Hence the set of noisy pixels
is defined as follows:
N = f(i;j) 2 A:^y
= 1g
The set of all uncorrupted pixels is N
= N=A,where
A is the set of the all pixels and N is the set of the
noisy pixels.
 Variational Method for noisy pixels restoration - Since
all pixels in N
are detected as uncorrupted,we naturally
keep their original values.Let us now consider a noise
candidate,say,at (i;j) 2 N.Each one of its neighbors
(m;n) 2 V
is either a correct pixel or is another noisy
candidate,i.e.,(m;n) 2 N,in which case its value must
be restored.The neighborhood V
of (i,j) is thus split
as V
= (V
) [ (V
\N).Noisy candidates are
restored by minimizing the functional,restricted to the
noise candidate set N:
(u) =
j +

)] (1)
is the gray level of the original image at (i,j)
2 '(u
The restored image ~y with indices (i;j) 2 N is the one
obtained by replacing,in the original image y,the set
of ~u pixels which are the minimizers of the previously
functional onto N instead of onto A.
The aim of this filter is to improve the performances of the
mostly algorithms present in literature both in reducing the
percentage of false positives in the identification step and in
restoring the noisy pixels with values that preserve the image
details.As is outlined in the previous section,the proposed
approach makes use of Bayesian networks to identify the set
N (as shown in functional (1)) of the pixels that are affected
by the salt and pepper noise.The restoration of the noisy
pixels is carried out by applying an iterative method for the
minimization of the functional (1) which allows the filter to
preserve the edges and the details of the original image.
Bayesian networks are directed acyclic graphs that allow
efficient and effective representation of the joint probability
distribution over a set of random variables and often they are
used in the image processing field [11],[12].These networks
are well known for their capability in classification,which is a
basic task in pattern recognition involving the implementation
of a classifier,i.e.,a function that assigns a class label to
instances described by a set of attributes.The naive Bayesian
classifier [13] is one of the most effective classifiers,in the
sense that its predictive performance is competitive with state-
of-the-art classifiers.A Bayesian classifier learns from training
data the conditional probability of each attribute A
given the
class label C.Afterwards the classification is carried out by
evaluating Bayes rule to compute the probability of C given
the particular instance of A
,and then predicting the
class with the highest posterior probability.This computation
is feasible by making a strong independence assumption,i.e.,
all the attributes A
are conditionally independent given the
value of the class C.In this filter we adopt a naive Bayesian
classifier for evaluating the set N of noisy pixels,by taking
into account all the pixels of the input image and their
neighborhood.The used classifier is shown in fig.1.
Fig.1.Naive Bayesian Classifier
The root of the classifier represents a generic pixel (i;j) to
be classified as noisy or not noisy.It can have two possible
values 1,if the pixel is classified as noisy pixel,0 otherwise.
V al pixel represents the gray level value of the pixel (i;j)
and can have two values:1 if the gray level value is 255 or
0 (hence a possible noise candidate),2 if its value is between
1 and 254 (surely not noise candidate).The remaining other
eight nodes represent the difference between the pixel (i;j)
taken into account,and the other eight (we consider a 3x3
kernel) neighbor pixels as shown in fig.2.
According to the difference values between the pixels we
identify eight classes,as shown,for a generic pixel (i;j):
Class1 if 0  diff < 32 Class5 if 128 <= diff < 160
Class2 if 32  diff < 64 Class6 if 160 <= diff < 192
Class3 if 64  diff < 96 Class7 if 192 <= diff < 224
Class4 if 96  diff < 128 Class8 if 224 <= diff < 256
Fig.2.Estimation of the eight children nodes
The naive Bayesian classifier,based on the classes of the
children nodes (the so called evidences),is able to classify
the root node.The first step,for building the classifier,is
the training phase where the probability table for each node
is created.The probability table represents the conditional
probability of each attribute D
and val
given the class
label Pixel Classified.As training images we used the ones
shown in fig.3 and the same images corrupted with Salt and
Pepper noise (20%,40%,60%,80%).
Fig.3.Images used for training naive Bayesian network
To test the classifier performances,the confusion matrix has
been evaluated as shown in fig.4.In detail,the main diagonal
shows the percentage of noisy pixel and the not noisy pixels
correctly identified,while in the secondary diagonal the false
positives and false negatives are respectively shown.
Fig.4.Confusion Matrix
Among the commonly tested 256-by-256 8-bit gray-scale
images,the one with homogeneous region (Lena) and the one
with high activity (Bridge) with a range of noise levels varied
from 10% to 90% with increments of 20%,were selected
for our simulations.The results of naive Bayesian classifier
applied to the Bridge Image,in terms of false positives (FP),
negatives (FN) and pixel correctly identified (PCI),are
shown in table 1,where its results are compared with the ones
obtained by both the neural networks based filter,proposed in
[9] and the adaptive median filter [3].
Algorithm % Noise %FP %FN PCI
Bayesian networks 30% 0.022 0 99.978
50% 0.047 0 99.953
70% 0.076 0 99.924
90% 0.110 0 99.890
Neural Networks 30% 0.019 0 99.981
50% 0.048 0.34 99.600
70% 0.075 1.022 98.903
90% 0.097 1.823 98.073
Adaptive Median Filter 30% 1.478 3.621 94.901
50% 2.341 4.765 92.894
70% 2.787 5.808 91.405
90% 3.200 6.023 90.777
Table 1.Comparison of different filters for noisy pixel identification
The performances of the naive Bayesian classifier are excel-
lent and barely better of the ones obtained by using a Neuro
Fuzzy classifiers,even if this one shows a small percentage of
false negatives.The results obtained with the adaptive median
filter are good as well,but it is less effective of the first two
algorithms where we obtain results as high as 99% in average.
Having detected the set N of noisy pixels,the minimization of
functional (1),restricted to the set N,was tackled by applying
the variational method proposed by [10].
For the edge preserving Nikolova,in [10],has proposed
the variational method,which proceeds by minimizing a
functional,referred to as energy,that depends on the image
and its space derivatives (gradient).Our considered functional,
see (1),is given by the sum of two terms:one represents the
deviation from a data image y,which may be marred by noise,
whereas the other incorporates the variation of a function
that penalizes oscillations and irregularities,althought it does
not remove high level discontinuities,which are considered
necessary to preserve the sharpness of the image.Generally
an iterative method,related to percentage of noise,is used
for the functional minimization,[14],so that the convergence
rate depends on the image smoothness.
The minimization algorithm,herein proposed,works on the
residuals z = u y of the functional (1) as described below.
Algorithm for functional minimization
 Inizialize z
= 0 for each (ij) 2 A;
 At each iteration k,calculate,for each (ij) 2 A,

= 
where z
,for (m;n) 2 V i;j,are the latest updates
and _'is the derivative of',that we choose equal to jtj

 If 
= 1,set z
= 0.Otherwise,solve for z
in the
nonlinear equation:



= sign


The updating of z
can be done in a red-black fashion,and
it was shown in [10] that z
converges to ^z = ^uy,where the
restored image ^u minimizes F
in (1).By choosing'(t) =

,the nonlinear equation (1) can be solved by Newton’s
method with quadratic convergence by using a suitable initial
guess derived in [15].
We observe that if  is small (1 <  < 1:2),most of the
noise is suppressed but staircases appear.If  is larger than
1.5,the details are not so much distorted but the noise cannot
be fully removed.Hence the selection of  must be a trade-off
between noise suppression and detail preservation as shown in
[10].In our tests,the best restoration results are sensitive to 
when it is less than 1 and greater that 1.5.For such a reason
we choose (t) = jtj
and  is tuned to give the best result
in terms of PSNR.
Among the commonly tested 256-by-256 8-bit gray-scale
images,the one with homogeneous region (Lena) and the
ones with high activity (Bridge,Baboon) will be selected for
our simulations.Their dynamic ranges are [0;255].In the
simulations,images will be corrupted by “salt” (with value
255) and “pepper” (with value 0) noise with equal probability.
Also a wide range of noise levels varied from 10% to 90%
with increments of 10%will be tested The Bridge and Baboon
images used for the testing are shown in fig.5:
Fig.5.Images used for denoising algorithm testing
In the following tables the proposed filter has been com-
pared with the median filter and the Neuro Fuzzy approach
[9] in terms of PSNR,and MAE.
% Noise Median Neuro-Fuzzy Proposed Filter
10% 21.79 28.87 38.41
30% 17.86 21.89 36.42
50% 15.44 16.31 34.33
70% 13.45 10.80 30.74
90% 12.08 7.13 24.17
Table 2.Comparison of PSNR for different noise levels for Bridge Image
% Noise Median Neuro-Fuzzy Compound Filter
10% 15.16 4.53 1.39
30% 25.32 9.69 2.94
50% 33.85 18.99 4.49
70% 43.38 44.20 7.44
90% 51.30 89.90 13.71
Table 3.Comparison of MAE for different noise levels for Bridge Image
From the tables,we see that all the methods have similar
performances when the noise level is low.However when
the noise level increases,noise patches will be formed and
they may be considered as noise free pixels.This causes
difficulties in the noise detection algorithm.With erroneous
noise detection,no further modifications will be made to the
noise patches,and hence their results are not satisfactory,
whereas our system is very effective.
In Figures 6 and 7,we present restoration results for
the 70% corrupted Bridge and Baboon images.Among the
restorations the proposed filter gives the best performances
in terms of noise suppression and details preservation.As
mentioned before,it is because the algorithm locates the noise
Fig.6.Restoration results of different filters:a) Original Bridge Corrupted
with 70% noise level,b) Median Filter,c) Neuro-Fuzzy Filter,d) Proposed
Filter for the Bridge Image
Let us notice that the performances of the proposed filter are
quite satisfactory also in presence of high noise level,indeed
% Noise Median Neuro-Fuzzy Compound Filter
10% 16.97 20.33 37.74
30% 15.06 17.43 32.82
50% 13.45 13.24 29.16
70% 12.01 9.07 27.91
90% 10.64 6.19 22.58
Table 4.Comparison of PSNR for different noise levels for Baboon Image
% Noise Median Neuro-Fuzzy Proposed Filter
10% 27.90 12.54 2.11
30% 35.61 20.67 3.48
50% 43.41 33.16 7.29
70% 51.85 60.51 13.23
90% 61.04 100.88 17.41
Table 5.Comparison of MAE for different noise levels for Baboon Image
it allows us to remove impulse noise from image when the
image is barely visible (70% and 90% of noise).
In this paper,we propose a two steps filter,that aims to
well preserve image details.Experimental results show that
our algorithm works much better than median-based filters or
the soft computing approaches based on neural networks.Even
at a very high noise level (90%),the texture,details and edges
are not smeared.One the future improvements is to apply such
an approach for removing different kind of noises.Moreover,
as shown in the results section,the algorithm allows us to
reconstruct an image when it is corrupted with a high level
of noise,hence as future work we are planning to use such
an approach for image encryption.An important aspect is the
efficiency of the algorithm,indeed the performances of the
proposed filter in terms of CPU TIME are quite low.In
order to improve their performances the restoration phase will
been carried out on Grid Computing as shown in the work
[16] where experimental results show a reduction of 10 times
of the processing time obtaining about 1 hour for restoring
Baboon image when it is corrupted with 90% of noise.
Future works will aim to reduce more the processing time
by using high performance computing algorithms based on
message passing interface (MPI) architecture.
[1] A.Bovik,Handbook of Image and Video Processing.Academic Press,
[2] J.Astola and P.Kuosmanen,Fundamentals of Nonlinear Digital Filter-
ing.Boca Raton,CRC,1997.
[3] T.S.Huang,G.J.Yang,and G.Y.Tang,“Afast two-dimensional median
filtering algorithm,” IEEE Transactions on Acoustics,Speech,and Signal
[4] T.A.Nodes and N.C.Gallagher,“The output distribution of median
type filters,” IEEE Transactions on Communications,vol.32,no.5,
[5] H.Hwang and R.Haddad,“Adaptive median filters:new algorithms and
results,” IEEE Transactions on Image processing,vol.4,no.4,pp.499–
Fig.7.Restoration results of different filters:a) Original Baboon Corrupted
with 70% noise level,b) Median Filter,c) Neuro-Fuzzy Filter,d) Proposed
Filter for the Baboon Image
[6] T.Chen and H.R.Wu,“Space variant median filters for the restoration
of impulse noise corrupted images,” IEEE Transactions on Circuits
and Systems II:Analog and Digital Signal Processing,vol.48,no.8,
[7] H.L.Eng and K.K.Ma,“Noise adaptive soft-switching median filter,”
IEEE Transactions on Image Processing,vol.10,no.2,pp.242–251,
[8] G.Pok,J.-C.Liu,and A.S.Nair,“Selective removal of impulse noise
based on homogeneity level information,” IEEE Transactions on Image
[9] A.Faro,D.Giordano,and C.Spampinato,“Neural networks combined
with fuzzy logic to remove salt and pepper noise in digital,” Applications
of Soft Computing:Recent Trends - Springer Verlag Berlin,pp.23–33,
[10] M.Nikolova,“A variational approach to remove outliers and impulse
noise,” Journal of Mathematical Imaging and Vision,vol.20,no.1,
[11] C.A.Bouman and M.Shapiro,“A multiscale random field model for
bayesian image segmentation,” IEEE Transactions on Image Processing,
[12] V.Kumar and U.Desai,“Image interpretation using bayesian networks,”
IEEE Transactions on Pattern Analysis and Machine Intelligence,
[13] I.Rish,“An empirical study of the naive bayes classifier,” in Proc.of th
IJCAI 2001 Workshop on Empirical Methods in Artificial Intelligence,
[14] C.R.Vogel and M.E.Oman,“Fast,robust total variation-based
reconstruction of noisy,blurred images,” IEEE Transactions on Image
[15] R.H.Chan,C.-W.Ho,and M.Nikolova,“Convergence of newton’s
method for a minimization problem in impulse noise removal,” Journal
of Computational Mathematics,vol.22,pp.168–177,2004.
[16] F.Cannav`o,D.Giordano,G.Nunnari,and C.Spampinato,“Variational
method for image denoising by distributed genetic algorithms on grid
environment,” in Proc.of the 15th IEEE International Workshops on
Enabling Technologies:Infrastructures for Collaborative Enterprises
(WETICE-2006),pp.227 – 232,2006.