adaptive center weighted median filter

advertisement
7th International Scientific and Expert Conference TEAM 2015
Technique, Education, Agriculture & Management
Belgrade, October 15-16, 2015
ADAPTIVE CENTER WEIGHTED MEDIAN FILTER
Vedran Novoselac* and Zlatko Paviฤ‡
Mechanical Engineering Faculty in Slavonski Brod, J. J. Strossmayer University of Osijek, Croatia
* Corresponding author e-mail: vedran.novoselac@sfsb.hr
Abstract
In this paper, the weighted median is presented
and its propertie distance to center data. This
relation is implemented in the image denoising
filter. In the paper impulse image noise model is
considered. The quality of reconstructed images
provided with proposed filter are measured with
PSNR metric.
Keywords:
Weighted median, image processing, impulse
noise, PSNR
1. Introduction
The weighted medina [1] is a natural extension of
the medina. While the median of data vector ๐’š =
[๐‘ฆ1 , … , ๐‘ฆ๐‘› ]๐‘‡ , ๐‘ฆ๐‘– ∈ ๐‘น, minimizes the ๐ฟ1 -distance (or
least absolute deviation, LAD), the weighted
median
of
๐’š = [๐‘ฆ1 , … , ๐‘ฆ๐‘› ]๐‘‡
with
positive
corresponding weight vector ๐’˜ = [๐‘ค1 , … , ๐‘ค๐‘› ]๐‘‡ ,
minimizes the weighted ๐ฟ1 -distance
adaptive center weighted median filter (ACWMF) is
constructed and tested on various experimental
images. Proposed algorithm has been developed
under the PSNR criteria.
2. Weighted median and its application
In this section is given a solution of the weighted
median problem [1]. The following theorem proofs
minimization problem of the weighted ๐ฟ1 -distances.
Theorem 1 Let ๐‘ฆ(1) ≤ โ‹ฏ ≤ ๐‘ฆ(๐‘›) denote the ordered
observation and ๐‘ค(1) , … , ๐‘ค(๐‘›) the corresponding
positive weights. Then the weighted median of ๐’š =
[๐‘ฆ1 , … , ๐‘ฆ๐‘› ]๐‘‡ is med(๐’˜, ๐’š) = ๐‘ฆ(๐‘™+1) , where
๐‘›
l = max {โ„Ž: ∑ ๐‘ค(๐‘–)
๐‘–=1
๐‘ฅ
(2)
๐‘–=1
Proof. Let ๐น: ๐‘น → ๐‘น be a function defined as
๐‘›
๐น(๐‘ฅ) = ∑ ๐‘ค๐‘– |๐‘ฆ๐‘– − ๐‘ฅ|.
๐‘›
med(๐’˜, ๐’š) = argmin ∑ ๐‘ค๐‘– |๐‘ฆ๐‘– − ๐‘ฅ|.
๐‘›
1
< ∑ ๐‘ค๐‘– }.
2
(3)
๐‘–=1
(1)
Notice that on each interval
๐‘–=1
If ๐‘ค1 = โ‹ฏ = ๐‘ค๐‘› = 1, the global minimum is denoted
by med(๐’š) and called the median of data vector. In
case that the number of observation ๐‘› is an odd
number (๐‘› = 2๐‘˜ − 1), the distance between center
weight median and center observation ๐‘ฆ๐‘˜ can be
observed. It is shown that distance between center
weight median and ๐‘ฆ๐‘˜ decrease as the ๐‘ฅ increase.
The weighted median problem is used in many
methods for outlier detection [4] and can be found
in various branches of applied research (robotics,
signal and image processing [2,3], etc.). In image
processing the reconstruction of noise image is a
problem which can be solved with different
methods. For that purpose the class of stack filter
is developed. Standard median filter removes
impulse noise and preserve image edges [2].
However, median filter has detail preserving
difficulties. Weighted median is useful because of
their flexibility. In weighted median filter weights
are used to preserve image details and suppress
noise as well [3]. For that purpose the new filter
represented by thresholds are developed based on
relation between center weight median and
distance to center observation. In that case an
(−∞, ๐‘ฆ(1) ), [๐‘ฆ(1) , ๐‘ฆ(2) ), … , [๐‘ฆ(๐‘›−1) , ๐‘ฆ(๐‘›) ), (๐‘ฆ(1) , ∞),
(4)
๐น is a linear function and slopes of those linear
function are consecutively ๐‘˜โ„Ž , โ„Ž = 0, … , ๐‘›, where
๐‘›
๐‘›
๐‘˜0 = − ∑ ๐‘ค๐‘– , ๐‘˜๐‘› = ∑ ๐‘ค๐‘– ,
๐‘–=1
(5)
๐‘–=1
and for โ„Ž = 1, … , ๐‘› − 1
โ„Ž
๐‘›
๐‘˜0 = 2 ∑ ๐‘ค(๐‘–) − ∑ ๐‘ค๐‘– = ๐‘˜โ„Ž−1 + 2๐‘ค(โ„Ž) .
๐‘–=1
(6)
๐‘–=1
Since ๐‘˜โ„Ž+1 − ๐‘˜โ„Ž = 2 ๐‘ค(โ„Ž+1) > 0, the sequence
(๐‘˜โ„Ž ) is increasing and
๐‘˜0 < ๐‘˜1 < โ‹ฏ < 0 ≤ ๐‘˜๐‘™+1 < โ‹ฏ < ๐‘˜๐‘› .
(7)
It fallows from (7)
that ๐น is decreasing on
(−∞, ๐‘ฆ(๐‘™+1) ) and increasing on
(๐‘ฆ(๐‘™+1) , ∞),
therefore the minimum of ๐น is attained for
med(๐’˜, ๐’š) = ๐‘ฆ(๐‘™+1) .โˆŽ
Vedran Novoselac and Zlatko Paviฤ‡
1
7th International Scientific and Expert Conference TEAM 2015
Technique, Education, Agriculture & Management
Belgrade, October 15-16, 2015
The next theorem shows relation between the
center weight vector ๐’˜(๐‘ฅ) = [1, … , ๐‘ฅ, … ,1]๐‘‡ and
|๐‘ฆ๐‘˜ − med(๐’˜(๐‘ฅ), ๐’š)|.
Theorem 2 Let ๐’š = [๐‘ฆ1 , … , ๐‘ฆ๐‘› ]๐‘‡ , ๐‘› = 2๐‘˜ − 1, be
data vector with weight vector
๐’˜(๐‘ฅ) =
[1, … , ๐‘ฅ, … ,1]๐‘‡ . Then
๐น(๐‘ฅ) = |๐‘ฆ๐‘˜ − med(๐’˜(๐‘ฅ), ๐’š)|,
(8)
is monotonically decreasing on ๐ท๐น = [1, ∞).
Proof. Let 1 ≤ ๐‘ฅ1 ≤ ๐‘ฅ2 . If ๐‘ฆ๐‘˜ = ๐‘ฆ(๐‘˜) the function ๐น is
constant an the proof in this case is trivial.
Suppose that ๐‘˜′ correspond to position of ๐‘ฆ๐‘˜ in
ordered observation and ๐‘˜ ′ ≤ ๐‘˜. In this case from
Theorem 1 it is easy to see that med(๐’˜, ๐’š) = ๐‘ฆ(๐‘™+1)
where ๐‘™ + 1 ∈ [๐‘˜ ′ , ๐‘˜]. So it is sufficiently to indicate
that ๐‘™1 ≥ ๐‘™2 where
med(๐’˜(๐‘ฅ1 ), ๐’š) = ๐‘ฆ(๐‘™1 +1) ,
(9)
and
med(๐’˜(๐‘ฅ2 ), ๐’š) = ๐‘ฆ(๐‘™2 +1) .
Situation when center weights are ๐‘ฅ1 , ๐‘ฅ2 ≥
1
(10)
1
2
(or
๐‘ฅ2 ≥ ) indicate that ๐‘™1 + 1 = ๐‘™2 + 1 = ๐‘˜′, and
2
statement of theorem is proven. neighborhoods
๐‘›
Observed nontrivial case is when ๐‘ฅ1 , ๐‘ฅ2 ≤ , i.e.
2
๐‘™1 + 1, ๐‘™2 + 1 > ๐‘˜′. In that situation, according to
Theorem 1, it can be conclude that
๐‘› − ๐‘ฅ1 − 1
(11)
๐‘™1 = max {โ„Ž: โ„Ž <
},
2
and
๐‘› − ๐‘ฅ2 − 1
(12)
๐‘™2 = max {โ„Ž: โ„Ž <
},
2
what directly implies statement of theorem
because ๐‘ฅ1 ≤ ๐‘ฅ2 .
Situation when ๐‘˜ ′ > ๐‘˜ is considered also when
๐‘›
๐‘ฅ1 , ๐‘ฅ2 ≤ , otherwise the proof is trivial. Considered
2
that case, it can be conclude that ๐‘™1 + 1, ๐‘™2 + 1 < ๐‘˜′,
and it is sufficiently to indicate that ๐‘™1 ≤ ๐‘™2 .
According to Theorem 1 it can be conclude that
๐‘™1 = max {โ„Ž: โ„Ž <
๐‘› + ๐‘ฅ1 − 1
},
2
(13)
๐‘™2 = max {โ„Ž: โ„Ž <
๐‘› + ๐‘ฅ2 − 1
}.
2
(14)
and
From (13) and (14) the theorem is proven, i.e. ๐‘™1 ≤
๐‘™2 , because ๐‘ฅ1 ≤ ๐‘ฅ2 .โˆŽ
3. Adaptive center weighted median filter
X = [๐‘ฅ๐‘–๐‘— ](๐‘–,๐‘—)∈๐›บ
โ‹ฏ
โ‹ฑ
โ‹ฏ
๐‘ฅ0,๐‘€−1
โ‹ฎ
].
๐‘ฅ๐‘−1,๐‘€−1
(15)
In such a system, the indices (๐‘–, ๐‘—) ∈ ๐›บ of the
image matrix correspond to (๐‘–, ๐‘—)-th image intensity
๐‘ฅ๐‘–๐‘— . The term grey level is often to refer to the
intensity of monochrome image. In that situation
the matrix elements (image pixels) are integers in
the range [0, … ,255].
Digital images are often corrupted by impulse
noise
during
the
transmission
through
communication channels. It appears as black or
withe impulses on the image. It can be modeled as
follows:
๐œ‰๐‘–๐‘— ,
๐‘ฆ๐‘–๐‘—= {
๐‘ฅ๐‘–๐‘— ,
with probability ๐œŒ,
with probability 1 − ๐œŒ,
(16)
where X = [๐‘ฅ๐‘–๐‘— ](๐‘–,๐‘—)∈๐›บ denote original image, Y =
[๐‘ฆ๐‘–๐‘— ](๐‘–,๐‘—)∈๐›บ noisy image, and ๐œŒ noise ratio. For a
impulse noise ๐œ‰๐‘–๐‘— is probability distribution with
corresponding probability density function
๐‘ƒ๐‘ ,
๐‘ƒ(๐œ‰๐‘–๐‘— ) = { ๐‘ƒ๐‘  ,
0,
for ๐œ‰๐‘–๐‘— = ๐‘,
for ๐œ‰๐‘–๐‘— = ๐‘ ,
otherwise,
(17)
where ๐‘ƒ๐‘ + ๐‘ƒ๐‘  = 1 and ๐‘ƒ๐‘ , ๐‘ƒ๐‘  ≥ 0. Most usually
observed situation is when ๐‘ = 0, ๐‘  = 255, and
๐‘ƒ๐‘ = ๐‘ƒ๐‘  = 0,5.
In image processing, filters are constructed to
process every image element ๐‘ฆ๐‘–๐‘— , (๐‘–, ๐‘—) ∈ ๐›บ. In that
way reconstructed image ๐‘‹ ∗ = [๐‘ฅ ∗ ๐‘–๐‘— ](๐‘–,๐‘—)∈๐›บ is
constructed. Filter process different neighborhoods
of ๐‘ฆ๐‘–๐‘— where 3 × 3 filtering window are most
commonly used for impulse noise. In that case
filtering window is defined as
๐‘Œ๐‘–๐‘— = {๐‘ฆโ„Ž๐‘™ : |โ„Ž − ๐‘–| ≤ ๐œ” & |๐‘™ − ๐‘—| ≤ ๐œ”},
(18)
where ๐œ” denotes size window which is in our case
is ๐œ” = 3. Filtering window ๐‘Œ๐‘–๐‘— can be presented as
a vector ๐’š๐‘˜ = [๐‘ฆ1 , … , ๐‘ฆ๐‘› ]๐‘‡ , ๐‘š = ๐œ”2 , where ๐‘˜ = ๐‘– โˆ™
๐‘ + ๐‘— correspond to (๐‘–, ๐‘—)-th position.
In this paper adaptive center weighted median filter
(ACWMF) is proposed. Ideally the filtering should
be applied only to the noisy pixels, and noise-free
pixels should be kept unchanged. So, in filter is
implemented a noise detector. We proposed an
scheme by successfully combining center
weighted median filters [3] and compares them
with the observed pixel value. The output of
proposed ACWMF is obtained by
The digital image can be represented ๐‘ × ๐‘€ matrix
of the form:
2
๐‘ฅ0,0
=[ โ‹ฎ
๐‘ฅ๐‘−1,0
Adaptive Center Weighted Median Filter
7th International Scientific and Expert Conference TEAM 2015
Technique, Education, Agriculture & Management
Belgrade, October 15-16, 2015
๐‘ฆ๐‘–๐‘— ,
๐‘ฅ ∗ ๐‘–๐‘— = {med(๐’˜(๐‘ฅ1 ), ๐’š๐‘˜ ),
med(๐’˜(๐‘ฅ2 ), ๐’š๐‘˜ ),
๐œ€ ≥ ๐‘‘1 ,
๐œ€ < ๐‘‘2 ,
๐‘‘2 ≤ ๐œ€ < ๐‘‘1 .
(19)
In proposed method ๐‘‘1 and ๐‘‘2 are defined as ๐‘‘1 =
|๐‘ฆ๐‘–๐‘— − med(๐’˜(๐‘ฅ1 ), ๐’š๐‘˜ )|,
and
๐‘‘2 = |๐‘ฆ๐‘–๐‘— −
med(๐’˜(๐‘ฅ2 ), ๐’š๐‘˜ )| respectively, where 1 ≤ ๐‘ฅ1 ≤ ๐‘ฅ2 .
The definition of (19) follows the property that ๐‘‘1 ≥
๐‘‘2 , showed by Theorem 2. Note that threshold ๐œ€
affects the performance of impulse detection. As a
results, impulse noise can be removed while
uncorrupted pixels remain unchanged in order to
preserve the image details. Consequently, the
trade off between suppressing noise and
preserving detail is well balanced. In the following
section we study influence of center weights ๐‘ฅ1 , ๐‘ฅ2 ,
and threshold ๐œ€ on the filtering performance using
variety of the test images.
4. Experimental results
range [30,60]. In figure 2 are presented PSNR
filtering results of median filter (MF) [2], and
ACWMF (๐œ€ = 40) for Lena and Mandrill test
images for a noise ratio ๐œŒ ∈ [0,05, 0,5].
(a)
(b)
Figure 2. Filtering results: (a) Lena, (b) Mandrill
Referring to figure 3, one can see that the noise
suppression
and
detail
preservation
are
satisfactorily compromised by using our proposed
method (d) as compared to using standard median
filter (c).
The quality measure of proposed ACWMF has
been experimented with center weights ๐‘ฅ1 = 1 and
๐‘ฅ2 = 2. The measures are provided via PSNR
(Peak Signal-to-Noise Ratio) metric defined as
PSNR = 20 log10
255
√MSE
,
(20)
where MSE (Mean Squared Error) is defined as
MSE =
๐‘−1
∗
2
∑๐‘€−1
๐‘–=0 ∑๐‘—=0 (๐‘ฅ๐‘–๐‘— − ๐‘ฅ ๐‘–๐‘— )
๐‘€×๐‘
(a)
(b)
(c)
(d)
(21)
.
PSNR quality measure is appropriate for insight of
impulse reducing because of its robust properties
to outliers [4]. The PSNR via threshold ๐œ€ is
graphically presented in figure 1 for 256 × 256 test
images Lena and Mandrill corrupted with impulse
noise ๐œŒ = 0,2.
.
Figure 3. Results of filtering for: (a) original, (b)
noisy image (๐œŒ = 0,2), (c) MF, (d) ACWMF
5. Conclusion
Figure 1. Results of PSNR via threshold ๐œ€
It can be seen that the PSNR performance is
significantly improved by using threshold ๐œ€ in the
In this work a new median filter ACWMF is
introduced. By incorporating the weighted median
into an impulse noise detection framework is
formed for effectively reducing impulse noise while
preserving image details. Given a specified
threshold ๐œ€ the output of our proposed ACWMF
may correspond to one of three possible states,
namely the origin pixel value (i.e., the pixel is
noise-free), or one of the center weighted output.
Vedran Novoselac and Zlatko Paviฤ‡
3
7th International Scientific and Expert Conference TEAM 2015
Technique, Education, Agriculture & Management
Belgrade, October 15-16, 2015
The proposed methodology remains applicable to
adjust center weights ๐‘ฅ1 , ๐‘ฅ2 , and threshold ๐œ€
according to different noise ratio ๐œŒ. In addition, the
proposed filter present a quite stable performance
over a wide variety of image.
[2]
[3]
6. References
[1]
4
C. Gurwitz, “Weighted median algorithms for
๐ฟ1
approximation”,
BIT
Numerical
Mathematics 12(2002), 524-560.
[4]
V. Novoselac, S. Rimac-Drlje, “Svojstva I
primjena
aritmetiฤke
sredine”,
Osjeฤki
matematiฤki list, 14(2014), 1;51-67.
V. Novoselac, B. Zovko-Cihlar, “Image Noise
Removal
by
Vector
Median
Filter”,
Proceedings ELMAR-2012, Croatian Society
Electronics in Marine-ELMAR, 2012, 57-62.
P. J. Rousseeuw, A. M. Leroy, “Robust
Regression and Outlier Detection”, Whiley,
New
York,
2003.
Adaptive Center Weighted Median Filter
Download