Sie sind auf Seite 1von 13

C. A.

Bouman: Digital Image Processing - January 29, 2013

Nonlinear Filtering
Linear lters Tend to blur edges and other image detail. Perform poorly with non-Gaussian noise. Result from Gaussian image and noise assumptions. Images are not Gaussian. Nonlinear lter Can preserve edges Very effective at removing impulsive noise Result from non-Gaussian image and noise assumptions. Can be difcult to design.

C. A. Bouman: Digital Image Processing - January 29, 2013

Linear Filters
Denition: A system y = T [x] is said to be linear if for all , I R y1 + y2 = T [x1 + x2] where y1 = T [x1] and y2 = T [x2]. Any lter of the form ys =
r

hs,r xr

C. A. Bouman: Digital Image Processing - January 29, 2013

Homogeneous Filters
Denition: A lter y = T [x] is said to be homogeneous if for all I R y = T [x]

This is much weaker than linearity. Homogeneity is a natural condition for scale invariant systems.

C. A. Bouman: Digital Image Processing - January 29, 2013

Median Filter
Let W be a window with an odd number of points. Then the median lter is given by ys = median {xs+r : r W } Is the median lter: Linear? Homogeneous?

Consider the 1-D median lter with a 3-point window. x(m) 0 y(m) ? 0 0 1 1 1,000 1 1 1 1 1 2 2 2 ?

C. A. Bouman: Digital Image Processing - January 29, 2013

Median Filter: Optimization Viewpoint


Consider the median lter ys = median {xs+r : r W } and consider the following functional. F s ( ) =
r W

| x s+ r |

Then ys solves the following optimization equation. ys = arg min Fs()

Differentiating, we have d d F ( ) = d d =

| x s+ r |
r W

sign( xs+r )
r W

= f ( ) This expression only holds for = xs+r for all r W . So the solution falls at = xs such that 0=
r=(ss)
r W

sign( xs+r )

C. A. Bouman: Digital Image Processing - January 29, 2013

Example: Median Filter Function


Consider a 1-D median lter Three point window of W = {1, 0, 1} Inputs [x(n 1), x(n), x(n + 1)] = [2, 4, 5].
1

F ( ) =
k = 1

| xn + k |

Median Function F() 35 30 Value of Functional 25 20 15 10 5 10

0 Output value

10

C. A. Bouman: Digital Image Processing - January 29, 2013

Example: Derivative of Median Filter Function


Consider a 1-D median lter Three point window of W = {1, 0, 1} Inputs [x(n 1), x(n), x(n + 1)] = [2, 4, 5].
1

f ( ) =
k = 1

sign( xn+k )

Derivative of Median Function f() 4 3 Value of Functional 2 1 0 1 2 3 4 10 5 0 Output value 5 10

C. A. Bouman: Digital Image Processing - January 29, 2013

Problem with an Even Number of Points


Consider a 1-D median lter Four point window of W = {1, 0, 1, 2} Inputs [x(n1), x(n), x(n+1), x(n+2)] = [2, 4, 5, 6]. Solution is not unique.
2

F ( ) =
k = 1

| xn + k |

Median Function F() 45 40 Value of Functional 35 30 25 20 15 10

0 Output value

10

C. A. Bouman: Digital Image Processing - January 29, 2013

Weighted Median Filter


Dened the functional F ( ) =
r W

ar | xs+r |

where ar are weights assigned to each point in the window W. Weighted median is computed by ys = arg min
r W

ar | xs+r |

Differentiating, we have d d F ( ) = d d =
r W

ar | xs+r |
r W

ar sign( xs+r )

= f ( ) This expression only holds for = xr for all r W . Need to nd s such that f () is nearly zero.

C. A. Bouman: Digital Image Processing - January 29, 2013

10

Example: Weighted Median Filter Function


Consider a 1-D median lter Five point window of W = {2, 1, 0, 1, 2} Inputs [x(n 2), , x(n + 2)] = [6, 2, 4, 5, 1]. Weights [a(2), a(1), a(0), a(1), a(2)] = [1, 2, 4, 2, 1].
1

F ( ) =
k = 1

a(k )| xn+k |

Weighted Median Function F() 110 100 Value of Functional 90 80 70 60 50 40 30 10 5 0 Output value 5 10

C. A. Bouman: Digital Image Processing - January 29, 2013

11

Example: Derivative of Median Filter Function


Consider a 1-D median lter Five point window of W = {2, 1, 0, 1, 2} Inputs [x(n 2), , x(n + 2)] = [6, 2, 4, 5, 1]. Weights [a(2), a(1), a(0), a(1), a(2)] = [1, 2, 4, 2, 1].
1

f ( ) =
k = 1

a(k ) sign( xn+k )

Derivative of Weighted Median Function f() 10

Value of Functional

10 10 5 0 Output value 5 10

C. A. Bouman: Digital Image Processing - January 29, 2013

12

Computation of Weighted Median


1. Sort points in window. Let x(1) x(2) x(p) be the sorted values. These values are known as order statistics. Let a(1), a(2), , a(p) be the corresponding weights. 2. Find i such that the following equations hold
i1 p

ai +
i=1 i1

a(i)
i=i+1 p

a(i) a(i) + ai
i=i+1

a(i)
i=1

3. Then the value x(i) is the weighted median value.

C. A. Bouman: Digital Image Processing - January 29, 2013

13

Comments on Weighted Median Filter


Weights may be adjusted to yield the best lter. Largest and smallest values are ignored. Same as median lter for ar = 1.

Das könnte Ihnen auch gefallen