Switching Median Filter with Signal Dependent Thresholds
Designed by using Genetic Algorithm
Ryosuke Kubota
1
, Keisuke Onaga
2
and Noriaki Suetake
3
1
Department of Intelligent System Engineering, Ube National College of Technology,
2-14-1 Tokiwadai, Ube-shi, Yamaguchi, Japan
2
Advanced Course of Production Systems, Ube National College of Technology,
2-14-1 Tokiwadai, Ube-shi, Yamaguchi, Japan
3
Graduate School of Science and Engineering, Yamaguchi University,
1677-1 Yoshida, Yamaguchi-shi, Yamaguchi, Japan
Keywords:
Switching Median Filter, Random-valued Impulse Noise, Distribution Distance, Genetic Algorithm.
Abstract:
In this paper, we propose a new switching median filter with signal dependent thresholds designed by a genetic
algorithm (GA). The switching median filter detects noise-corrupted pixels based on a threshold. Then it
restores only the detected pixels. The present switching median filter deals with the random-valued impulse
noises, whose distribution is ideally assumed as a uniform distribution. In the present method, the switching
median filter, which has two kinds of the thresholds, is introduced. One is switching thresholds to detect
the noise, and the other is selecting thresholds to choose the suitable switching threshold. As the suitable
selecting threshold, a variance of signals is used. Then all of the switching and selecting thresholds of the
proposed switching median filter are automatically optimized by using GA. To optimize the thresholds with
GA, distribution distance between the assumed and the detected noises is employed as a fitness function. The
validity and effectiveness of the proposed method is verified by some experiments.
1 INTRODUCTION
Along with developments of digital technologies,
high quality digital images are strongly needed in
many research and application fields. However, the
digital images are often corrupted by the impulse
noise in the image sensing and/or transmission pro-
cesses. It is thus significant to restore the noise in
the image before subsequent processing. In order to
realize a fine restoration of the image corrupted by
the salt-and-pepper impulse noise, various nonlinear
filters based on the median filter have been studied
so far (Chen et al., 1999), (Chen and Wu, 2001),
(Akkoul et al., 2010). Especially a switching median
filter, which was proposed by Sun and Neuvo (Sun
and Neuvo, 1994), has frequently employed and stud-
ied in order to apply it to a random-valued impulse
noise removal in recent years (Suetake, 2002), (Ng
and Ma, 2006), (Zhang et al., 2008), (Suetake et al.,
2011).
The typical switching median filters include a
noise detector based on a switching threshold, and
carry out the median filtering to only noise-corrupted
pixels. In order to apply the switching median fil-
ter effectively, its switching threshold of the detector
has to be appropriately tuned for the signal of con-
cern. However, it is difficult to determine the optimal
threshold automatically, because the suitable thresh-
old varies depending on a mix of factors, e.g., a prop-
erty of input image, noise content rate, the window
size of the detector and so on.
To cope with this problem, the authors proposed
a distribution distance-based threshold auto-tuning
method for switching median filter so far (kubota and
Suetake, 2010). In this method, the distribution dis-
tance between a noise model assumed beforehand and
the noise signal detected by the detector was intro-
duced as a distinct indicator for the optimal tuning
of the threshold. This method can free the users
from the tiresome tuning, and has been also applied
to the random-valued impulse noise removal of the
color image (kubota and Suetake, 2011). However,
the switching median filter with only a fixed switch-
ing threshold has an inherent limitation on the noise
detection performance.
To address this issue, we propose a new switch-
222
Kubota R., Onaga K. and Suetake N..
Switching Median Filter with Signal Dependent Thresholds Designed by using Genetic Algorithm.
DOI: 10.5220/0004851702220227
In Proceedings of the 9th International Conference on Computer Vision Theory and Applications (VISAPP-2014), pages 222-227
ISBN: 978-989-758-003-1
Copyright
c
2014 SCITEPRESS (Science and Technology Publications, Lda.)
ing median filter with some signal dependent thresh-
olds and their optimal designing method based on
the noise probability distribution. In this paper, the
switching median filter, which has two kinds of the
thresholds, is introduced. One is switching thresholds
to detect the noise, and the other is selecting thresh-
olds to choose the suitable switching threshold. In the
proposed method, we employ a variance of signals for
the selecting threshold. Thus, the suitable switching
threshold is decided depending on the signal of con-
cern by using the selecting thresholds.
All of the switching and selecting thresholds of
the proposed switching median filter are automati-
cally designed by using GA, which is a search al-
gorithm based on the mechanism of natural selection
and natural genetics (Goldberg, 1989), (Davis, 1990).
GA solves optimization problems by using individu-
als which are represented by bit-strings or real valued-
genes. In the proposed method, GA tunes all thresh-
olds so as to minimize a distribution distance between
the assumed and the detected noises.
Through the experiments, the effectiveness and
validity of the proposed method are illustrated.
2 NOISE MODEL AND
SWITCHING MEDIAN FILTER
2.1 Random-valued Impulse Noise
In this paper, we consider a monochrome image cor-
rupted with the random-valued impulse noise in a
transmission of the digitalized signal. Impulse noises
are caused by malfunctioning pixels in camera sen-
sors, faulty memory locations in hardware or trans-
mission in a noisy channel.
A signal x(i, j) corrupted with the random-valued
impulse noise is represented by:
x(i, j) =
{
s(i, j), probability 1 p,
h, probability p,
(1)
where, s(i, j) is the source signal, and takes 256 level
(8 bit) values. p represents a noise occurrence proba-
bility. The noise-corrupted pixel value h takes from 0
to 255, because each bit in s(i, j) inverts randomly.
This model is the most popular and focuses on a
bit error in the digitalized signal transmission. There-
fore, the signals corrupted with the random-valued
impulse noises can be assumed as a uniform distri-
bution.
2.2 Detailed-preserving Median Based
Filter
A detailed-preserving median based filter is the most
popular switching median filter (Sun and Neuvo,
1994). In this method, the impulse noises are detected
by considering difference between a pixel value of
concern and a median of its neighboring pixel values.
This method uses a noise position image f
(ε)
(i, j)
defined by:
f
(ε)
(i, j) =
{
1, |x(i, j) x
MED
(i, j)| ε,
0, otherwise,
(2)
where x
MED
(i, j) stands for the output signal at the
pixel (i, j) by the ordinary median filter. The noise
position image contains coordinate information of the
detected noises. In the noise position image, “1” rep-
resents that the pixel is corrupted by the noise. The
switching median filter carries out the median filter-
ing only for the detected pixels by using the noise po-
sition image. Here ε is a threshold.
In the past, various types of the switching median
filter have been proposed for the effective detection
of the salt-pepper impulse noise. Furthermore, some
of them have been also applied to the detection of the
random-valued impulse noise. However, in the con-
ventional methods, the suitable threshold ε has been
adjusted manually and empirically depending on the
situations, because effective indicators for the filter
design have not been discussed so far. Additionally,
the switching median filter with only a fixed thresh-
old has an inherent limitation on the noise detection
performance.
In order to raise the noise detection performance,
it is preferable to change the threshold depending on
the target and its neighboring signals automatically.
3 PROPOSED METHOD
3.1 Counstruction of Proposed
Switching Median Filter
The proposed switching median filter has two sets of
thresholds. One is the switching thresholds {ε
m
| m =
1,··· ,N}, and the other is the selecting thresholds
{v
n
| n = 1, ··· , N 1}. Each switching threshold is a
value, and it is used in order to judge the target signal
as the source or the noise. The selecting thresholds
work to choose the suitable switching threshold from
the set of the switching thresholds. Thus, the pro-
SwitchingMedianFilterwithSignalDependentThresholdsDesignedbyusingGeneticAlgorithm
223
posed switching median filter is expressed by:
f
(ε
o
)
(i, j) =
{
1, |x(i, j) x
MED
(i, j)| ε
o
,
0, otherwise,
(3)
ε
o
=
ε
1
, v < v
1
,
.
.
.
ε
m
, v
n1
v < v
n
,
.
.
.
ε
N
, v
N1
v,
(4)
where v
n
is a variance value calculated from x(i, j)
and its neighboring signals in a window. Additionally,
these thresholds satisfy the following conditions:
0 < ε
1
< ··· < ε
m
< ··· < ε
N
, (5)
and
0 < v
1
< ··· < v
n
< ··· < v
N1
. (6)
3.2 Adaptive Threshold Tuning by
Genetic Algorithm
In the proposed switching median filter, all of
the thresholds, which are {ε
1
,··· ,ε
m
,··· ,ε
N
} and
{v
1
,··· ,v
n
,··· ,v
N1
}, are decided by using GA.
In the proposed method with GA, an in-
dividual I
I
I
k
is constructed by the serially-
concatenated switching and selection thresh-
olds. Thus the k-th individual is represented by
I
I
I
k
= {ε
k1
,··· ,ε
km
,··· ,ε
kN
,v
k1
,··· ,v
kn
,··· ,v
kN1
},
where 5 ε
km
100 and 10 v
kn
7,000.
In the optimization process of GA, crossover, mu-
tation and selection operators are applied to the popu-
lation. The proposed tuning method employs a distri-
bution distance between a noise model assumed be-
forehand and the noise detected by the detector as a
fitness function. The distribution distance is a good
indicator for the evaluation of the noise detecting per-
formance, and its validity for the single threshold
adjusting has been verified in (kubota and Suetake,
2010). When the distribution distance is small, it is
thus judged as a fine noise detection is achieved. The
fitness function with its modification to the proposed
switching median filter is described below.
The sets of the suitable thresholds {ε
m
| m =
1,··· ,N} and {v
n
| m = 1,··· ,N 1}, which maxi-
mize the fitness function F, is searched. The fitness
function F
k
of k-th individual is represented by:
F
k
=
1
1 +D(H
d,(
k
)
,H
a
)
. (7)
D(H
d,(
k
)
,H
a
) is the distribution distance (L
1
norm)
and is represented by:
D(H
d,(
k
)
,H
a
) =
255
=0
|H
d,(
k
)
() H
a
()|, (8)
where H
d,(
k
)
stands for a probability density function
of the noises detected with the set of the thresholds
k
= {ε
km
,v
kn
| m = 1,··· ,N, and n = 1, ··· , N
1}. The probability density function is then obtained
from a normalized histogram of a set of x(i, j) which
satisfies f
(ε
o
)
(i, j) = 1. H
a
represents the probability
density function of an assumed random-valued im-
pulse noise, i.e., a uniform distribution, because the
assumption on the distribution of the noise is imposed
by the model of Eq. (1). H
a
() is
1
256
for arbitrary
here, because H
a
is a uniform distribution.
The proposed method has three features from the
viewpoint of the usefulness, although the proposed
method is very simple. One is that the proposed
method can determine the suitable and specific thresh-
olds for various input images and/or their noise oc-
currence probability automatically, if the noise cor-
rupted to input image is the random-valued impulse
noise. Another is that the proposed method can ad-
just some kinds of thresholds by evaluating only a
distribution distance. The other is that the proposed
method does not require desirable output images for
the adjusting, because this method works only with
the internally-assumed noise model and the filter out-
puts. Therefore, it can be said that the proposed
method is very effective in the situation where the
MSE evaluation cannot be performed. Furthermore,
the proposed method can be used without any changes
of algorithm even if the noise occurrence probability
is changed.
4 EXPERIMENTAL RESULTS
The effectiveness and validity of the proposed method
are verified by experiments employing a digital im-
age as shown in Figure 1. Figure 1 constitutes of
512×512 pixels. In the experiments, the input images
are corrupted by the random-valued impulse noise
with p = 0.05. The enlarged image of input image
is shown in Figures 1(c).
In the experiment, we used the switching me-
dian filter with 3 switching thresholds and 2 selecting
threshold, i.e., N = 3. The window size of the switch-
ing median filter is 3 × 3. The noise removal per-
formance of the proposed method is compared with
that of the ordinary switching median filter, which
has only single switching threshold. Furthermore, the
noise removal performance of the proposed tuning
VISAPP2014-InternationalConferenceonComputerVisionTheoryandApplications
224
(a)
(b)
(c)
Figure 1: Test image: (a) Original noise-free image, (b)
Enlarged image of a part of (a), (c) Enlarged input image.
method is also compared to those of a mean square
error (MSE)-based tuning method and L
1
norm-based
method. In this experiment, MSE is used as an index
for the quantitative evaluation, although the evalua-
tion based on MSE can not be applied in the practical
situation. The MSE is calculated from the original
noise-free image shown in Figure 1(a) and the output
image restored by the switching median filter. The
MSE becomes small when the restored image is sim-
ilar to the original one.
In the MSE-based method, each threshold of the
Table 1: Step size and range of each threshold.
Threshold Step Lower Upper
ε
1
1 15 49
ε
2
1 50 79
ε
3
1 80 100
v
1
1,000 1,000 4,000
v
2
1,000 6,000 9,000
switching median filter is decided so as to minimize
the MSE between the original noise-free image and
the output image obtained by the switching median
filter. In the same manner, each threshold of the
switching median filter by using the L
1
norm-based
method is decided so as to minimize the L
1
norm be-
tween distribution distances of the internally-assumed
noise and the noise detected by the switching median
filter. To decide the thresholds based on the MSE and
the L
1
norm and to reduce the computational costs,
a spatial segmentation search is used. The step size
and the lower and upper limits is each thresholds are
shown in Table 1. From Table 1, we can estimate that
the number of trials is 336,000 in order to obtain the
best combination of all the thresholds. In this experi-
ment, the computation time of 1 trial needs 0.142 sec-
ond.
In the GA of the proposed method, the number of
genes in each individual is 5 (3 switching and 2 se-
lecting thresholds). The population size is 100. The
range of each threshold is the same to that in Table 1.
The window size for the calculation of the variance
(selecting threshold) is 5 × 5. The crossover, muta-
tion and selection methods are the BLX-α crossover
(Eshleman and Schaffer, 1993), uniform mutation and
roulette wheel selection with the elitism, respectively.
Furthermore, the crossover and mutation probabilities
are 0,3 and 0.05, respectively. The number of gener-
ations for the search is 1,000. Thus, the number of
trials is 100,000 in order to finish the search in the
proposed method, and less than those of the MSE and
the L
1
-based methods.
Table 2 shows the tuning results of the MSE, L
1
and the proposed method.
From Table 2, it is observed that the noise restora-
tion performance is improved slightly when the num-
ber of the switching thresholds increases. Besides,
L
1
-based and the proposed methods seem to be good,
although the obtained thresholds are not perfectly
same to that by the MSE-based method. From these
results, it is confirmed that the distribution distance
between the assumed and the detected noise is a good
indicator for the multiple thresholds tuning. Further-
more, the distribution distance-based threshold ad-
justing method seems to be highly promise a secure
performance even if the detector has some thresholds.
SwitchingMedianFilterwithSignalDependentThresholdsDesignedbyusingGeneticAlgorithm
225
Table 2: Experimental results by the MSE-, the L
1
-based optimal tuning and the proposed tuning methods.
Method ε
1
ε
2
ε
3
v
1
v
2
MSE L
1
MSE-based method 27 - - - - 9.0 0.16
L
1
-based method 21 - - - - 9.7 0.13
MSE-based method 25 50 80 2,000 6,000 8.7 0.15
L
1
-based method 22 54 85 3,000 6,000 9.4 0.12
Proposed method 12 22 83 60 5,862 9.4 0.12
(a)
(b)
(c)
Figure 2: Noise restored images, (a) MSE-based method,
(b) L
1
-based method, (c) Proposed method.
Figure 2 shows the parts of output images restored
by the switching median filtering with the signal de-
pendent multiple thresholds obtained based on the
MSE, L
1
-based and the proposed methods. It is ob-
served that the restoration images by the L
1
-based and
the proposed method are the almost same to those by
the MSE-based optimal tuning. Furthermore, the pro-
posed method seems to be effective in the situation
where the MSE evaluation cannot be performed (i.e.,
the desirable filtered image cannot be obtained be-
forehand).
Figure 3(a) shows a transition of the smallest L
1
norm of the best individual in the searching process
with the GA. From Figure 3(a), it can be observed that
the better thresholds are found as the generations pro-
gresses by the proposed method. Additionally, Figure
3(b) shows the MSE calculated by the best individual
at each generation. From Figure 3(b), it can be seen
that the good thresholds which is almost the best solu-
tion has been found arround 50-th generation. Thus,
the number of trials in order to obtain the good thresh-
olds in the proposed method is 5,000, which is calcu-
lated by the number of generation and the population
size. On the other hand, the number of trials of the
spatial segmentation search is 336,000 in order to ob-
tain the best combination of all the thresholds. There-
fore, the proposed method can find the appropriate
and reasonable thresholds faster than the L 1-based
spatial segmentation search.
From these results, the effectiveness and validity
of the proposed method are confirmed.
5 CONCLUSION
In this paper, we proposed a new switching median
filter with signal dependent thresholds and their opti-
mal designing method by using GA.
The thresholds of the proposed switching median
filter are automatically optimized by using GA. To op-
timize the thresholds with GA, the distribution dis-
tance between the assumed and the detected noises is
used as the fitness function. The effectiveness and va-
lidity of the proposed method were illustrated.
Future works are to improve the searching perfor-
VISAPP2014-InternationalConferenceonComputerVisionTheoryandApplications
226
0 200 400 600 800 1000
0.123
0.124
0.125
0.126
0.127
0.128
0.129
Generations
L1 Norm
(a)
0 200 400 600 800 1000
8
10
12
14
16
18
Generations
MSE
(b)
Figure 3: Optimizing transitions of L
1
norm by the pro-
posed method, (a) L
1
norm of the best individual, (b) MSE
calculated by the best individual.
mance of GA and to establish other noise models for
various types of the noises.
ACKNOWLEDGEMENTS
This work was supported by the Ministry of Educa-
tion, Science, Sports and Culture, Grant-in-Aid for
Young Scientists (B), 24700237.
REFERENCES
Akkoul, S., Ledee, R., Leconge, R., and Harba, R. (2010).
A new adaptive switching median filter. IEEE Signal
Processing Letters, 17(6):587–590.
Chen, T., Ma, K. K., and Chen, L. H. (1999). Tri-state
median filter for image denoising. IEEE Trans. on
Image Processing, 8(2):1834–1838.
Chen, T. and Wu, H. R. (2001). Space variant median filters
for the restoration of impulse noise corrupted images.
IEEE Trans. on Circuits Syst. II, Analog Digit. Signal
Process., 48(8):784–789.
Davis, L. (1990). The Handbook of Genetic Algorithms.
Van Nostrand Reinhold, New York.
Eshleman, L. J. and Schaffer, J. D. (1993). Foundations of
Genetic Algorithms 2. Morgan Kaufmann, New York.
Goldberg, D. E. (1989). Genetic Algorithms in Search, Op-
timization, and Machine Learning. Addison-Wesley
Publishing Company Inc.
kubota, R. and Suetake, N. (2010). Distribution distance-
based threshold auto-tuning method for switching me-
dian filter. IEICE Electronics Express, 7(17):1310–
1326.
kubota, R. and Suetake, N. (2011). Random-valued im-
pulse noise removal based on component-wise noise
detector with auto-tuning function and vector me-
dian interpolation. Journal of the Franklin Institutes,
348(9):2535–2538.
Ng, P. and Ma, K. (2006). A switching median filter with
boundary discriminative noise detection for extremely
corrupted images. IEEE Trans. on Image Processing,
15(6):1506–1516.
Suetake, N. (2002). A new impulse noise detector based
on pattern classification. IEEJ Trans. on Electronics,
Information and Systems, 122(5):902–903.
Suetake, N., Kubota, R., and Uchino, E. (2011). Random-
valued impulse noise detection considering color dis-
tance and correlation among rgb components. Int’l
J. of Innovative Computing, Information and Control,
7(7(A)):3799–3809.
Sun, T. and Neuvo, Y. (1994). ‘detail-preserving median
based filters in image processing. Pattern Recognit.
Lett., 15(4):341–347.
Zhang, X., Yin, Z., and Xiong, Y. (2008). Adaptive switch-
ing median filter for impulse noise removal. In IEEE
Congress on Image and Signal Processing, pages
275–278.
SwitchingMedianFilterwithSignalDependentThresholdsDesignedbyusingGeneticAlgorithm
227