image (and video) coding and processing lecture 2: basic filtering wade trappe

22
Image (and Video) Coding and Image (and Video) Coding and Processing Processing Lecture 2: Basic Filtering Lecture 2: Basic Filtering Wade Trappe

Post on 22-Dec-2015

234 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Image (and Video) Coding and Processing Lecture 2: Basic Filtering Wade Trappe

Image (and Video) Coding and Image (and Video) Coding and ProcessingProcessing

Lecture 2: Basic FilteringLecture 2: Basic Filtering

Wade Trappe

Page 2: Image (and Video) Coding and Processing Lecture 2: Basic Filtering Wade Trappe

Lecture OverviewLecture Overview

Today’s lecture will focus on:– Review of 1-D Signals

– Multidimensional signals

– Fourier analysis

– Multidimensional Z-transforms

– Multidimensional Filters

Page 3: Image (and Video) Coding and Processing Lecture 2: Basic Filtering Wade Trappe

1-D Discrete Time Signals1-D Discrete Time Signals

A one-dimensional discrete time signal is a function x(n)

The Z-transform of x(n) is given by

The Z-transform is not guaranteed to exist because the summation may not converge for arbitrary values of z.

The region where the summation converges is the Region of Convergence

Example: If U(n) is the unit step sequence, an x(n)=anU(n), then

n

nz)n(x)z(X

azROCaz1

1)z(X

1

Page 4: Image (and Video) Coding and Processing Lecture 2: Basic Filtering Wade Trappe

1-D Discrete Time Signals, pg. 21-D Discrete Time Signals, pg. 2

If the ROC includes the unit circle, then there is a discrete Fourier transform (found by evaluating at z=ej):

The inverse transform is given by:

Observe: The DFT is defined in terms of radians! It is therefore periodic with period 2!

Parseval/Plancherel Relationship:

n

nje)n(x)(X

de)(X2

1)n(x nj2

0

2

0

*

n

* d)(V)(U2

1)n(v)n(u

Page 5: Image (and Video) Coding and Processing Lecture 2: Basic Filtering Wade Trappe

1-D Discrete Time Signals, pg. 31-D Discrete Time Signals, pg. 3

Discrete time linear, time-invariant systems are characterized by the impulse response h(n), which define the relationship between input x(n) and output y(n)

This is convolution, and is expressed in the transform domain as:

Causality: A discrete-time system is causal if the output at time n does not depend on any future values of the input sequence. This requires that

m

)mn(x)m(h)n(y

m

nz)n(h)z(H

)z(X)z(H)z(Y

0nfor0)n(h

Page 6: Image (and Video) Coding and Processing Lecture 2: Basic Filtering Wade Trappe

1-D Filters1-D Filters

The impulse response for a system is also called the system’s transfer function.

In general, transfer functions are of the form

A system is a finite impulse response (FIR) system if H(z)=A(z), i.e. we can remove the denominator B(z)– That is, the impulse response has a finite amount of terms.

An infinite impulse response system is one where H(z) has an infinite amount of non-zero terms.

Example of an IIR system:

M

0n

nn

N

0n

nn zb)z(B,za)z(A

)z(A

)z(B)z(H

1n

az1

1)z(H)n(Ua)n(h

Page 7: Image (and Video) Coding and Processing Lecture 2: Basic Filtering Wade Trappe

1-D Filters, pg. 21-D Filters, pg. 2

A discrete-time system is said to be bounded input bounded output (BIBO stable), if every input sequence that is bounded produces an output sequence that is bounded.

For LTI systems, BIBO stability is equivalent to

Stability in terms of the poles of H(z):– If H(z) is rational, and h(n) is causal, then stability is

equivalent to all of the poles of H(z) lying inside of the unit circle

n

)n(h

Page 8: Image (and Video) Coding and Processing Lecture 2: Basic Filtering Wade Trappe

Sampling: From Continuity to DiscreteSampling: From Continuity to Discrete

The real world is a world of continuous (analog) signals, whether it is sound or light.

To process signals we will need “sampled” discrete-time signals Analog signals xa(t) have Fourier transform pairs

Let us define the sampled function x(n)=xa(nT). The Fourier transforms are related as:

(Note: This is a good, little homework problem… will be assigned!)

dteX2

1tx

dte)t(x)(X

tjaa

tjaa

T/ka T

k2X

T

1)(X

Page 9: Image (and Video) Coding and Processing Lecture 2: Basic Filtering Wade Trappe

Sampling: From Continuity to DiscreteSampling: From Continuity to Discrete

The effect of the sampling in the frequency domain is essentially

– Duplication of Xa() at intervals of 2/T

– Addition of these “copies”

Pictorially, we have something like the following:

Note: If the shifted copies overlap, then its “impossible” to recover the original signal from X().

0 2/T 4/T-2/T-4/T… …

1/T Xa()

Aliasing

Shifted Copies

Page 10: Image (and Video) Coding and Processing Lecture 2: Basic Filtering Wade Trappe

Sampling: From Continuity to Discrete, pg. 2Sampling: From Continuity to Discrete, pg. 2

Aliasing occurs when there is overlap between the shifted copies

To prevent aliasing, and ensure recoverability, we can apply an “anti-aliasing” filter to ensure there is no overlap.

The overlap-free condition amounts to ensuring that

If , then we say that xa(t) is W-bandlimited.

As a consequence of the overlap-free condition, if we sample at a rate at least W, then we can avoid aliasing.

This is, essentially, Shannon’s sampling theorem.

T/for0)(Xa

Wfor0)(Xa

Page 11: Image (and Video) Coding and Processing Lecture 2: Basic Filtering Wade Trappe

Multidimensional signalsMultidimensional signals

A D-dimensional signal xa(t0,t1,…,tD-1) is a function of D real variables.

We will often denote this as xa(t), where the bold-faced t denotes the column vector t=[t0, t1, …, tD-1]T.

The subscript “a” is just used to denote the analog signal. Later, we shall use the subscript “s” to denote the sampled signal, or no subscript at all.

The Fourier transform of xa(t) is defined by

1D10tjtjtj

aa dtdtdteeex...)(X 1D1D1100

Page 12: Image (and Video) Coding and Processing Lecture 2: Basic Filtering Wade Trappe

Multidimensional signals, pg. 2Multidimensional signals, pg. 2

The Fourier transform is thus a scalar function of D variables.

The Fourier transform is (in general) complex!

The Inverse Fourier transform of Xa() is defined by

Define the column vector of frequencies

We get these relationships

1D10

tjtjtjaDa dddeeeX...

2

1)t(x 1D1D1100

Ω

ΩΩt

ttΩ

deX2

1x

dexX

T

T

aDa

aa

1D10 ,,, Ω

Note the difference that D-dimensions introduces compared to 1-d Fourier Transform!

Page 13: Image (and Video) Coding and Processing Lecture 2: Basic Filtering Wade Trappe

Example 2D Fourier TransformExample 2D Fourier Transform

Image example from Gonzalez-Woods 2/e online slides.

Note: Ringing artifacts, just like 1-D case when we Fourier Transform a square wave

Page 14: Image (and Video) Coding and Processing Lecture 2: Basic Filtering Wade Trappe

Bandlimited SignalsBandlimited Signals

The notion of a bandlimited multidimensional signal is a straight-forward extension of the one-dimensional case:– xa(t) is bandlimited if Xa() is zero everywhere except over a

region with finite area.

0

1

Bandlimited Not Bandlimited

0

1

Page 15: Image (and Video) Coding and Processing Lecture 2: Basic Filtering Wade Trappe

Multidimensional Sampled SignalsMultidimensional Sampled Signals

We will use n=[n0,n1,…,nD-1]T to denote an arbitrary D-dimensional vector of integer values

A signal x(n) is just a function of D integer values

The Fourier transform of x(n) and the inverse transform are given by

Key point: X() is periodic in each variable i with period 2

ωωn

n

deX2

1x

exX

T

T

j2

0

aD

j

N

Page 16: Image (and Video) Coding and Processing Lecture 2: Basic Filtering Wade Trappe

Multidimensional Z transformMultidimensional Z transform

The Z transform of x(n) is

Plugging in gives X().

We will often use the notation

This notation will be useful later as it allows us to represent things in a way similar to the 1-dimensional Z-transform

Nn

nz 1D10 n1D

n1

n0 zzzxX

kk tjk ez

Nn

nnz

n

)(ZxX

zzzZ 1D10 n1D

n1

n0

Page 17: Image (and Video) Coding and Processing Lecture 2: Basic Filtering Wade Trappe

Properties of Fourier and Z transformsProperties of Fourier and Z transforms

Linearity

Shift:

Hence, the multidimensional Z-transform is analogous to the one-dimensional delay operator

Convolution:

)(bYaX)(by)(ax

)(bYaX)(by)(ax

)(bYaX)(by)(ax

Z

Fourier

Fourier

zznn

ωωnn

ΩΩtt

)(X)(H)(Y)(x)(h)n(y ZTransform

m

zzzmnm N

zkknn XZ)(x)(y TransformZ

Page 18: Image (and Video) Coding and Processing Lecture 2: Basic Filtering Wade Trappe

Multidimensional FiltersMultidimensional Filters

The basic scenario for multidimensional digital filters is:

Convolution:

Here, the transfer function is

If x(n) has finite support, then y(n) will generally have larger support than x(n)

)(X)(H)(Y)(h)(x)(x)(h)n(y ZTransform

mm

zzzmnmmnm NN

Nn

nnz Z)(h)(H

H(z)x(n) y(n)

Page 19: Image (and Video) Coding and Processing Lecture 2: Basic Filtering Wade Trappe

Multidimensional Filter ResponseMultidimensional Filter Response

Just as in 1-D, the filter H can be characterized in terms of its frequency response.

In this case, the frequency response is

n

nωnωTje)(h)(H

0

1

0

1

0

1

Rectangular Lowpass Circular Lowpass Diamond Lowpass

Page 20: Image (and Video) Coding and Processing Lecture 2: Basic Filtering Wade Trappe

Multidimensional FiltersMultidimensional Filters

Multidimensional filters can be built by applying 1-D filters to each dimension separately

These types of filters are separable.

A separable filter is one for which the frequency response can be represented as:

0

1

0

1

Rectangular Lowpass Not Separable

NN2211 HHH)(H ω

Page 21: Image (and Video) Coding and Processing Lecture 2: Basic Filtering Wade Trappe

2-D Convolution, by hand…2-D Convolution, by hand…

1. Rotate the impulse response array h( , ) around the original by 180 degree

2. Shift by (m, n) and overlay on the input array x(m’,n’)

3. Sum up the element-wise product of the above two arrays

4. The result is the output value at location (m, n)

From Jain’s book Example 2.1

Page 22: Image (and Video) Coding and Processing Lecture 2: Basic Filtering Wade Trappe

For Next Time…For Next Time…

Next time we will focus on multidimensional sampling.– This lecture will be a blackboard/whiteboard style lecture.

To prepare, read paper provided on website, and the discussion on lattices in the textbook