Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Image Filtering Slides by Steve Seitz. 2 Salvador Dali, “Gala Contemplating the Mediterranean Sea, which at 30 meters becomes the portrait of Abraham.

Similar presentations


Presentation on theme: "1 Image Filtering Slides by Steve Seitz. 2 Salvador Dali, “Gala Contemplating the Mediterranean Sea, which at 30 meters becomes the portrait of Abraham."— Presentation transcript:

1 1 Image Filtering Slides by Steve Seitz

2 2 Salvador Dali, “Gala Contemplating the Mediterranean Sea, which at 30 meters becomes the portrait of Abraham Lincoln”, 1976

3 3

4 4 Filtering noise How can we “smooth” away noise in an image? 0000000000 0000000000 00010013011012011000 000 901009010000 0001301009013011000 00012010013011012000 000901108012010000 0000000000 0000000000 0000000000

5 5 Mean filtering 0000000000 0000000000 00090 00 000 00 000 00 000 0 00 000 00 0000000000 00 0000000 0000000000

6 6

7 7 Mean filtering 0000000000 0000000000 00090 00 000 00 000 00 000 0 00 000 00 0000000000 00 0000000 0000000000 0102030 2010 0204060 4020 0306090 6030 0 5080 906030 0 5080 906030 0203050 604020 102030 2010 00000

8 8 Cross-correlation filtering Let’s write this down as an equation. Assume the averaging window is (2k+1)x(2k+1): We can generalize this idea by allowing different weights for different neighboring pixels: This is called a cross-correlation operation and written: H is called the “filter,” “kernel,” or “mask.” The above allows negative filter indices. When you implement need to use: H[u+k,v+k] instead of H[u,v]

9 9 Mean kernel What’s the kernel for a 3x3 mean filter? 0000000000 0000000000 00090 00 000 00 000 00 000 0 00 000 00 0000000000 00 0000000 0000000000 When can taking an un weighted mean be bad idea?

10 10 Gaussian filtering A Gaussian kernel gives less weight to pixels further from the center of the window This kernel is an approximation of a Gaussian function: What happens if you increase  ? 0000000000 0000000000 00090 00 000 00 000 00 000 0 00 000 00 0000000000 00 0000000 0000000000 121 242 121

11 11 Mean vs. Gaussian filtering

12 12 Pixelation Fun $$$$$$$$$$$$$$$$$$$$$$$$$$$$$MMM$$$$$$$RM$RMMMMMM$$$$$$$$$$$$$$$$$$$$$$&! $$$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~:!9$$$$$$$R$ $$$$$$$$$$$$$$$$MX!~~ `~~!!!!< : <!!!!~~~ !!8$$$$$$$$M$ $$$$$$$$$$$$$$$8X!!!~~ ~~~~~~~~~~~~~~~ ~~!!$$$$$$$$$$M$ $$$$$$$$RR$$$$$$$X~!!!~~ <~~!X$$$$$$$$$$RH$ $$$$$$$$$$X$$$$$$R! !!<~: ~<!X$$$$$$$$$$$$M$ $$$$$$MM$$$$$$$$$$M< `~~:~ ~!W$$$$$$$$$$$$$M$ $$$$$$$$$$$$$$$$$$$! ~~~~~ '!W$$$$$$$$$$$$$$MM $$$$$$$$$$$$$$$$$$$! ~~~ X$$$$$$$$$$$$$$$$M! $$$$$$$$$$$$$$$$$$$X ~~ <X$$$$$$$$$$M$$$$$$8! $$$$$$$$$$$$$$$$$$$M ~!!?$$$$$$$$$$$MM$$$$$$M $$$$$$$$$$$$$$$$$$$X :<~~~~~~~~~!$$$$$$$$$$$BMX$$XM$$ $$$$$$$$$$$$$$$$$$$! ~<M$$$$$$$$$$$$$$$$$$$$

13 13 Pixelation Fun http://www.salle.url.edu/~ftorre/

14 14 Convolution A convolution operation is a cross-correlation where the filter is flipped both horizontally and vertically before being applied to the image: It is written: Suppose H is a Gaussian or mean kernel. How does convolution differ from cross-correlation?

15 15 Median filters A Median Filter operates over a window by selecting the median intensity in the window. What advantage does a median filter have over a mean filter? Is a median filter a kind of convolution?

16 16 Comparison: salt and pepper noise

17 17 Comparison: Gaussian noise

18 18 Unsharp Masking - = = +  So, what does blurring take away?

19 19 Unsharp Masking (MATLAB) Imrgb = imread(‘file.jpg’); im = im2double(rgb2gray(imrgb)); g= fspecial('gaussian', 25,4); imblur = conv2(im,g,‘same'); imagesc([im imblur]) imagesc([im im+.4*(im-imblur)])


Download ppt "1 Image Filtering Slides by Steve Seitz. 2 Salvador Dali, “Gala Contemplating the Mediterranean Sea, which at 30 meters becomes the portrait of Abraham."

Similar presentations


Ads by Google