CS 450: Introduction to Digital Signal and Image Processing Bryan Morse BYU Computer Science Introduction Analyzing Systems Goal: analyze a device that turns one signal into another. Notation: f (t) g(t) f (t) is the input signal g(t) is the output signal (We ll write this for 1-dimensional signals, but all of the theory applies to higher-dimensional signals as well.)
Introduction Linearity (Revisited) An operation T is linear if and only if T (ax + by) = at (x) + bt (y) Implications: T (ax) = at (x) T (x + y) = T (x) + T (y) Introduction Multiplying an Input to a Linear Operation If the operation is linear: f (t) g(t) a f (t) a g(t) Applying a linear operation to an signal multiplied by a constant is the same as applying the operation and then multiplying by that constant. This is called the scaling property of linear operations.
Introduction Adding Inputs to a Linear Transformation If the operation is linear: f 1 (t) g 1 (t) f 2 (t) g 2 (t) f 1 (t) + f 2 (t) g 1 (t) + g 2 (t) Applying a linear operation to the sum of two signals is the same as applying it to each separately and adding the results. This is called the superposition property of linear operations. Introduction Shift Invariance Shift invariance means an operation is invariant to translation. Implication: If you shift the input, you get the same (shifted) output. In other words, implies f (t) g(t) f (t + T ) g(t + T )
Introduction Systems Linearity and shift invariance are nice properties for a signal-processing operation to have: input devices output devices processing A transformation that is both linear and shift invariant is called a system. Introduction The Little White Lie No physical device is really a linear system: Linearity is limited by saturation. Shift invariance is limited by sampling duration or field of view. Random noise isn t linear. But many devices are nearly linear over a limited field of view, limited range of response, and reasonable noise.
Impulses and Impulse Responses Impulses Since the system does the same thing everywhere, let s test it at a single point with a single spike in the signal, a single point of light, etc. and see what happens. We know we can t make a single perfect spot/spike, but we can consider what happens in the limit as we do. Suppose that we take a uniform spot of light with width w and brightness 1/w so that the total flux stays constant. What happens in the limit as we make it smaller (w 0)? Impulses and Impulse Responses Impulse Functions Mathematically, a perfect single-point input is called an impulse function and is written as δ(t) = { if t = 0 0 otherwise and δ(t) dt = 1 This is also called the Dirac delta function.
Impulses and Impulse Responses More on Impulse Functions Shifting a delta function just shifts the non-zero spike: δ(t k) = { if t = k 0 otherwise Multiplying a delta function by a constant multiplies the integrated area: a δ(t) dt = a Stretching/shrinking the time scale changes the area of the delta function accordingly: δ(at) dt = 1 a Impulses and Impulse Responses Impulse Responses Because a system is shift-invariant, it responds the same everywhere: δ(t) h(t) implies δ(t + T ) h(t + T ) So we only have to measure this response h(t) once. This response h(t) is called the impulse response, or perhaps more descriptively for images, the point spread function.
Impulses and Impulse Responses Impulse Responses Because a system is linear, the response to a multiplied impulse is the same multiple of the impulse response: implies δ(t) h(t) a δ(t) a h(t) Impulses and Impulse Responses Impulse Responses Because a system is linear, the response to two impulses is the same as the sum of the two responses to them individually: implies δ(t) h(t) δ(t + T ) h(t + T ) δ(t) + δ(t + T ) h(t) + h(t + T )
Impulses and Impulse Responses Impulse Responses Putting it all together: implies δ(t) h(t) a δ(t) + b δ(t + T ) a h(t) + b h(t + T ) If you know the impulse response at any point, you know the output for any combination of input points you know everything there is to know about the system! Response Over An Entire Signal Response to an Entire Signal A signal f (t) can be thought of as the sum of a whole lot of weighted shifted impulse functions: f (t) = a(τ) δ(t τ) dτ where δ(t τ) is a delta function at position τ a(τ) is the weight of that delta function (Read the integral simply as summation over all input positions τ.)
Response Over An Entire Signal Response to an Entire Signal Because of linearity, each impulse goes through the system separately: a(τ) δ(t τ) a(τ) h(t τ) This means a(τ) δ(t τ) dτ a(τ) h(t τ) dτ Response Over An Entire Signal Response to an Entire Signal But isn t the weight a(τ) of the delta function at τ just the value of the function there f (τ)? So, f (t) f (τ) h(t τ) dτ This is just the convolution of f and h.
of input f (t) by impulse response h(t) is written as f (t) h(t) where f (t) h(t) = = f (τ) h(t τ) dτ f (t τ) h(τ) dτ Compare this to discrete convolution as we saw it earlier: f (t) h(t) = k f (t k) h(k) Response to an Entire Signal (revisited) So, the response of a system with impulse response h(t) to input f (t) is simply the convolution of f (t) and h(t): f (t) f (t) h(t)
One Way to Think of Think of it this way: Or: f (t) h(t) = f (t) h(t) = k f (τ) h(t τ) dτ f (k) h(t k) shift a copy of h to each position τ (or discrete position k) multiply by the value at that position f (τ) (or discrete sample f (k)) add shifted, multiplied copies for all τ (or discrete k) break the signal into each continuous point or discrete sample send each one through individually to produce blurred points add up the blurred points Example: - One Way f (t) = [ ] h(t) = [ ] f (0) h(t 0) = [ ] f (1) h(t 1) = [ ] f (2) h(t 2) = [ ] f (3) h(t 3) = [ ] f (4) h(t 4) = [ ] f (t) h(t) = k f (k) h(t k) = [ ]
- Another Way To Look At It f (t) h(t) = k = k f (k) h(t k) h(k) f (t k) Think of it this way: flip the function h around zero shift a copy to output position t point-wise multiply for each position k the value of the function f and the shifted inverted copy of h add for all k and write that value at position t Same as the spatial filtering we ve already talked about, except the mask is the flipped impulse response. Example: - Another Way f (t) = [ ] h(t) = [ ] f (t) h(t) = k f (k) h(t k) = [ ]
Why Flip the Impulse Function? An input at t produces a response at t + τ of h(τ). How do you determine how the output at t is affected by input at t + τ? h( τ) Other Applications of : Polynomial Multiplication p 1 (x) = x 2 + x + p 2 (x) = x 2 + x + p 1 (x) p 2 (x) = x 4 + x 3 + x 2 + x +
in Statistics If you add the results from two independent distributions, the distribution of this sum is the convolution of the two independent distributions. Central Limit Theorem: As you convolve any distribution with itself an infinite number of times, in the limit it approaches a normal (Gaussian) distribution. in Two Dimensions In one dimension: f (t) h(t) = f (τ) h(t τ) dτ In two dimensions: I(x, y) h(x, y) = I(τ x, τ y ) h(x τ x, y τ y ) dτ x dτ y Or in discrete form: I(x, y) h(x, y) = j k I(j, k) h(x j, y k)
Properties of has the following mathematical properties: Commutative Associative Distributes over addition In simple terms, convolution has the same mathematical properties as multiplication. (This is no coincidence.)