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

e-mail:fafaro,dgiordan,gscarciof,cspamping@diit.unict.it

Abstract—In this paper we propose a two-step ﬁlter for

removing salt-and-pepper impulse noise.In the ﬁrst 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 signiﬁcant improvement compared to other non

linear ﬁlters 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.

I.INTRODUCTION

In the last decades,the image-processing ﬁeld 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 ﬁeld.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 inﬂuences 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 ﬁlters reviewed in [2].The

median ﬁlter is the most popular nonlinear ﬁlter for removing

impulse noise,because of its good denoising power [1] and

computational efﬁciency [3].However,when the noise level is

over 50%,some details and especially the edges of the original

image are smeared by the ﬁlter [4].Different remedies for

enhancing the shortcomings of the median ﬁlter have been

proposed,e.g.the adaptive median ﬁlter [5],the multi-state

median ﬁlter [6],the median ﬁlter based on homogeneity

information [7],[8],the PSM ﬁlter,the Neuro-Fuzzy ﬁlter

[9].Most of such algorithms are “decision-based” or “two-

steps” ﬁlters thus ﬁrst they identify the possible noisy pixels

and then they replace such pixels by using the median ﬁlter

or its variants,leaving all the other pixels unchanged.These

ﬁlters 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 ﬁlter,called tri-state median (TSM) ﬁlter,that aims

to preserve image details while effectively suppressing impulse

noise.They incorporated a standard median ﬁlter and a center

weighted median ﬁlter into a noise detection framework to

determine whether a pixel is corrupted,before applying ﬁl-

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

ﬁlter.However,it can be improved by a more effective noisy

pixels identiﬁcation phase,characterized by a small percentage

of false positives/negatives,so increasing the overall system

performances.

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 ﬁrst

identiﬁed by the Naive Bayesian Network,and then these

noise candidates are selectively restored using an objective

function with a data-ﬁdelity 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 efﬁciently.

The outline of the paper is as follows:the Bayesian network

ﬁlter 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.

II.TWO STEPS EDGE PRESERVING FILTER

The proposed ﬁlter is a ‘two-steps” algorithm,indeed it

consists of a Naive Bayesian classiﬁer for noisy pixels identi-

ﬁcation and of a variational method [10] for restoring all the

pixels that have been identiﬁed as noisy pixels by the ﬁrst

block.More in detail the two stages of the algorithm are:

Noisy Pixels Identiﬁcation by using Naive Bayesian Net-

works - Let us note by ^y the map obtained by Naive

classiﬁer 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 deﬁned as follows:

N = f(i;j) 2 A:^y

i;j

= 1g

The set of all uncorrupted pixels is N

c

= 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

c

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

i;j

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

i;j

of (i,j) is thus split

as V

i;j

= (V

i;j

\N

c

) [ (V

i;j

\N).Noisy candidates are

restored by minimizing the functional,restricted to the

noise candidate set N:

F

y

j

N

(u) =

X

(i;j)2N

[ju

i;j

y

i;j

j +

2

(S

1

+S

2

)] (1)

where

y

ij

is the gray level of the original image at (i,j)

S

1

=

P

(m;n)2V

i;j

\N

2 '(u

i;j

y

m;n

)

S

2

=

P

(m;n)2V

i;j

\N

'(u

i;j

u

m;n

)

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.

III.NOISY PIXELS IDENTIFICATION BY USING NAIVE

BAYESIAN NETWORKS

The aim of this ﬁlter is to improve the performances of the

mostly algorithms present in literature both in reducing the

percentage of false positives in the identiﬁcation 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 ﬁlter to

preserve the edges and the details of the original image.

Bayesian networks are directed acyclic graphs that allow

efﬁcient and effective representation of the joint probability

distribution over a set of random variables and often they are

used in the image processing ﬁeld [11],[12].These networks

are well known for their capability in classiﬁcation,which is a

basic task in pattern recognition involving the implementation

of a classiﬁer,i.e.,a function that assigns a class label to

instances described by a set of attributes.The naive Bayesian

classiﬁer [13] is one of the most effective classiﬁers,in the

sense that its predictive performance is competitive with state-

of-the-art classiﬁers.A Bayesian classiﬁer learns from training

data the conditional probability of each attribute A

i

given the

class label C.Afterwards the classiﬁcation is carried out by

evaluating Bayes rule to compute the probability of C given

the particular instance of A

1

;:::;A

n

,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

i

are conditionally independent given the

value of the class C.In this ﬁlter we adopt a naive Bayesian

classiﬁer for evaluating the set N of noisy pixels,by taking

into account all the pixels of the input image and their

neighborhood.The used classiﬁer is shown in ﬁg.1.

Fig.1.Naive Bayesian Classiﬁer

The root of the classiﬁer represents a generic pixel (i;j) to

be classiﬁed as noisy or not noisy.It can have two possible

values 1,if the pixel is classiﬁed 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 ﬁg.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 classiﬁer,based on the classes of the

children nodes (the so called evidences),is able to classify

the root node.The ﬁrst step,for building the classiﬁer,is

the training phase where the probability table for each node

is created.The probability table represents the conditional

probability of each attribute D

i

and val

pix

given the class

label Pixel Classiﬁed.As training images we used the ones

shown in ﬁg.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 classiﬁer performances,the confusion matrix has

been evaluated as shown in ﬁg.4.In detail,the main diagonal

shows the percentage of noisy pixel and the not noisy pixels

correctly identiﬁed,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 classiﬁer

applied to the Bridge Image,in terms of false positives (FP),

negatives (FN) and pixel correctly identiﬁed (PCI),are

shown in table 1,where its results are compared with the ones

obtained by both the neural networks based ﬁlter,proposed in

[9] and the adaptive median ﬁlter [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 ﬁlters for noisy pixel identiﬁcation

The performances of the naive Bayesian classiﬁer are excel-

lent and barely better of the ones obtained by using a Neuro

Fuzzy classiﬁers,even if this one shows a small percentage of

false negatives.The results obtained with the adaptive median

ﬁlter are good as well,but it is less effective of the ﬁrst 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].

IV.VARIATIONAL METHOD FOR NOISY PIXELS

RESTORATION

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)

ij

= 0 for each (ij) 2 A;

At each iteration k,calculate,for each (ij) 2 A,

(k)

i;j

=

X

(m;n)2V

i;j

_'(y

i;j

z

i;j

y

m;n

)

where z

m;n

,for (m;n) 2 V i;j,are the latest updates

and _'is the derivative of',that we choose equal to jtj

.

If

(k)

i;j

= 1,set z

i;j

= 0.Otherwise,solve for z

(k)

i;j

in the

nonlinear equation:

X

(m;n)2V

i;j

_'

z

(k)

i;j

+y

i;j

z

m;n

y

m;n

= sign

(k)

i;j

The updating of z

(k)

i;j

can be done in a red-black fashion,and

it was shown in [10] that z

(k)

converges to ^z = ^uy,where the

restored image ^u minimizes F

y

in (1).By choosing'(t) =

jtj

,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

1:2

and is tuned to give the best result

in terms of PSNR.

V.EXPERIMENTAL RESULTS

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 ﬁg.5:

Fig.5.Images used for denoising algorithm testing

In the following tables the proposed ﬁlter has been com-

pared with the median ﬁlter 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

difﬁculties in the noise detection algorithm.With erroneous

noise detection,no further modiﬁcations 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 ﬁlter gives the best performances

in terms of noise suppression and details preservation.As

mentioned before,it is because the algorithm locates the noise

accurately.

Fig.6.Restoration results of different ﬁlters: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 ﬁlter 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).

VI.CONCLUSIONS AND FUTURE WORKS

In this paper,we propose a two steps ﬁlter,that aims to

well preserve image details.Experimental results show that

our algorithm works much better than median-based ﬁlters 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

efﬁciency of the algorithm,indeed the performances of the

proposed ﬁlter 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.

REFERENCES

[1] A.Bovik,Handbook of Image and Video Processing.Academic Press,

2000.

[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

ﬁltering algorithm,” IEEE Transactions on Acoustics,Speech,and Signal

Processing,vol.27,no.1,pp.13–18,1979.

[4] T.A.Nodes and N.C.Gallagher,“The output distribution of median

type ﬁlters,” IEEE Transactions on Communications,vol.32,no.5,

pp.532–541,1984.

[5] H.Hwang and R.Haddad,“Adaptive median ﬁlters:new algorithms and

results,” IEEE Transactions on Image processing,vol.4,no.4,pp.499–

502,1995.

Fig.7.Restoration results of different ﬁlters: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 ﬁlters for the restoration

of impulse noise corrupted images,” IEEE Transactions on Circuits

and Systems II:Analog and Digital Signal Processing,vol.48,no.8,

pp.784–789,2001.

[7] H.L.Eng and K.K.Ma,“Noise adaptive soft-switching median ﬁlter,”

IEEE Transactions on Image Processing,vol.10,no.2,pp.242–251,

2001.

[8] G.Pok,J.-C.Liu,and A.S.Nair,“Selective removal of impulse noise

based on homogeneity level information,” IEEE Transactions on Image

Processing,vol.12,no.1,pp.85–92,2003.

[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,

2006.

[10] M.Nikolova,“A variational approach to remove outliers and impulse

noise,” Journal of Mathematical Imaging and Vision,vol.20,no.1,

pp.99–120,2004.

[11] C.A.Bouman and M.Shapiro,“A multiscale random ﬁeld model for

bayesian image segmentation,” IEEE Transactions on Image Processing,

vol.3,no.2,pp.162–177,2005.

[12] V.Kumar and U.Desai,“Image interpretation using bayesian networks,”

IEEE Transactions on Pattern Analysis and Machine Intelligence,

vol.18,no.1,pp.74–77,1996.

[13] I.Rish,“An empirical study of the naive bayes classiﬁer,” in Proc.of th

IJCAI 2001 Workshop on Empirical Methods in Artiﬁcial Intelligence,

vol.1,pp.1–6,2001.

[14] C.R.Vogel and M.E.Oman,“Fast,robust total variation-based

reconstruction of noisy,blurred images,” IEEE Transactions on Image

Processing,vol.7,no.6,pp.813–824,1998.

[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.

## Σχόλια 0

Συνδεθείτε για να κοινοποιήσετε σχόλιο