0% found this document useful (0 votes)
48 views62 pages

Lecture 9-10

The document discusses linearity and convolution operations. Some key points: - Linear operators have the properties of additivity and multiplicative scaling. - The impulse response of a system describes its output when given an impulse as input. - Convolution describes filtering an image with a kernel or filter. It has properties like shift-invariance. - Median filtering can be used to remove salt and pepper noise while preserving edges better than Gaussian filtering.

Uploaded by

misbah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views62 pages

Lecture 9-10

The document discusses linearity and convolution operations. Some key points: - Linear operators have the properties of additivity and multiplicative scaling. - The impulse response of a system describes its output when given an impulse as input. - Convolution describes filtering an image with a kernel or filter. It has properties like shift-invariance. - Median filtering can be used to remove salt and pepper noise while preserving edges better than Gaussian filtering.

Uploaded by

misbah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 62

Linearity and convolution

Linearity ….

• An operator H (or system) is linear if two properties


hold (f 1 and f 2 are some functions, a is a constant):

• Additivity :
H ( f 1 + f 2 ) = H ( f 1 ) + H ( f 2 ) (distributive law)

• Multiplicative scaling (Homogeneity):


H ( a • f 1) = a • H ( f 1 ) (constant scales) a times H applied to f1
Linearity ….

if we could sum up a bunch of things to make an image, then if


we apply a linear operator to that whole image, it's going to be
the same as the sum of applying that linear operator to each of the
pieces.
An impulse function...

• In the discrete world, an impulse is just a value of 1


at a single location.
An impulse response

• If we have an unknown system and we "put in" an impulse, the


response is called the impulse response.

• So if the black box is linear you can describe H by h(x)


Filtering an impulse signal
Impulse response looks like in an image.

Result of filtering the impulse signal (image) F with the arbitrary kernel H?
Filtering an impulse signal
Filtering an impulse signal
Filtering an impulse signal
Filtering an impulse signal
Filtering an impulse signal

Assuming center
coordinate is "reference point".
Correlation vs Convolution
We had this problem, of when we put in through a correlation, we got back out
sort of this flip thing.
Convolution
Shift invariant:

• Operator behaves the same everywhere, i.e. the value of the


output depends only on the pattern in the image neighborhood,
rather than the position.
Properties of convolution convolution or correlation are built on
multiplication and
addition, these are linear operators.
Computational Complexity
Separability

• In some cases, filter is separable, meaning you can get the


square kernel H by convolving a single column vector by some
row vector:
r

c H
Separability
r

c H

G = H * F = (C * R) * F = C * (R * F)
• So we do two convolutions but each is W*N*N. So this is useful
if W is big enough such that 2 • W • N2 << W2 • N2
• Used to be very important. Still, if W=31, save a factor of 15.
Boundary issues

• What is the size of the output?

• We have three choices:


Boundary issues

What about near the edge?


• methods:
• clip filter (black)
Boundary issues

What about near the edge?


• methods:
• clip filter (black)
Boundary issues

What about near the edge?


• methods:
• clip filter (black)
Boundary issues

What about near the edge?


• methods:
• clip filter (black)
• wrap around
Boundary issues

What about near the edge?


• methods:
• clip filter (black)
• wrap around
Periodic signal
Boundary issues

What about near the edge?


• methods:
• clip filter (black)
• wrap around
Boundary issues

What about near the edge?


• methods:
• clip filter (black)
• wrap around
• copy edge
Boundary issues

What about near the edge?


• methods:
• clip filter (black)
• wrap around
• copy edge
Boundary issues

What about near the edge?


• methods:
• clip filter (black)
• wrap around
• copy edge
Boundary issues

What about near the edge?


• methods:
• clip filter (black)
• wrap around
• copy edge
• reflect across edge
Boundary issues

What about near the edge?


• methods:
• clip filter (black)
• wrap around
• copy edge
• reflect across edge
Called symetric
Boundary issues

What about near the edge?


• methods:
• clip filter (black)
• wrap around
• copy edge
• reflect across edge
Called symetric
Boundary issues

What about near the edge?


• methods:
• clip filter (black)
• wrap around
• copy edge
• reflect across edge
Called symetric
Boundary issues

• methods (IPT MATLAB):


• clip filter (black): imfilter(f, g, 0)

• wrap around: imfilter(f, g, 'circular')


• copy edge: imfilter(f, g, 'replicate')
• reflect across edge: imfilter(f, g, 'symmetric')
Practice with linear filters
Practice with linear filters
Practice with linear filters
Practice with linear filters
Filtering examples: sharpening
Different kinds of noise

• Gaussian averaging was a reasonable thing


to do if the noise was independent at each pixel and
centered about zero such as if created by a Gaussian
or normal noise process.

• But there are other kinds of noise.


Different kinds of noise

Additive Gaussian noise Salt and pepper noise


Recall: Assumptions for removing noise
• The way to approach this is to remember our other assumption
about images: that the underlying image changes smoothly around a
pixel. So if you were to inject some arbitrary value in there the
question is how to find the original pixel.

• Remember that when we are the blurring, we replace the pixel value
by the local average. That's fine when the noise is modest and tends
to add to zero over a neighborhood. But if there are a few totally
random values thrown in, we need another approach.

• As many of you know the way to deal with such ugly perturbation is
to use what's called a median filter.
Median filter

No new pixel
values introduced.

Removes spikes:
good for impulse,
salt & pepper noise.

Linear?
Salt and Median
pepper filtered
noise

Plots of a row of the image


Median filter
Median filter is edge preserving
Normalized Correlation
1D (nx)correlation
1D (nx)correlation

Signal

Filter
1D (nx)correlation

Signal

Filter

Normalized
cross-correlation
Matlab cross-correlation doc
Matlab cross-correlation doc
Matlab cross-correlation doc
Template matching Filters as templates

A toy example

Template (mask)

Scene
K. Grauman
Template matching

Template (mask)

Detected template
Template matching

Detected template Correlation map


Where's Waldo?

Scene
Template

K. Grauman
Where's Waldo?

Template

Detected Template
Where's Waldo?

Detected template Correlation map


Template matching
What if the template is not identical to some sub¬
image in the scene?

Template

Scene K. Grauman
Template matching
Match can be meaningful, if scale, orientation, and
general appearance is right.

Detected template

You might also like