0% found this document useful (0 votes)
11 views67 pages

Convolution and Linear Filters Overview

The document provides an overview of linear filters and convolution in the context of computer vision, detailing both one-dimensional and two-dimensional convolution processes. It discusses the importance of impulse response, step response, and frequency response of linear filters, along with various filter kernels such as Gaussian and Sobel. Additionally, it covers concepts like shift-invariant linear systems and the Nyquist sampling theorem to avoid aliasing in signal processing.

Uploaded by

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

Convolution and Linear Filters Overview

The document provides an overview of linear filters and convolution in the context of computer vision, detailing both one-dimensional and two-dimensional convolution processes. It discusses the importance of impulse response, step response, and frequency response of linear filters, along with various filter kernels such as Gaussian and Sobel. Additionally, it covers concepts like shift-invariant linear systems and the Nyquist sampling theorem to avoid aliasing in signal processing.

Uploaded by

Paras Jain
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

COMPUTER VISION

(CSE3010)
Module-1
CONVOLUTION &
LINEAR FILTERS Dr. Paras Jain
Associate Professor
School of Computing Science
Engineering and Artificial Intelligence
LINEAR FILTERS – INTRODUCTION TO DISCRETE TIME SIGNALS
LINEAR FILTERS – IMPULSE
RESPONSE

Impulse response of a continuous system

Impulse response of a discrete system


Impulse function
1DIMENSIONA
L
CONVOLUTION
BRIEF LOOK
Convolution of two signals f and g
LINEAR FILTERS-TIME DOMAIN VS FREQ DOMAIN
IMPULSE, STEP
AND FREQUENCY
RESPONSE OF A
LINEAR FILTER

Every linear filter has an impulse response, a step response


and a frequency response
TWO-DIMENSIONAL
FOURIER
TRANSFORM
EDGE EFFECTS IN DISCRETE
CONVOLUTIONS
 Fourier transform is a type of integral transform

The process takes a complex valued function of x, y and returns


a complex valued function of u, v (images are complex valued functions
with zero imaginary component)
EDGE EFFECTS IN DISCRETE
CONVOLUTIONS

 These terms are sinusoids on the x, y plane, whose


orientation and frequency are given by u, v

 tan θ = v/u

 The gradient of this term is perpendicular to lines


where ux+vy is constant, and the frequency of the
sinusoid is 𝑢𝑢2 + 𝑣𝑣2

 These sinusoids are often referred to as spatial frequency


components
EDGE EFFECTS IN DISCRETE
CONVOLUTIONS
 Inverse Fourier transform , IDFT for discrete
 It is useful to be able to recover a signal from its Fourier transform
LINEAR FILTERS -1D &
2D CONVOLUTION
LINEAR FILTERS – INTRODUCTION TO 1D CONVOLUTION

Continuous time
convolution

Discrete time
convolution
LINEAR FILTERS – INTRODUCTION TO 1D CONVOLUTION
LINEAR FILTERS – INTRODUCTION TO 1D CONVOLUTION
LINEAR FILTERS – INTRODUCTION TO 1D CONVOLUTION
LINEAR FILTERS – INTRODUCTION TO 1D CONVOLUTION
LINEAR FILTERS – INTRODUCTION TO 1D CONVOLUTION
LINEAR FILTERS – INTRODUCTION TO 1D CONVOLUTION
LINEAR FILTERS – INTRODUCTION TO 1D CONVOLUTION
LINEAR FILTERS – INTRODUCTION TO 1D CONVOLUTION

Cross check with the


analytical method
LINEAR FILTERS – INTRODUCTION TO 1D CONVOLUTION

Cross check with the analytical method


LINEAR FILTERS – INTRODUCTION TO 1D CONVOLUTION

Cross check with the analytical method


LINEAR FILTERS - CONVOLUTION

 Convolution between two given signals, 𝒇 𝒔


and 𝒉𝒉 𝒔 is given by the following integral,
where
𝒚 denotes the convolution output:

𝒚 =𝒇
𝒇 ∗𝒉
𝒉𝒙 � 𝒔𝒇 . 𝒉𝒉 𝒙 𝒅
= − 𝒔 𝒅𝒔
𝒔


= �

𝒉𝒉 𝒔 . 𝒇 𝒙 𝒅
− 𝒔 𝒅𝒔
𝒔
CONVOLUTION –
A CLOSER LOOK
LINEAR FILTERS - CONVOLUTION

Convolution of a discrete- time input signal x[k]


and impulse response h[n- k]. (commutative)
LINEAR FILTERS – FILTER KERNELS

The pattern of weights used


for a linear filter is usually
referred to as the kernel of
the filter
LINEAR FILTERS – 2D
CONVOLUTION
 Convolution between a kernel (typically a 3x3 or 5x5 matrix)
and an image

Kernel of the
2D filter
Image
DIFFERENT FILTER KERNELS FOR 2D CONVOLUTION

Sobel Kernel

Gaussian Kernel

Box-blur Kernel
LINEAR FILTERS –
TYPES
LINEAR FILTERS
– TYPES
LINEAR FILTERS
– TYPES
LINEAR FILTERS
– TYPES
LINEAR FILTERS
– TYPES
SMOOTHING BY
AVERAGING
SMOOTHING BY
 AVERAGING
Reduce the effects of noise by replacing each pixel with a
weighted average of its neighbours, a process often referred to as
blurrin
smoothing or
g

Original Image Smoothed Image


SMOOTHING BY
AVERAGING
SMOOTHING BY
AVERAGING
 Although a uniform local average may
seem to give a good blurring model, it
generates effects that are not usually
seen in defocussing a lens. The images
above compare the effects of a uniform
local average with weighted average

 The degree of blurring in each case is


about the same, but the uniform average
produces a set of narrow vertical and
horizontal bars — an effect often known
as ringing

 The bottom row shows the weights used to


blur the image, themselves rendered as an
image; bright points represent large
values and dark points represent small
values (in this example the smallest values
THE 2D GAUSSIAN
SMOOTHING
FILTER
GAUSSIAN SMOOTHING
FILTER
 Case of weighted averaging
Coefficients are 2D Gaussian
Gives more weight at the central pixels and less
weights to the neighbors
 The farther away the neighbors, the smaller
the weight

1

𝑥𝑥 2 + 𝑦
𝐺𝐺𝜎𝜎(x, y) = 2 exp 𝑦 2

2
𝜋𝜋 2𝜋𝜋2
GAUSSIAN SMOOTHING
FILTER

 The symmetric Gaussian kernel in


2D. This view shows a kernel scaled so
that its sum is equal to one

 Convolution with this kernel forms


a weighted average which stresses
the point at the center of the
convolution window, and
incorporates little contribution
from those at the boundary.
𝐺𝐺𝜎𝜎(x, y) = 1 2 exp − 𝑥𝑥2 +
2
𝜋𝜋
𝑦𝑦2 2𝜋𝜋
GAUSSIAN SMOOTHING
FILTER
BOX FILTER VS
GAUSSIAN
GAUSSIAN SMOOTHING – DIFFERENT
SCALES
SMOOTHING BY GAUSSIAN
FILTER
The standard deviation of
the gaussian determines
the amount of smoothing
Gaussian theoretically has
infinite support, but we
need a filter of finite size
For a 98.76% of the area,
we need +/ -2.5σ
 + / - 3σ covers over 99% of
the area
SHIFT-
INVARIANT
LINEAR SYSTEMS
SHIFT INVARIANT LINEAR
SYSTEMS
 Most imaging systems have, to a good approximation, three
significant properties
SHIFT INVARIANT LINEAR
SYSTEMS
 Most imaging systems have, to a good approximation,
three significant properties

In a shift invariant system, the response to a translated


stimulus is just a translation of the response to the
stimulus

The response of a shift invariant linear system to a


stimulus is obtained by convolution
SAMPLING AND
ALIASING
SAMPLING AND
ALIASING
The Nyquist sampling theorem provides a
prescription for the nominal sampling interval
required to avoid aliasing
It may be stated simply as follows:
The sampling frequency should be at least twice the
highest frequency contained in the signal. Or in
mathematical terms: fs >= 2fc
𝑠 𝑓𝑠𝑓
≥where
2𝑓𝑓𝑐𝑐 fs is the sampling frequency
(how often samples are taken per unit of time or space),
and 𝑐𝑓𝑓𝑐is the highest frequency contained in
the signal.
SAMPLIN
G
 The sampling frequency
should be at least twice
the highest frequency
contained in the signal.
Or in mathematical
terms:
𝑠𝑓𝑠𝑓≥ 2𝑓
𝑓𝑐
𝑐
where fs is the sampling
frequency (how often
samples are
taken per unit
of time or
spa ce), and 𝑐𝑓𝑓𝑐is the highest
frequency contained in the
signal.
SAMPLIN
G
 The sampling frequency
should be at least twice
the highest frequency
contained in the signal.
Or in mathematical
terms:
𝑠𝑓𝑠𝑓≥ 2𝑓
𝑓𝑐
𝑐
where fs is the sampling
frequency (how often
samples are
taken per unit
of time or
spa ce), and 𝑐𝑓𝑓𝑐is the highest
frequency contained in the
signal.
SAMPLIN
G
 The sampling frequency
should be at least twice
the highest frequency
contained in the signal.
Or in mathematical
terms:
𝑠𝑓𝑠𝑓≥ 2𝑓
𝑓𝑐
𝑐
where fs is the sampling
frequency (how often
samples are
taken per unit
of time or
spa ce), and 𝑐𝑓𝑓𝑐is the highest
frequency contained in the
signal.
ALIASIN
G
 The sampling frequency
should be at least twice
the highest frequency
contained in the signal.
Or in mathematical
terms:
𝑠𝑓𝑠𝑓≥ 2𝑓
𝑓𝑐
𝑐
where fs is the sampling
frequency (how often
samples are
taken per unit
of time or
spa ce), and 𝑐𝑓𝑓𝑐is the highest
frequency contained in the
signal.
ALIASIN
G
 The sampling frequency
should be at least twice
the highest frequency
contained in the signal.
Or in mathematical
terms:
𝑠𝑓𝑠𝑓≥ 2𝑓
𝑓𝑐
𝑐
where fs is the sampling
frequency (how often
samples are
taken per unit
of time or
spa ce), and 𝑐𝑓𝑓𝑐is the highest
frequency contained in the
signal.

You might also like