Comp 665 Convolution

Download Report

Transcript Comp 665 Convolution

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 s = (s12 + s22)½
• 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 Equation
M 1
y[i ]   h[ j ]x[i  j ]
j 0
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 Code
Output side algorithm
for i indexing y
sum = 0
for j indexing h
sum += h[j] * x[i-j]
y[i] = sum
Input side algorithm
zero y
for 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
Barness along u: Guu
Gaussian: G
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/n,
i.e., Iin(x) = A cos(2pnx) + B sin(2pnx),
then the output of the convolution is a sinusoid
with the same wavelength (level of detail), i.e.,
Iin * h = C cos(2pnx) + D sin(2pnx), 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 Convolution
http://www.eas.asu.edu/~spanias/convolution_demo.htm
http://www.isip.msstate.edu/projects/speech/software/demonstration
s/applets/util/convolution/current/