filtering images restoration
play

Filtering images restoration University of the Philippines - - PowerPoint PPT Presentation

Filtering images restoration University of the Philippines - Diliman 2006 Diane Lingrand lingrand@polytech.unice.fr http://www.polytech.unice.fr/~lingrand 1 Image processing, 2006, lingrand@polytech.unice.fr Noise : causes and modeling


  1. Filtering – images restoration University of the Philippines - Diliman 2006 Diane Lingrand lingrand@polytech.unice.fr http://www.polytech.unice.fr/~lingrand 1 Image processing, 2006, lingrand@polytech.unice.fr

  2. Noise : causes and modeling Observe silence ! 2 Image processing, 2006, lingrand@polytech.unice.fr

  3. 3 Image processing, 2006, lingrand@polytech.unice.fr

  4. 4 Image processing, 2006, lingrand@polytech.unice.fr

  5. 5 Image processing, 2006, lingrand@polytech.unice.fr

  6. http://memory.loc.gov/ ammem/awlhtml/awlhome.html 6 Image processing, 2006, lingrand@polytech.unice.fr

  7. Noise sources Acquisition context • – Under- or over-lighting – Sensors disturbance Sensor • – Distorsions (geometrical, intensity) Sampling • – Aliasing effect (out of validity bound of Nyquist-Shannon) – Objects for which the size is the same as the pixel size: salt and pepper noise Scene content • – Clouds in satellite images, … Quantification • – 256 grey levels: not really a limiting factor for human visual system -- or less Compression • Transmission • – Data loss, data corruption 7 Image processing, 2006, lingrand@polytech.unice.fr

  8. Noise modeling • Noise depending or not of the image data • Additive or multiplicative noise • Noise: high frequencies (usually higher than the image frequencies) => low-pass filtering • Kinds of noise: – Impulse noise: white Gaussian, exponential... – Salt and pepper noise 8 Image processing, 2006, lingrand@polytech.unice.fr

  9. Salt and pepper noise • n th order : turn n pixels to white and n pixels to black randomly in an image. – Often expressed as a percentage p (0  p  1) • Physical counter-part: dust on a camera film or a scanner, small objects, data loss • in Java: import java.util.Random – method: int nextInt(int n) gives an integer in [0 n[, with uniform distribution – 2 methods : • randomly choose w*h/p pixels to be changed to BLACK and w*h/p others to be changed to WHITE • for each pixel: chose randomly an int in [0 1/p[, then if 0, change pixel to WHITE, if 1 change it to BLACK 9 Image processing, 2006, lingrand@polytech.unice.fr

  10. Example of salt and pepper noise Noisy salt and papper image with Original image p(white) =p(black)=5% 10 Image processing, 2006, lingrand@polytech.unice.fr

  11. Impulse noise • Probability density function form: • For �α = 1 : exponential noise • For �α = 2 : Gaussian noise 11 Image processing, 2006, lingrand@polytech.unice.fr

  12. Gaussian noise • Additive Gaussian noise with null mean and variance σ 2 • Similar to the acquisition noise • How to implement a Gaussian variable ? – in Java : import java.util.Random; The public method double Random.nextGaussian() is a Gaussian random value with mean 0 and standard deviation 1 : to be multiplied by σ – in C/C++: use rand() from C system library 12 Image processing, 2006, lingrand@polytech.unice.fr

  13. Gaussian noise in C++ Initialization • struct timeval tv; struct timezone tz; gettimeofday(&tv, &tz); srand(tv.tv_usec); Normal random variable distribution between 0 and 1 • rand()/(RAND_MAX+1.0f); Gaussian variable • b = rand()/(RAND_MAX+1.0f); if(b < epsilon) b = epsilon; c = rand()/(RAND_MAX+1.0f); a = -2.0 * Math::log(b); if(a < 0.0) a = 0.0; else a *= Math::cos(2.0 * Math::pi * c); 13 Image processing, 2006, lingrand@polytech.unice.fr

  14. Gaussian noise example Noisy image with a Gaussian Original image noise (std dev 4) 14 Image processing, 2006, lingrand@polytech.unice.fr

  15. Worse : Standard deviation = 16 Standard deviation = 8 15 Image processing, 2006, lingrand@polytech.unice.fr

  16. Filtering - Restoration 16 Image processing, 2006, lingrand@polytech.unice.fr

  17. Spatial filtering • Filter applied to the neighborhood of a pixel in an image • Linear or non-linear filtering – linear : convolution, Fourier Transform – non linear : no convolution, no Fourier Transform • Processing: – smoothing ( blurring ), contours strengthening ( sharpening ) … 17 Image processing, 2006, lingrand@polytech.unice.fr

  18. Smoothing filters • Mean filters • Gaussian filters • Median filters • Conservative smoothing • others 18 Image processing, 2006, lingrand@polytech.unice.fr

  19. Convolution • Convolution operator with a kernel i j 19 Image processing, 2006, lingrand@polytech.unice.fr

  20. Mean filtering • Also known as averaging or Box filtering • Principle : a pixel value is replaced by the mean value computed from its neighbors (and itself) • Convolution with a kernel of size (2n+1 x 2n+1). – ex: 1/9 1/9 1/9 Be careful if 1/9 1/9 1/9 you make divisions 1/9 1/9 1/9 with integers ! 20 Image processing, 2006, lingrand@polytech.unice.fr

  21. Example • This is a low-pass filtering • Impairment of contours (blurring) 21 Image processing, 2006, lingrand@polytech.unice.fr

  22. Smoothing a salt and pepper noise : Kernel size = 5 22 Kernel size = 3 Image processing, 2006, lingrand@polytech.unice.fr

  23. Smoothing a Gaussian noise Kernel size =5 Kernel size = 3 23 Image processing, 2006, lingrand@polytech.unice.fr

  24. Gaussien filter (Gaussian smoothing) • 2D Gaussian : – null mean – variance σ 2 • Principle: convolution with a Gaussian • In practice : Gaussian discretization on a kernel with size (2p+1,2p+1) 24 Image processing, 2006, lingrand@polytech.unice.fr

  25. Gaussian kernels examples • 3x3 • 7x7 [ 1 2 1 ] [1 1 2 2 2 1 1] [ 2 4 2 ] [1 2 2 4 2 2 1] [ 1 2 1 ] [2 2 4 8 4 2 2] • 5x5 [2 4 8 16 8 4 2] [ 1 1 2 1 1 ] [2 2 4 8 4 2 2] [ 1 2 4 2 1] [1 2 2 4 2 2 1] [ 2 4 8 4 2 ] [1 1 2 2 2 1 1] [ 1 2 4 2 1] [ 1 1 2 1 1] 25 Image processing, 2006, lingrand@polytech.unice.fr

  26. How to compute a Gaussian kernel ? (1) • Kernel ? ((2p+1) x (2p+1)) – Integer coefficient (faster computations) followed by a normalization step (division by the sum of coefficient) – Even more efficient: coefficient as powers of 2 – σ depends on the size of the kernel (p) 26 Image processing, 2006, lingrand@polytech.unice.fr

  27. How to compute a Gaussian kernel ? (2) • The last coefficient value is 1 ... ... • Its real value is obtained by dividing it with the ... 2 q 2 q .e -p 2 /(2 σ 2 ) ... sum of all coefficients ... ... 1= 2 q .e -p 2 /(2 σ 2 ) 2 q .e -p 2 / σ 2 27 Image processing, 2006, lingrand@polytech.unice.fr

  28. Another example of Gaussian kernel 1 4 1 4 4 7 4 16 26 16 4 1 7 26 41 26 7 273 16 16 4 4 26 1 4 7 4 1 28 Image processing, 2006, lingrand@polytech.unice.fr

  29. Gaussian filtering after a salt and pepper noise on an image Kernel size = 7 Kernel size = 3 29 Image processing, 2006, lingrand@polytech.unice.fr

  30. Gaussian filtering following a Gaussian noise of null mean ( σ = 16) 7 3 30 Image processing, 2006, lingrand@polytech.unice.fr

  31. Conservative filtering • Principle : only the pixels whose value falls in the interval defined by the neighboring pixels are preserved. If the pixel values falls out of this interval, it is replaced by the closest bound: – Upper bound if the value is higher to that – Lower bound if the value is lower to that 31 Image processing, 2006, lingrand@polytech.unice.fr

  32. Conservative filtering after a salt and pepper noise Original image After conservative filtering 32 Image processing, 2006, lingrand@polytech.unice.fr

  33. Conservative filtering after gaussian noise Original image After conservative filtering 33 Image processing, 2006, lingrand@polytech.unice.fr

  34. Conservative filtering 63 62 67 63 62 67 88 0 93 88 62 93 0 ∉ [62 ; 255] 140 110 255 255 110 255 63 0 67 63 0 67 88 0 93 88 0 93 0 ∈ [0 ; 255] 140 110 255 255 110 255 34 Image processing, 2006, lingrand@polytech.unice.fr

  35. Median filters • Principle : a pixel is replaced by his neighbors' values • Median value = value in the middle of the sorted list of neighbors' values ⇒ Need to sort values (ex: quick sort ?) • Enable the suppression of outliers • Good performance when processing images impaired by salt and pepper noise 35 Image processing, 2006, lingrand@polytech.unice.fr

  36. Median filtering 63 0 67 63 0 67 88 0 93 88 88 93 255 110 255 255 110 255 63 0 67 88 0 93 255 110 255 sorting 0 0 63 67 88 93 110 255 255 median value 36 Image processing, 2006, lingrand@polytech.unice.fr

  37. Some median filter kernels carrés (7x7) en croix (7x7) carrés • • • [1 1 1 1 1 1 1] (3x3) [0 0 0 1 0 0 0] [1 1 1 1 1 1 1] [0 0 0 1 0 0 0] [1 1 1] [1 1 1 1 1 1 1] [0 0 0 1 0 0 0] [1 1 1] [1 1 1 1 1 1 1] [1 1 1 1 1 1 1] [1 1 1] [1 1 1 1 1 1 1] [0 0 0 1 0 0 0] [1 1 1 1 1 1 1] [0 0 0 1 0 0 0] [1 1 1 1 1 1 1] [0 0 0 1 0 0 0] diamand (7x7) • en croix (3x3) • [0 0 0 1 0 0 0] [0 1 0] [0 0 1 1 1 0 0] [0 1 1 1 1 1 0] [1 1 1] [1 1 1 1 1 1 1] [0 1 0] [0 1 1 1 1 1 0] [0 0 1 1 1 0 0] [0 0 0 1 0 0 0] 37 Image processing, 2006, lingrand@polytech.unice.fr

  38. Median filter after pepper and salt noise kernel 3x3, applied once kernel 3x3, applied twice 38 Image processing, 2006, lingrand@polytech.unice.fr

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend