1 / 21

Image Processing

Image Processing. Chapter(3) Part 4:Intensity Transformation and spatial filters Prepared by: Hanan Hardan. Ch3, lesson 6: spatial filters. Origin. x. (x, y). Neighbourhood. y. Image f (x, y). Spatial filters. Remember that types of neighborhood:

Télécharger la présentation

Image Processing

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. Image Processing Chapter(3) Part 4:Intensity Transformation and spatial filters Prepared by: Hanan Hardan

  2. Ch3, lesson 6: spatial filters Origin x (x, y) Neighbourhood y Image f (x, y) Spatial filters Remember that types of neighborhood: • intensity transformation: neighborhood of size 1x1 • spatial filter (or mask ,kernel, template or window): neighborhood of larger size , like 3*3 mask • The spatial filter mask is moved from point to point in an image. At each point (x,y), the response of the filter is calculated

  3. Origin x (x, y) Neighbourhood y Image f (x, y) Neighbourhood Operations • For each pixel in the origin image, the outcome is written on the same location at the target image. Origin Target

  4. Simple Neighbourhood Operations • Simple neighbourhood operations example: • Min: Set the pixel value to the minimum in the neighbourhood • Max: Set the pixel value to the maximum in the neighbourhood

  5. a b c d e f g h i j k l m n o p q r The Spatial Filtering Process Origin x * Original Image Pixels Filter (w) Simple 3*3Neighbourhood 3*3 Filter eprocessed = n*e + j*a + k*b + l*c + m*d + o*f + p*g + q*h + r*i e y Image f (x, y) The above is repeated for every pixel in the original image to generate the filtered image

  6. Ch3, lesson 5: spatial filters Spatial filters • Smoothing Spatial filters [low pass]. • Sharpening Spatial Filters[high pass].

  7. Ch3, lesson 6: Smoothing filters Spatial filters : Smoothing ( low pass) • Use:for blurring and noise reduction. • Type of smoothing filters: • Standard average • weighted average. • 3. Median filter linear Order statistics

  8. Smoothing Spatial Filters • One of the simplest spatial filtering operations we can perform is a smoothing operation • Simply average all of the pixels in a neighbourhood around a central value • Especially useful in removing noise from images • Also useful for highlighting gross detail Simple averaging filter

  9. 104 100 108 99 106 98 95 90 85 1/9 1/9 1/9 1/9 1/9 1/9 104 100 108 1/9 1/9 1/9 99 98 95 90 85 Smoothing Spatial Filtering Origin x * Original Image Pixels Filter Simple 3*3Neighbourhood 3*3 SmoothingFilter 106 e = 1/9*106 + 1/9*104 + 1/9*100 + 1/9*108 + 1/9*99 + 1/9*98 + 1/9*95 + 1/9*90 + 1/9*85 = 98.3333 y Image f (x, y) The above is repeated for every pixel in the original image to generate the smoothed image

  10. Ch3, lesson 6: Smoothing filters Spatial filters : Smoothinglinear smoothing : averaging kernels • Standard average

  11. Ch3, lesson 6: Smoothing filters Spatial filters : SmoothingStandard and weighted Average- example The mask is moved from point to point in an image. At each point (x,y), the response of the filter is calculated Standard averaging filter: (110 +120+90+91+94+98+90+91+99)/9 =883/9 = 98.1

  12. Ch3, lesson 6: Smoothing filters What happens when the Values of the Kernel Fall Outside the Image??!

  13. Ch3, lesson 6: Smoothing filters First solution :Zero padding, -ve: black border

  14. Ch3, lesson 6: Smoothing filters border padding

  15. Ch3, lesson 6: Smoothing filters Spatial filters : Smoothing Averaging effects: blurring + reducing noise Original image 3 x 3 averaging 5 x 5 averaging 9 x 9 averaging 15 x 15 averaging 35 x 35 averaging Notice how detail begins to disappear

  16. Ch3, lesson 6: Smoothing filters Spatial filters : Smoothinglinear smoothing : averaging kernels • weighted average. Used to reduce blurring more.

  17. Ch3, lesson 6: Smoothing filters Spatial filters : SmoothingStandard and weighted Average- example The mask is moved from point to point in an image. At each point (x,y), the response of the filter is calculated :Weighted averaging filter: (110 +2 x 120+90+2 x 91+4 x 94+2 x 98+90+2 x 91+99)/16 =

  18. Ch3, lesson 6: Smoothing filters Spatial filters : Smoothingorder statistics: Median filter becomes 95 Steps: 1. Sort the pixels in ascending order: 90,90, 91, 94, 95, 98, 99, 110, 120 2. replace the original pixel value by the median : 95

  19. Ch3, lesson 6: Smoothing filters Spatial filters : Smoothingorder statistics: Median filter use : blurring + reduce salt and pepper noise The original image with salt and pepper noise The smoothed image using averaging The smoothed image using median

  20. Smoothing Filters: Median Filtering(non-linear) • Very effective for removing “salt and pepper” noise). median filtering averaging

  21. Ch3, lesson 7: sharpening filters Smoothing Filters: Example1: v=imread('cameraman.tif'); x=imnoise(v,'salt & pepper', 0.02); % added noise to the image h=fspecial('average',[3 3]); % create a two-dimensional filter xx=imfilter(x,h); % apply the filter on the image imshow(x),figure, imshow(xx) Example2: v=imread('cameraman.tif'); x=imnoise(v,'salt & pepper', 0.02); xx=medfilt2(x); imshow(x),figure, imshow(xx) Note: medfilt2 (x,[a b]) where a and b the size of filter.

More Related