Presentation is loading. Please wait.

Presentation is loading. Please wait.

Two-Dimensional Filters Digital Image Processing Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences National Cheng Kung University.

Similar presentations


Presentation on theme: "Two-Dimensional Filters Digital Image Processing Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences National Cheng Kung University."— Presentation transcript:

1 Two-Dimensional Filters Digital Image Processing Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences National Cheng Kung University Last updated: 24 September 2003 Chapter 5

2 Introduction  Filter an image Kill or modify certain frequency components Multiply the Fourier transform of the image with a filter function Use convolution to avoid using the Fourier transform itself Omit or enhance some details

3 Definition  2D filter (the system function) H( , ) = [1/(2  ]  -    -   h(n,m)e -j(  n+ m)  The unit sample response h(k,l) = [1/(2  ]  -    -   H( , )e j(  k+ l) d  d  The filter function in the real domain h(k,l) = [1/(2  ]  -    -   H( , )cos(  k+ l)d  d H( , ) = [1/(2  ]  -    -   h(n,m)cos(  n+ m) Example 5.1  Convolution instead of using the Fourier transform  1D case, analogous to 2D case (Fig 5.1)

4 Convolution filter  For h(k,l) to be a convolution filter h(k,l) = 0 for k > K and l > L The filter must be a finite array of numbers  Idea filters don’t fulfill this condition The unit sample response of the ideal lowpass filter  B5.1: h(k,l) = R(k 2 +l 2 ) -1/2 J 1 (R(k 2 +l 2 ) 1/2 )  2D  h(k) = sink / k  1D (Fig 5.2: comparison of 1D and 2D) The unit sample response of the ideal bandpass filter  Example 5.1: h(k,l) = (k 2 +l 2 ) -1/2 [R 2 J 1 (R 2 (k 2 +l 2 ) 1/2 ) – R 1 J 1 (R 1 (k 2 +l 2 ) 1/2 )] The unit sample response of the ideal highpass filter  Example 5.2: there is no real domain function that has as Fourier transform the ideal highpass filter

5 z-transform  Definition X(z) =  k=1 m x k z -k  l and m are defined according to which term of the string of number {x k } is assumed to be the k = 0 term  If the filter is of infinite extent X(z) =  -   x k z -k Usually express X(z) in closed form as H(z) =  i=0 Ma a i z i /  i=0 Mb b i z i  Advantage of the z-transform Can be easily realized in hardware Obey the convolution theorem

6 2D z-transform  Definition H(z 1, z 2 ) =  i=0 M  j=0 N c ij z 1 i z 2 j  Usually express H(z 1, z 2 ) as H(z 1, z 2 ) =  i=0 Ma  j=0 Na a ij z 1 i z 2 j /  i=0 Mb  j=0 Nb b ij z 1 i z 2 j  M a, N a, M b, N b are some integers  Conventionally we choose b 00 = 1

7 Recursive filter  The extent of a filter  recursive or not R(z 1, z 2 ) =  i=0 M  j=0 N r ij z 1 i z 2 j = H(z 1, z 2 ) D(z 1, z 2 )  D(z 1, z 2 ): z-transform of input image  H(z 1, z 2 ): z-transform of filter  R(z 1, z 2 ): z-transform of output image R(z 1, z 2 )  i=0 Mb  j=0 Nb b ij z 1 i z 2 j =  i=0 Ma  j=0 Na a ij z 1 i z 2 j D(z 1, z 2 ) R(z 1, z 2 ) =  i=0 Ma  j=0 Na a ij z 1 i z 2 j D(z 1, z 2 ) - [  i=0 Mb  j=0 Nb b ij z 1 i z 2 j ]R(z 1, z 2 )  [  i=0 Mb  j=0 Nb b ij z 1 i z 2 j ]: i and j are not both zero  Recursive: the value of r mn can be calculated in terms of the previously calculated values of r mn  In the case of a finite filter  all b kl = 0, except b 00 = 1  no recursive Example 5.3

8 Approximation theory  An alternative to using infinite H( , ) Decide upon the desired system function F( , ) Choose a finite filter H( , ) that approximate F awap Chebysheu norm  Error = ||F( , ) - H( , )||  max ( , ) |F( , ) - H( , )| The best approximation  Error = min{max ( , ) |F( , ) - H( , )|}  Fig 5.5 Total square error   F( , ) - H( , )  2 d  d  3 techniques of designing 2D filters Windowing, frequency sampling, linear programming

9 Windowing  Windowing method Truncate an infinite impulse response at some desired size Problem  Sharp edge  Fourier transform  high frequency ripples Solution  Replace the sharp-edge window by a smooth window  Several such smooth windows have been developed for the case of 1D signals Extend 1D window to 2D  not hazard free  Not an optimal approximation  See Fig 5.2 and discussion

10 Linear programming  Linear programming problem (LPP) An optimization method to solve the problem Minimize: z = c 1 T x 1 + c 2 T x 2 + d Subject to:  A 11 x 1 + A 12 x 2  B 1 (p 1 inequality constraints)  A 21 x 1 + A 22 x 2 = B 2 (p 2 equality constraints)  x 1i  0 (n 1 variables x 1 )  x 2j free (n 2 variables x 2 ) Where:  c 1, c 2, B 1, B 2 are vectors  A 11, A 12, A 21, A 22, are matrices  x 1, x 2 are vectors made up from variables x 1i and x 2j respectively

11 Linear programming (cont.)  Filter design problem  LPP H( , ) =  n=-N N  m=-N N h(n,m)e -j(  n+ m)  Where h(n,m) is the digitized finite filter that we want to use, and h(n,m) are real numbers If h( , ) = h(-,  )  H( , ) is real  B5.3: H( , ) = 2  n=-N N  m=1 N h(n,m) cos(  n+ m) + 2  n=1 N h(n,0) cos(  n) + h(0,0)  Free variables: (2N+1)N + N + 1 = 2N 2 + 2N + 1 Choose h(i, j) so that    max ( , ) |H( , ) - F( , )|  |H(  i, i ) - F(  i, i )| for i = 1, 2, …, p 1  Inequality constraints: 2

12 Linear programming (cont.)  Filter design problem  LPP (cont.) Minimize: z = x 11 Under the constraints:  A 11 x 11 + A 12 x 2  B 1 (2p 1 inequality constraints)  x 11  0 (one non-negative variable)  x 2j free (2N 2 + 2N + 1 free variables)  Drawback Lots of constraint points are required for a given number of required coefficients

13 Iterative approach  Philosophy of the iterative approach Breaking the LPP into a series of small ones Fig 5.6: fit a surface gradually  Maximizing algorithm Simultaneously increase the lower limit of the error and decrease its upper limit Works by making use of two concepts  Limiting set of equations  La Valle Poussin theorem

14 Iterative approach (cont.)  Limiting set of equations  m  F(  m, m ) -  i=1 n c i g i (  m, m ) m = 1, 2, …, M Limiting if  All  m  0  |  m | cannot simultaneously be reduced for any choice of c  La Valle Poussin theorem min X |P - F|  max X |P * - F|  max X |P - F|  The best approximation: P *   i=1 n c i * g i (  m, m )  Any other approximation: P   i=1 n c i g i (  m, m )  Error of the best Chebyshev approximation: max X |P * - F|

15 Iterative approach (cont.)  Steps Choose a subset X k of the set of points X Choose the best approximation in X k  P k ( , )   i=1 n c i k g i ( , )  Error in X k :  k  max Xk |P - F|  Error in the whole set X: E k  max X |P - F| Include an extra point in a new subset X k+1  Error in X k+1 :  k+1  max Xk+1 |P - F| La Vallee Poussin theorem:  k   k+1  E k Narrow the double inequality by increasing its lower limit

16 Iterative approach (cont.)  Working in the frequency domain B5.4 Example 5.4


Download ppt "Two-Dimensional Filters Digital Image Processing Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences National Cheng Kung University."

Similar presentations


Ads by Google