Image Manipulation: Median Filtering and Finding Edges, Study notes of Computer Science

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

Pre 2010

Uploaded on 08/30/2009

koofers-user-8ai
koofers-user-8ai 🇺🇸

10 documents

1 / 39

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
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
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27

Partial preview of the text

Download Image Manipulation: Median Filtering and Finding Edges and more Study notes Computer Science in PDF only on Docsity!

„

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:

B

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