comp 665 convolution. questions? ask here first. likely someone else has the same question

18
Comp 665 Convolution

Post on 21-Dec-2015

215 views

Category:

Documents


0 download

TRANSCRIPT

Comp 665

Convolution

Questions?

• Ask here first.

• Likely someone else has the same question.

Modeling the imaging process

• We know how to compute where points in the world will map on the image plane

• Now, how will they be changed?

Impulse Response Function

• Point Spread Function

• What is the image of a point?– Shape of pinhole for points at infinity– Typically a little blob for a good lens– Could have aberrations and are distance, color,

or position dependent.

• What happens as we enlarge the pinhole?

Blurring as convolution:IRF’s and apertures

• Blurring by convolution with impulse response function: Iblurred(x)= Iinput(y) h(x-y) dy– Replace each point y by y’s intensity times IRF h centered at

y• h(x-y) is effect of a fixed y on x over various image points x

– Sum up over all such points

• Aperture in image space x: – effect of y on x over various y: h(-[y-x])– weighting of various input image points in producing image

at a fixed point x

Linear Systems

• Favorite model because we have great tools

• F(a+b) = F(a) + F(b), F(k a) = k F(a)

• Shift Invariant

• Time Invariant

• Is camera projection linear?

Properties of convolution:Iout(x) = Iin(y) h(x-y) dy

• h(x) is called the convolution kernel• Linear in both inputs, Iin and h• Symmetric in its inputs, Iin and h • Cascading convolutions is convolution with the

convolution of the two kernels: (I * h1)* h2 = I *(h1* h2)– Thus cascading of convolution of two Gaussians

produces Gaussian with = (12 + 2

2)½

• Any linear, shift invariant operator can be written as a convolution or a limit of one

Linear Shift-Invariant Operators

• Blurring with IRF that is constant over the scene

• Viewing scene through any fixed aperture

• All derivatives D– So D(I * h1) = DI *h1= I *Dh1

• Designed operations, e.g., for smoothing, noise removal, sharpening, etc.

• Can be applied to parametrized functions of u– E.g., smoothing surfaces

Convolution Equation1

0

[ ] [ ] [ ]M

j

y i h j x i j

Notorious flip!

•For non-causal symmetric impulse responses it doesn’t matter

•For causal or non-symmetric impulse responses it is critical!

•Important for relating convolution to correlation

•Some texts (web sites) reverse the input, don’t do that

•Reverse the impulse response instead

1D Convolution CodeOutput side algorithmfor i indexing y sum = 0 for j indexing h sum += h[j] * x[i-j] y[i] = sum

Input side algorithmzero yfor i indexing y for j indexing h y[i+j] += x[i]*h[j]

Impulse Response

Example Impulse Responses

Example Impulse Responses

Derivative of Gaussian Weighting Functions

Gaussian: G

Barness along u: Guu

Edgeness along u: Gu

Properties of Convolution

• Commutative: a*b = b*a

• Associative: (a*b)*c = a*(b*c)

• Distributive: a*b + a*c = a*(b+c)

• Central Limit Theorem: convolve a pulse with itself enough times you get a Gaussian

Properties of convolution,continued

• For any convolution kernel h(x), if the input Iin(x) is a sinusoid with wavelength (level of detail) 1/, i.e., Iin(x) = A cos(2x) + B sin(2x), then the output of the convolution is a sinusoid with the same wavelength (level of detail), i.e., Iin * h = C cos(2x) + D sin(2x), for some C and D dependent on A, B, and h(x)

Sampling and integration(digital images)

• Model– Within-pixel integration at all points

• Has its own IRF, typically rectangular

– Then sampling

• Sampling = multiplication by pixel area brush function – Brush function is sum of impulses at pixel centers– Sampling = aliasing: in sinusoidal decomposition higher

frequency components masquerading as and thus polluting lower frequency components

– Nyquist frequency: how finely to sample to have adequately low effect of aliasing

Fun with Convolutionhttp://www.eas.asu.edu/~spanias/convolution_demo.htm

http://www.isip.msstate.edu/projects/speech/software/demonstrations/applets/util/convolution/current/