0% found this document useful (0 votes)
89 views54 pages

EECE 5639 Computer Vision I: Filtering, Probability Review

This document provides an overview of image processing and filtering techniques. It discusses how digital images are represented as 2D arrays of pixel values, and different levels of computation including point, local, global, and object levels. It also covers topics such as spatial filtering using masks, linear filtering operations like correlation and convolution, and examples of smoothing filters used to reduce noise in images.
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)
89 views54 pages

EECE 5639 Computer Vision I: Filtering, Probability Review

This document provides an overview of image processing and filtering techniques. It discusses how digital images are represented as 2D arrays of pixel values, and different levels of computation including point, local, global, and object levels. It also covers topics such as spatial filtering using masks, linear filtering operations like correlation and convolution, and examples of smoothing filters used to reduce noise in images.
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/ 54

EECE 5639 Computer Vision I

Lecture
Filtering, Probability Revie
Next Clas
Noise Cleaning, Edges

1
7

Image processing:
Filtering
Digital Images

are 2D arrays (matrices) of numbers:

3
Digital Images
Array of numbers (pixels
Typically integers 0-255 (unsigned byte
Pixels have neighbors

4-neighbors 8-neighbors

4
)

Image Paths
A path is a sequence of pixel indices (io,jo)(i1,j1)…(in,jn) such tha
(ik,jk) is a neighbor of (ik+1,jk+1)

4-connected
path

8-connected path

Levels of Computation
Point leve
Output based only on a single poin
Ex.: thresholdin
Local leve
Output based on a neighborhoo
Ex. : smoothing and edge detectio
Global leve
Output based on the whole imag
Ex.: Fourier transform and histogra
Object leve
Output based on pixels that belong to an object

6
l

Spatial Filtering
Spatial Filtering
• Use of spatial masks (kernels, lters, templates,
windows) for image processing (spatial lters
• Linear and nonlinear lter
• Spatial Filters include
• Sharpenin
• Smoothin
• Edge detectio
• Noise remova
• etc

8
g

fi
:

fi
fi
)

Linear Filters
• General process • Example: smoothing by averagin
• Form new image whose pixels are a • form the average of pixels in a
weighted sum of original pixel values, neighborhoo
using the same set of weights at each
point • Example: smoothing with a Gaussia
• Propertie • form a weighted average of pixels in a
• Output is a linear function of the inpu neighborhoo
• Output is a shift-invariant function of • Example: nding a derivativ
the input (i.e. shift the input image two
pixels to the left, the output is shifted
• form a weighted average of pixels in a
two pixels to the left) neighborhood

Note: The “Linear” in “Linear Filters” means linear


combination of neighboring pixel values.

9
.

fi
d

Image Filtering
Low-pass lters eliminate or attenuate high frequency
components in the frequency domain (sharp image
details), and result in image blurring

High-pass lters attenuate or eliminate low-frequency


components (resulting in sharpening edges and other
sharp details)

Band-pass lters remove selected frequency regions


between low and high frequencies (for image restoration,
not enhancement).

10
fi
fi
fi
.

Spatial Filtering
Operations are performed directly on the pixels in the
spatial domain

The process involves sweeping a mask on the image


and performing at each point a set of prede ned
operations on the pixels overlapped by the mask.

11
.

fi
Basics of Spatial Filtering

Ex of a 3x3 mask

12
Linear Spatial Filtering: CORRELATION
Linear ltering of an MxN image f(x,y) with a lter
w(s,t) of size mxn is given by:

Where m and n are odd numbers

This is similar to convolution … and it is often referred as


“convolving with a mask”
13
fi
fi
Linear Spatial Filtering: CORRELATION
Alternative notation:

Where zi are the values of the input image under the mask

14
Practical Issue: Border Handling

0000 …

Most commonly used

• Reflection at border also a useful option!


15
Correlation Example

h
f

16
Correlation Example

17
18
19
20
21
22
And so on …
Correlation vs Convolution

Correlation:

FLIP FIRST!
Convolution:

24
Correlation vs Convolution

If the mask is symmetric, then there is no difference.

25
Correlation and Convolution in MATLAB

Could use conv and conv2, but newer versions use

Im lter(image,template{,option1,option2,…}

Boundary options: constant, symmetric, replicate, circula

Output size options: same as image, or full size (include


partial values computed when mask is off the image)

Corr or conv option: convolution ips the template (a


we have discussed, correlation does not)

Type “help im lter” on command line for more details


26
fi
fi
fl
.

Filtering with Correlation

27
Filtering with Correlation

28
Filtering with Correlation

29
Filtering with Correlation

30
Filtering with Correlation

31
Filtering with Correlation

32
Smoothing Filters
Image Noise
Images are nois
Noise is anything in the image that we are not interested i
Examples
Fluctuations of pixel value
Numerical error
Clutter

34
:

Images as Surfaces

Surface height
proportional to
pixel grey value
(dark=low, light=high)

Bob Collins 35



Examples

Mean = 164 Std = 1.8


Bob Collins 36
Where does noise come from?
Light uctuation
Sensor nois
Quantization effect
Finite precision

37
fl
e

Modeling Noise
We are interested in RANDOM noise
Deterministic noise (ex: hardware defects) can be corrected.

38 .

Dealing with Noise


Image patch Noisy surface

We want something
more like this!

Bob Collins 39

Probability Review
Intuitive Development
Intuitively, the probability of an event a could be de ned as:

Where N(a) is the number that event a happens in n trials

41
More Formal:
Ω is the Sample Space:
Contains all possible outcomes of an experimen
ω in Ω is a single outcom
A in Ω is a set of outcomes of interest

42
e

Independence
The probability of independent events A, B and C is given by

P(ABC) = P(A)P(B)P(C)

A and B are independent, if knowing that A has happened


does not say anything about B happening

43
Conditional Probability
One of the most useful concepts!

Ω
A
AB
B

44
Bayes Theorem
Provides a way to convert a-priori probabilities to a-posteriori
probabilities:

45
Random Variables
A (scalar) random variable X is a function that maps the
outcome of a random event into real scalar values

Ω X(ω)
ω

46
Random Variables Distributions
Cumulative Probability Distribution (CDF):

Random Variable value

• Probability Density Function (PDF):

47
Random Distributions:
From the two previous equations:

“The area under the curve is equal to 1.0.”

48
Statistical Characterizations
Expectation (Mean Value, First Moment):

“weighted average”

• Second Moment:

49
Statistical Characterizations
Variance of X:
“how far is x from the mean”

Second Moment (First Moment)2

• Standard Deviation of X:

50
Mean Estimation from Samples
Given a set of N samples from a distribution, we can
estimate the mean of the distribution by:

51
Variance Estimation from Samples
Given a set of N samples from a distribution, we can
estimate the variance of the distribution by:

52
Uniform Distribution
A R.V. X that is uniformly distributed between x1 and x2 has
density function:

X1 X2

53
Gaussian (Normal) Distribution
A R.V. X that is normally distributed has density function:

µ
54

You might also like