































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A series of lecture notes from a computer science course focusing on image manipulation. The notes cover the concepts of median filtering to remove 'dirty pixels' and noise from images, and finding edges using the rate-of-change array. The document also includes code examples and explanations.
Typology: Study notes
1 / 39
This page cannot be seen from the preview
Don't miss anything!
































Previous Lecture:
Working with images
Today’s Lecture:
More on manipulating images
Announcements:
Prelim 2 tonight 7:30pm Statler Aud.
Project 4 due Tues 3/31 at 11pm
No office/consulting hours during break
March 12, 2009
Lecture 16
An image as an array: values in [0..255]
150
149
152
153
152
155
151
150
153
154
153
156
153
151
155
156
155
158
154
153
156
157
156
159
156
154
158
159
158
161
157
156
159
160
159
162
0 = black
255 = whiteThese are
integer values
Type:
uint
March 12, 2009
Lecture 16
Clean up “noise” — median filtering
March 12, 2009
Lecture 16
150
149
152
153
152
155
151
150
153
154
153
156
153
?
?
156
155
158
154
?
?
157
156
159
156
154
158
159
158
161
157
156
159
160
159
162
Assign “typical”neighborhoodgray values to
“dirty pixels”
What to do with the dirty pixels?
March 12, 2009
Lecture 16
Median Filtering
Visit each pixel
Replace its gray value by the median of the grayvalues in the “neighborhood”
March 12, 2009
Lecture 16
Using a radius 1 “neighborhood”
6
7
6
7 0
7 7
6
6
Before
6
7
6
7 6
7 7
6
6
After
0 6 6 6 6 7 7 7 7
median
March 12, 2009
Lecture 16
i
j
Original: Filtered:
Replace
with the median of the values under the window.
March 12, 2009
Lecture 16
i
j
Original: Filtered:
Replace
with the median of the values under the window.
March 12, 2009
Lecture 16
i
j
n
Original: Filtered:
Replace
with the median of the values under the window.
March 12, 2009
Lecture 16
i
j
Original: Filtered:
Replace
with the median of the values under the window.
March 12, 2009
Lecture 16
i
m
j
n
Original: Filtered:
Replace
with the median of the values under the window.
March 12, 2009
Lecture 16
What We Need…
(1) A function that computes the medianvalue in a 2-dimensional array C:
m
medVal(C)
(2) A function that builds the filtered imageby using median values of radius rneighborhoods:
medFilter(A,r)
March 12, 2009
Lecture 16
Median of a 2D Array
function
med
medVal(C)
[p,q]
size(C);
x
for
k=1:p
x
[x
C(k,:)];
end %
Compute median of x and assign to med
March 12, 2009
Lecture 16
Back to Filtering…
m = 9
n = 18
for i=1:m
for j=1:n
Compute new gray value for pixel (i,j)
end
end