Digital image processing img smoothning

20,793 views

Published on

Published in: Technology, Art & Photos
2 Comments
30 Likes
Statistics
Notes
No Downloads
Views
Total views
20,793
On SlideShare
0
From Embeds
0
Number of Embeds
15
Actions
Shares
0
Downloads
496
Comments
2
Likes
30
Embeds 0
No embeds

No notes for slide

Digital image processing img smoothning

  1. 1. Presentation over image smoothing and sharpening -Vinay Kumar Gupta 0700410088
  2. 2. What is a Digital Image? A digital image is a representation of a two- dimensional image as a finite set of digital values, called picture elements or pixels.
  3. 3. Why Digital Image Processing?Digital image processing focuses on two major tasks:  Improvement of pictorial information for human interpretation.  Processing of image data for storage, transmission and representation for autonomous machine perception
  4. 4. Applications:The use of digital image processing techniques hasexploded and they are now used for all kinds of tasks inall kinds of areas:  Image enhancement/restoration  Artistic effects  Medical visualisation  Industrial inspection  Law enforcement  Human computer interfaces
  5. 5. Examples: The Hubble TelescopeLaunched in 1990 the Hubble telescope can takeimages of very distant objectsHowever, an incorrect mirror made many of Hubble’simages useless.Image processing techniques were used to fix this
  6. 6. Examples: HCITry to make human computerinterfaces more natural  Face recognition  Gesture recognitionDoes anyone remember theuser interface from “MinorityReport”?
  7. 7. Key Stages in Digital Image Processing: Image Morphological Restoration Processing Image Enhancement Segmentation Image Object Acquisition RecognitionProblem Domain Representation & Description Colour Image Image Processing Compression
  8. 8. Image RepresentationBefore we discuss image acquisitionrecall that a digital image is colcomposed of M rowsand N columns of pixelseach storing a valuePixel values are mostoften grey levels in therange 0-255(black-white) f (row, col) row
  9. 9. Image Representation
  10. 10. Image Representation
  11. 11. Image Representation
  12. 12. What Is Image Enhancement?Image enhancement is the process of making imagesmore usefulThe reasons for doing this include:  Highlighting interesting detail in images  Removing noise from images  Making images more visually appealing
  13. 13. Spatial & Frequency DomainsThere are two broad categories of image enhancementtechniques  Spatial domain techniques  Direct manipulation of image pixels  Frequency domain techniques  Manipulation of Fourier transform or wavelet transform of an imageFor the moment we will concentrate on techniques thatoperate in the spatial domain
  14. 14. Image HistogramsThe histogram of an image shows us the distribution of greylevels in the image Frequencies Grey Levels
  15. 15. Spatial filtering techniques:  Neighbourhood operations  What is spatial filtering?  Smoothing operations  What happens at the edges?
  16. 16. Neighbourhood OperationsNeighbourhood operations simply operate on a largerneighbourhood of pixels than point operations Origin xNeighbourhoods aremostly a rectanglearound a central pixelAny size rectangleand any shape filter (x, y) Neighbourhoodare possible y Image f (x, y)
  17. 17. Simple Neighbourhood OperationsSome simple neighbourhood operations include:  Min: Set the pixel value to the minimum in the neighbourhood  Max: Set the pixel value to the maximum in the neighbourhood  Median: The median value of a set of numbers is the midpoint value in that set (e.g. from the set [1, 7, 15, 18, 24] 15 is the median). Sometimes the median works better than the average
  18. 18. The Spatial Filtering ProcessOrigin x a b c r s t d g e h f i * u x v y w z Original Image Filter Simple 3*3 Pixels e 3*3 Filter Neighbourhood eprocessed = v*e + r*a + s*b + t*c + u*d + w*f + y Image f (x, y) x*g + y*h + z*i The above is repeated for every pixel in the original image to generate the filtered image
  19. 19. Smoothing Spatial Filters One of the simplest spatial filtering operations wecan perform is a smoothing operation  Simply average all of the pixels in a neighbourhood around a central value  Especially useful 1/ 1/ 1/ 9 9 9 in removing noise from images  Also useful for 1/ 9 1/ 9 1/ 9 Simple highlighting gross averaging detail 1/ 1/ 1/ filter 9 9 9
  20. 20. Smoothing Spatial FilteringOrigin x 104 100 108 1/ 1/ 1/ 9 9 9 1/ 1/ 1/ 99 106 98 95 90 85 * 1/ 9 1/ 9 1/ 9 9 9 9 1/ 1/ 1/ 104 100 108 Original Image Filter 9 9 9 Simple 3*3 1/ 99 106 198 1/ /9 3*3 Smoothing Pixels 9 9 Neighbourhood 195 /9 1/ 90 185 /9 Filter 9 e = 1/9*106 + 1/ *104 + 1/ *100 + 1/ *108 + 9 9 9 1/ *99 + 1/ *98 + 9 9 y Image f (x, y) 1/ *95 + 1/ *90 + 1/ *85 9 9 9 = 98.3333 The above is repeated for every pixel in the original image to generate the smoothed image
  21. 21. Sharpening Spatial FiltersPreviously we have looked at smoothing filters whichremove fine detailSharpening spatial filters seek to highlight fine detail  Remove blurring from images  Highlight edgesSharpening filters are based on spatial differentiation
  22. 22. Spatial DifferentiationDifferentiation measures the rate of change of a functionLet’s consider a simple 1 dimensional example
  23. 23. Spatial Differentiation A B
  24. 24. 1st DerivativeThe formula for the 1st derivative of a function is asfollows: f f ( x 1) f ( x) x It’s just the difference between subsequent valuesand measures the rate of change of the function.
  25. 25. 2nd DerivativeThe formula for the 2nd derivative of a function is asfollows: 2 f 2 f ( x 1) f ( x 1) 2 f ( x) xSimply takes into account the values both before andafter the current value
  26. 26. Using Second Derivatives For ImageEnhancementThe 2nd derivative is more useful for image enhancementthan the 1st derivative  Stronger response to fine detail  Simpler implementation  We will come back to the 1st order derivative later onThe first sharpening filter we will look at is the Laplacian  Isotropic  One of the simplest sharpening filters  We will look at a digital implementation
  27. 27. The Laplacian The Laplacian is defined as follows: 2 2 2 f f f 2 2 x y where the partial 1st order derivative in the x direction is defined as follows: 2 f 2 f ( x 1, y ) f ( x 1, y ) 2 f ( x, y ) x and in the y direction as follows: 2 f 2 f ( x, y 1) f ( x, y 1) 2 f ( x, y ) y
  28. 28. The Laplacian (cont…) So, the Laplacian can be given as follows: 2 f [ f ( x 1, y ) f ( x 1, y ) f ( x, y 1) f ( x, y 1)] 4 f ( x, y) We can easily build a filter based on this 0 1 0 1 -4 1 0 1 0
  29. 29. The Laplacian (cont…)Applying the Laplacian to an image we get a new imagethat highlights edges and other discontinuities Original Laplacian Laplacian Image Filtered Image Filtered Image Scaled for Display
  30. 30. But That Is Not Very Enhanced! The result of a Laplacian filtering is not an enhanced image We have to do more work in order to get our final image Subtract the Laplacian result from the original image to generate our final sharpened enhanced image Laplacian Filtered Image 2 Scaled for Display g ( x, y ) f ( x, y ) f
  31. 31. Laplacian Image Enhancement - = Original Laplacian Sharpened Image Filtered Image Image In the final sharpened image edges and fine detail are much more obvious
  32. 32. Laplacian Image Enhancement
  33. 33. Simplified Image EnhancementThe entire enhancement can be combined into a singlefiltering operation 2 g ( x, y ) f ( x, y ) f f ( x, y) [ f ( x 1, y) f ( x 1, y) f ( x, y 1) f ( x, y 1) 4 f ( x, y)] 5 f ( x, y) f ( x 1, y) f ( x 1, y) f ( x, y 1) f ( x, y 1)
  34. 34. Simplified Image Enhancement (cont…)This gives us a new filter which does the whole job for usin one step 0 -1 0 -1 5 -1 0 -1 0
  35. 35. The Big Idea =Any function that periodically repeats itself canbe expressed as a sum of sines and cosines ofdifferent frequencies each multiplied by adifferent coefficient – a Fourier series
  36. 36. The Discrete Fourier Transform (DFT)The Discrete Fourier Transform of f(x, y), for x = 0, 1,2…M-1 and y = 0,1,2…N-1, denoted by F(u, v), is given bythe equation: M 1N 1 j 2 ( ux / M vy / N ) F (u , v) f ( x, y )e x 0 y 0for u = 0, 1, 2…M-1 and v = 0, 1, 2…N-1.
  37. 37. DFT & ImagesThe DFT of a two dimensional image can be visualisedby showing the spectrum of the images componentfrequencies DFT
  38. 38. The DFT and Image ProcessingTo filter an image in the frequency domain: 1. Compute F(u,v) the DFT of the image 2. Multiply F(u,v) by a filter function H(u,v) 3. Compute the inverse DFT of the result
  39. 39. Some Basic Frequency Domain Filters Low Pass Filter High Pass Filter
  40. 40. Smoothing Frequency Domain FiltersSmoothing is achieved in the frequency domain bydropping out the high frequency componentsThe basic model for filtering is: G(u,v) = H(u,v)F(u,v)where F(u,v) is the Fourier transform of the image beingfiltered and H(u,v) is the filter transform functionLow pass filters – only pass the low frequencies,drop the high ones.
  41. 41. Ideal Low Pass FilterSimply cut off all high frequency components that are aspecified distance D0 from the origin of the transformchanging the distance changes the behaviour of the filter
  42. 42. Ideal Low Pass Filter (cont…)The transfer function for the ideal low pass filter can begiven as: 1 if D(u, v) D0 H (u, v) 0 if D(u, v) D0where D(u,v) is given as: 2 2 1/ 2 D(u, v) [(u M / 2) (v N / 2) ]
  43. 43. Butterworth Low pass FiltersThe transfer function of a Butterworth lowpass filter oforder n with cutoff frequency at distance D0 from theorigin is defined as: 1 H (u , v) 1 [ D(u , v) / D0 ]2 n
  44. 44. Gaussian Low pass FiltersThe transfer function of a Gaussian lowpass filter isdefined as: D2 (u ,v ) / 2 D0 2 H (u, v) e
  45. 45. Lowpass Filtering Examples A low pass Gaussian filter is used to connect broken text
  46. 46. Sharpening in the Frequency DomainEdges and fine detail in images are associated with highfrequency componentsHigh pass filters – only pass the high frequencies,drop the low ones.High pass frequencies are precisely the reverse of lowpass filters, so: Hhp(u, v) = 1 – Hlp(u, v)
  47. 47. Ideal High Pass FiltersThe ideal high pass filter is given as: 0 if D(u, v) D0 H (u, v) 1 if D(u, v) D0where D0 is the cut off distance as before
  48. 48. Butterworth High Pass FiltersThe Butterworth high pass filter is given as: 1 H (u , v) 2n 1 [ D0 / D(u , v)]where n is the order and D0 is the cut off distance asbefore
  49. 49. Gaussian High Pass FiltersThe Gaussian high pass filter is given as: 2 D2 (u ,v ) / 2 D0 H (u, v) 1 ewhere D0 is the cut off distance as before
  50. 50. Frequency Domain Filtering & SpatialDomain FilteringSimilar jobs can be done in the spatial and frequencydomainsFiltering in the spatial domain can be easier tounderstandFiltering in the frequency domain can be much faster –especially for large images
  51. 51. Questions?
  52. 52. THANK YOU…!!! 

×