Download presentation
1
(c) 2002 University of Wisconsin, CS 559
Last Time Signal Processing Filtering basics Homework 2 Project 1 09/24/02 (c) 2002 University of Wisconsin, CS 559
2
(c) 2002 University of Wisconsin, CS 559
Today More Filters Sampling and Reconstruct Image warping 09/24/02 (c) 2002 University of Wisconsin, CS 559
3
(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: Box Frequency: sinc 09/24/02 (c) 2002 University of Wisconsin, CS 559
4
(c) 2002 University of Wisconsin, CS 559
Box Filter 09/24/02 (c) 2002 University of Wisconsin, CS 559
5
(c) 2002 University of Wisconsin, CS 559
Filtering Algorithm If Iinput is the input image, and Ioutput 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 09/24/02 (c) 2002 University of Wisconsin, CS 559
6
(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 (BoxBox) Frequency: sinc2 09/24/02 (c) 2002 University of Wisconsin, CS 559
7
(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 1 1 3 1 5 1 2 1 1 2 1 4 09/24/02 (c) 2002 University of Wisconsin, CS 559
8
(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.2 0.6 0.2 0.2 0.04 0.12 0.04 0.6 0.12 0.36 0.12 0.2 0.04 0.12 0.04 09/24/02 (c) 2002 University of Wisconsin, CS 559
9
(c) 2002 University of Wisconsin, CS 559
Bartlett Filter 09/24/02 (c) 2002 University of Wisconsin, CS 559
10
(c) 2002 University of Wisconsin, CS 559
Guassian Filter Attenuates high frequencies even further In 2d, rotationally symmetric, so fewer artifacts 09/24/02 (c) 2002 University of Wisconsin, CS 559
11
(c) 2002 University of Wisconsin, CS 559
Gaussian Filter 09/24/02 (c) 2002 University of Wisconsin, CS 559
12
Constructing Gaussian Mask
Use the binomial coefficients Central Limit Theorem (probability) says that with more samples, binomial converges to Gaussian 1 1 2 1 4 1 1 4 6 4 1 16 1 1 6 15 20 15 6 1 64 09/24/02 (c) 2002 University of Wisconsin, CS 559
13
(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 09/24/02 (c) 2002 University of Wisconsin, CS 559
14
(c) 2002 University of Wisconsin, CS 559
High-Pass Filter 09/24/02 (c) 2002 University of Wisconsin, CS 559
15
(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 09/24/02 (c) 2002 University of Wisconsin, CS 559
16
(c) 2002 University of Wisconsin, CS 559
Edge-Enhance Filter 09/24/02 (c) 2002 University of Wisconsin, CS 559
17
(c) 2002 University of Wisconsin, CS 559
Edge Enhancement 09/24/02 (c) 2002 University of Wisconsin, CS 559
18
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) 09/24/02 (c) 2002 University of Wisconsin, CS 559
19
(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 09/24/02 (c) 2002 University of Wisconsin, CS 559
20
(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 09/24/02 (c) 2002 University of Wisconsin, CS 559
21
2D Reduction Example (Bartlett)
09/24/02 (c) 2002 University of Wisconsin, CS 559
22
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… 09/24/02 (c) 2002 University of Wisconsin, CS 559
23
(c) 2002 University of Wisconsin, CS 559
Enlarging Images Warp function: f(x)=kx, k < 1 Problem: Have to create pixel data More pixels in output than in input Solution: Filter up to larger size Apply the filter at intermediate pixel locations eg: To get double image size, apply filter at every pixel and every half pixel New pixels are interpolated from old ones Filter encodes interpolation function 09/24/02 (c) 2002 University of Wisconsin, CS 559
24
(c) 2002 University of Wisconsin, CS 559
Enlargement 09/24/02 (c) 2002 University of Wisconsin, CS 559
25
(c) 2002 University of Wisconsin, CS 559
Ideal Enlargement Reconstruct original function Resample at higher frequency Original function was band-limited, so re-sampling does not add any extra frequency information 09/24/02 (c) 2002 University of Wisconsin, CS 559
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.