Presentation is loading. Please wait.

Presentation is loading. Please wait.

02/12/02 (c) 2002 University of Wisconsin, CS 559 Filters A filter is something that attenuates or enhances particular frequencies Easiest to visualize.

Similar presentations


Presentation on theme: "02/12/02 (c) 2002 University of Wisconsin, CS 559 Filters A filter is something that attenuates or enhances particular frequencies Easiest to visualize."— Presentation transcript:

1 02/12/02 (c) 2002 University of Wisconsin, CS 559 Filters A filter is something that attenuates or enhances particular frequencies Easiest to visualize in the frequency domain, where filtering is defined as multiplication: Here, F is the spectrum of the function, G is the spectrum of the filter, and H is the filtered function. Multiplication is point-wise

2 02/12/02 (c) 2002 University of Wisconsin, CS 559 Qualitative Filters  Function: FFilter: G =   = = Result: H Low-pass High-pass Band-pass

3 02/12/02 (c) 2002 University of Wisconsin, CS 559 Low-Pass Filtered Image

4 02/12/02 (c) 2002 University of Wisconsin, CS 559 High-Pass Filtered Image

5 02/12/02 (c) 2002 University of Wisconsin, CS 559 Filtering in the Spatial Domain Filtering the spatial domain is achieved by convolution Qualitatively: Slide the filter to each position, x, then sum up the function multiplied by the filter at that position

6 02/12/02 (c) 2002 University of Wisconsin, CS 559 Filtering Images Work in the discrete spatial domain Convert the filter into a matrix, the filter mask Move the matrix over each point in the image, multiply the entries by the pixels below, then sum –eg 3x3 box filter –averages

7 02/12/02 (c) 2002 University of Wisconsin, CS 559 Box Filter Box filters smooth by averaging neighbors In frequency domain, keeps low frequencies and attenuates (reduces) high frequencies, so clearly a low-pass filter Spatial: BoxFrequency: sinc

8 02/12/02 (c) 2002 University of Wisconsin, CS 559 Box Filter

9 02/12/02 (c) 2002 University of Wisconsin, CS 559 Filtering Algorithm If I input is the input image, and I output is the output image, M is the filter mask and k is the mask size: Care must taken at the boundary –Make the output image smaller –Extend the input image in some way

10 02/12/02 (c) 2002 University of Wisconsin, CS 559 Bartlett Filter Triangle shaped filter in spatial domain In frequency domain, product of two box filters, so attenuates high frequencies more than a box Spatial: Triangle (Box  Box) Frequency: sinc 2

11 02/12/02 (c) 2002 University of Wisconsin, CS 559 Constructing Masks: 1D Sample the filter function at matrix “pixels” eg 2D Bartlett Can go to edge of pixel or middle of next: results are slightly different 012 131 1 5 121 1 4

12 02/12/02 (c) 2002 University of Wisconsin, CS 559 Constructing Masks: 2D Multiply 2 1D masks together using outer product M is 2D mask, m is 1D mask 0.20.60.2 0.6 0.2 0.040.120.04 0.120.360.12 0.040.120.04

13 02/12/02 (c) 2002 University of Wisconsin, CS 559 Bartlett Filter

14 02/12/02 (c) 2002 University of Wisconsin, CS 559 Guassian Filter Attenuates high frequencies even further In 2d, rotationally symmetric, so fewer artifacts

15 02/12/02 (c) 2002 University of Wisconsin, CS 559 Gaussian Filter

16 02/12/02 (c) 2002 University of Wisconsin, CS 559 Constructing Gaussian Mask Use the binomial coefficients –Central Limit Theorem (probability) says that with more samples, binomial converges to Gaussian 121 1 4 146 16 1 41 1615 64 1 201561

17 02/12/02 (c) 2002 University of Wisconsin, CS 559 High-Pass Filters A high-pass filter can be obtained from a low-pass filter –If we subtract the smoothed image from the original, we must be subtracting out the low frequencies –What remains must contain only the high frequencies High-pass masks come from matrix subtraction: eg: 3x3 Bartlett

18 02/12/02 (c) 2002 University of Wisconsin, CS 559 High-Pass Filter

19 02/12/02 (c) 2002 University of Wisconsin, CS 559 Edge Enhancement High-pass filters give high values at edges, low values in constant regions Adding high frequencies back into the image enhances edges One approach: –Image = Image + [Image – smooth(Image)] Low-pass High-pass

20 02/12/02 (c) 2002 University of Wisconsin, CS 559 Edge-Enhance Filter

21 02/12/02 (c) 2002 University of Wisconsin, CS 559 Edge Enhancement

22 02/12/02 (c) 2002 University of Wisconsin, CS 559 Fixing Negative Values The negative values in high-pass filters can lead to negative image values –Most image formats don’t support this Solutions: –Truncate: Chop off values below min or above max –Offset: Add a constant to move the min value to 0 –Re-scale: Rescale the image values to fill the range (0,max)

23 02/12/02 (c) 2002 University of Wisconsin, CS 559 Image Warping An image warp is a mapping from the points in one image to points in another f tells us where in the new image to put the data from x in the old image –Simple example: Translating warp, f(x) = x+o, shifts an image

24 02/12/02 (c) 2002 University of Wisconsin, CS 559 Reducing Image Size Warp function: f(x)=kx, k > 1 Problem: More than one input pixel maps to each output pixel Solution: Filter down to smaller size –Apply the filter, but not at every pixel, only at desired output locations –eg: To get half image size, only apply filter at every second pixel

25 02/12/02 (c) 2002 University of Wisconsin, CS 559 2D Reduction Example (Bartlett)

26 02/12/02 (c) 2002 University of Wisconsin, CS 559 Ideal Image Size Reduction Reconstruct original function using reconstruction filter Resample at new resolution (lower frequency) –Clearly demonstrates that shrinking removes detail Expensive, and not possible to do perfectly in the spatial domain


Download ppt "02/12/02 (c) 2002 University of Wisconsin, CS 559 Filters A filter is something that attenuates or enhances particular frequencies Easiest to visualize."

Similar presentations


Ads by Google