1 / 43

LỌC NHIỄU trong miền không gian

LỌC NHIỄU trong miền không gian. Lọc nhiễu trong miền không gian. Arithmetic mean Filter Geometric mean filter Harmonic mean filter Contra-harmonic mean filter Meadian filter Max-and-min filter Alpha-trimed mean filter Gausian filter. Mô hình khôi phục ảnh.

dmendivil
Download Presentation

LỌC NHIỄU trong miền không gian

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. LỌC NHIỄUtrong miền không gian

  2. Lọc nhiễu trong miền không gian • Arithmetic mean Filter • Geometric mean filter • Harmonic mean filter • Contra-harmonic mean filter • Meadian filter • Max-and-min filter • Alpha-trimed mean filter • Gausian filter

  3. Mô hình khôi phục ảnh g(x,y) = f(x,y)*h(x,y) + n(x,y), (x,y) f(x,y) - ảnh đầu vào (ảnh gốc) h(x,y) – hàm tác động ảnh n(x,y) – nhiễu cộng g(x,y) - ảnh nhận được Tiêu chí: Ảnh g(x,y) phải gần với ảnh f(x,y) g(x,y)  f(x,y), (x,y)

  4. Xét mô hình Mô hình khôi phục ảnh g(x,y) = f(x,y) + n(x,y),  (x,y) n(x,y) – nhiễu cộng, tuần hoàn

  5. Mean Filters Kí hiệu W(x, y) là một lân cận chữ nhật kích thước ab của điểm (x, y) (điểm (x,y) trùng với tâm hình chữ nhật). 1. Arithmetic Mean Filter Thông thường, W(x,y) được chọn là lân cận 3×3 của (x,y)

  6. Mean Filters (i,j) = 1, (i,j)  W(x,y)\{x,y), (x,y) = 2, =10 (i,j)  {1, 2, 4} (i,j)  W(x,y) =16 (i,j) = 1, (i,j)  W(x,y), =9 1. Arithmetic Mean Filter

  7. Mean Filters 1. Arithmetic Mean Filter

  8. Mean Filters For y = 2 To H - 1 For x = 2 To W - 1 ds = Hx(1,1)*f(y-1, x-1) + Hx(1,2)*f(y-1,x) + Hx(1,3)*f(y-1,x+1) Hx(2,1)*f(y, x-1) + Hx(2,2)*f(y, x) + Hx(2,3)*f(y, x+1) Hx(3,1)*f(y+1,x-1) + Hx(3,2)*f(y+1,x) + Hx(3,3)*f(y+1,x+1 Q(y, x) = Round(ds / dt) Next: Next 1. Arithmetic Mean Filter For y = 2 To H - 1 For x = 2 To W - 1 ds = 0 For p = 1 To 3 For q = 1 To 3 ds = ds + Hx(p, q) * f(y + p - 2, x + q - 2) Next: Next Q(y, x) = Round(ds / dt) Next: Next

  9. 1. Arithmetic Mean Filters

  10. Mean Filters W(x, y) là lân cận chữ nhật kích thước ab của điểm (x, y) 2.Geometric Mean Filter Thông thường, W(x,y) được chọn là lân cận 3×3 của (x,y)

  11. Mean Filters For y = 2 To H - 1 For x = 2 To W - 1 ds = f(y-1, x-1) * f(y-1,x) * f(y-1,x+1) * f(y, x-1) * f(y, x) * f(y, x+1) * f(y+1,x-1) * f(y+1,x) * f(y+1,x+1 Q(y, x) = ds^(1/9) Next: Next 2.Geometric Mean Filter For y = 2 To H - 1 For x = 2 To W - 1 ds = 1 For p = 1 To 3 For q = 1 To 3 ds = ds * f(y + p - 2, x + q - 2) Next: Next Q(y, x) = Round(ds ^(1/9)) Next: Next

  12. Mean Filters 2.Geometric Mean Filter

  13. Mean Filters W(x, y) là lân cận chữ nhật kích thước ab của điểm (x, y) 3.Harmonic Mean Filter Thông thường, W(x,y) được chọn là lân cận 3×3 của (x,y)

  14. Mean Filters For y = 2 To H - 1 For x = 2 To W - 1 ds = 0 For p = 1 To 3 For q = 1 To 3 ds = ds + (1/ f(y + p - 2, x + q - 2)) Next: Next Q(y, x) = Round (9 / ds) Next: Next 3.Harmonic Mean Filter

  15. Mean Filters 3.Harmonic Mean Filter

  16. W(x, y) là lân cận chữ nhật kích thước ab của điểm (x, y) 4.Contraharmonic Mean Filter Thông thường, W(x,y) được chọn là lân cận 3×3 của (x,y) Khi Q = -1, contraharmonic trở thành harmonicmean filter.

  17. For y = 2 To H - 1 For x = 2 To W - 1 dt = 0 dm=0 For p = 1 To 3 For q = 1 To 3 dt = dt + (f(y + p - 2, x + q - 2))^(Q+1) dm = dm + (f(y + p - 2, x + q - 2))^Q Next: Next Q(y, x) = Round (dt / dm) Next: Next 4.Contraharmonic Mean Filter

  18. 4.Contraharmonic Mean Filter

  19. Ảnh gốc Q= -3 Q=-2 Q=-1 Q= 3 Q= 2 Q= 1 Q = 0 4.Contraharmonic Mean Filter

  20. abc def 4.Contraharmonic Mean Filter • Q=-2 • Ảnh gốc • Q=2 • Q=-1 • Q=0 • Q=1

  21. g(x, y) = median {f(i,j), (i,j)  W(x,y)} Let given sequence of numbers: x1, x2, ..., xm, xm+1, xm+2,..., x2m, x2m+1 (1) 5. Median filter The value xk {x1,...,x2m+1} is called median of sequence (1) if exist: m elements from {x1,...,x2m+1}\{xk} are not greater than xk, and m others not smaller than xk

  22. Example 1 The median of sequence 1, 2, 9, 5, 4 equal 4 because 2 entries: {1, 2} are not bigger than 4 and 2 others: {9, 5} are not smaller than 4. 5. Median filter

  23. Example 2 The median of sequence 15, 17, 18, 16, 78, 17, 17, 15, 20 equal 17 because 4 entries are not bigger than 17 and 4 others are not smaller than 17 5. Median filter 15, 17,18, 16, 78, 17, 17, 15, 20

  24. 5. Median filter The original image and filtered by median filter

  25. The original image and filtered by median filter Effect: For images corrupted by bipolar or unipolar impulse noise – called salt-and-pepper noise (particularly effective) 5. Median filter

  26. Put the windows 33 such that center of the windows at the point (x, y). • Order the pixels of the windows to a sequence in brightness from smallest to largest • Set g(x, y) = centered of a sequence Put to sequence 15, 17, 18, 16, 78, 17, 17, 15, 20 5. Median filter Odered sequence 15, 15, 16, 17, 17, 17, 18, 20, 78 g(x,y) = 17

  27. 5. Median filter • For y = 2 To H - 1 • For x = 2 To W - 1 • For k = 1 To 3 • For q = 1 To 3 • D((k-1)*3+q) = f(y+k-2, x+q-2) • Next k: Next q • Sort: D(1)  D(2)  ...  D(9) • g(x,y) = D(5) • Next x: Next y

  28. Max and min filter Max filter For 1 y M, 1x N: f^(x, y) = max {f(i, j): (i, j)  W(x, y) }, Min filter For 1 y M, 1x N: f^(x, y) = min {f(i, j): (i, j)  W(x, y) }, Midpoint Filter For 1 y M, 1x N: f^(x, y) =[min{f(i, j):(i, j)W(x, y)}+ max{f(i, j):(i, j)W(x, y)}]/2

  29. Max filter • For y = 1 To H - 2 • For x = 1 To W - 2 • 1) For k = 1 To 3 • For q = 1 To 3 • D((k-1)*3+q) = Getpixel(y+k-2, x+q-2) • Next k: Next q • 2) Sort D: D(1)  D(2)  ...  D(9) • 3) f^(x,y) = D(9) • Next x: Next y

  30. Min filter • For y = 1 To H - 2 • For x = 1 To W - 2 • 1) For k = 1 To 3 • For q = 1 To 3 • D((k-1)*3+q) = Getpixel(y+k-2, x+q-2) • Next k: Next q • 2) Sort D: D(1)  D(2)  ...  D(9) • 3) f^(x,y) = D(1) • Next x: Next y

  31. Midpoint filter • For y = 1 To H - 2 • For x = 1 To W - 2 • 1) For k = 1 To 3 • For q = 1 To 3 • D((k-1)*3+q) = Getpixel(y+k-2, x+q-2) • Next k: Next q • 2) Sort D: D(1)  D(2)  ...  D(9) • 3) f^(x,y) = (D(1)+D(9))/2 • Next x: Next y

  32. Define: • m, n are dimentions of neighborhood W(x,y) • d is an integer value in range [0..mn-1] • fr(x,y) is remaning of f(x,y) after deletion d/2 lowest and d/2 highest in W(x,y) Alpha-trimmed mean filter • remark: • If d=0 Alpha-trimmed mean filter become arthmetic filter • If d=mn-1 Alpha-trimmed mean filter become median filter

  33. a bcde Alpha-trimmed mean filter • Origin image • d = 0 • d = 2 • d = 4 • d = 6

  34. ab cde • Origin image • d = 0 • d = 2 • d = 4 • d = 6 Alpha-trimmed mean filter

  35. ab cde • Origin image • d = 0 • d = 2 • d = 4 • d = 6 Alpha-trimmed mean filter

  36. Alpha-trimmed mean filter • Origin image d = 6

  37. d = ? For i = 2 To H - 1 For j = 2 To W - 1 x(1..9) = f(i -1..i+1, j – 1..j+1) Sắp xếp: x(1) ≤.... ≤x(9) g(i, j) = {x(d/2) +...+x(9-d/2)}/(9-d) Alpha-trimmed mean filter

  38. d = ? For i = 2 To H - 1 For j = 2 To W - 1 For k = 1 To 3 For q = 1 To 3 x((k - 1) * 3 + q) = f(i + k - 2, j + q - 2) For t = 1 To 8 k = t For v = k To 9 If x(v) < x(k) Then k = v tg = x(k): x(k) = xx(t): xx(t) = tg ts = 0 For t = 1 + d/2 to 9 - d/2 ts = ts + x(t) g(i, j) = ts/(9-d) Alpha-trimmed mean filter

  39. where: • x is the distance from the origin in the horizontal axis, • y is the distance from the origin in the vertical axis, and • σ is the standard deviation of the Gaussian distribution. Gauusian smoothing

  40. Gausian smoothing This figure shows a suitable integer-valued convolution kernel that approximates a Gaussian with a of 1.0 and distance from origin is 2

  41. Gausian smoothing The original and filtered images byte gaussian smoothing operation

  42. Gausian smoothing The original and filtered images byte gaussian smoothing operation

  43. Gausian smoothing The original and filtered images byte gaussian smoothing operation

More Related