Problem Set 2 for CMSC 426: 1D Signal Processing and Edge Detection - Prof. David Jacobs, Assignments of Computer Science

Problem set 2 for the cmsc 426 course, focusing on 1d signal processing and edge detection using gaussian filters. Students are required to write functions for producing gaussian kernels, convolving signals with kernels, and creating 1d edge detectors. They will also analyze edge detection in images and explore the effects of different parameters.

Typology: Assignments

Pre 2010

Uploaded on 02/13/2009

koofers-user-mzf
koofers-user-mzf 🇺🇸

10 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CMSC 426
Problem Set 2
Due:
Tuesday, March 4, 2003, 11:00, at the start of class. Email all Matlab code to the
TA before 11:00 also.
Readings:
Forsyth & Ponce:
Chapters 7 and 8.
1.
10 points
Prove that convolving a 1-
D signal twice with a Gaussian k
ernel is
equivalent to convolving the signal with a single Gaussian kernel with a larger
standard deviation. (Hint: Make use of the identity:
A
Z
Zx
Ax
e
A
dxe 22
12
2
π
=
+
with A>0.)
2)
1D Edge Detection
a)
10 points
Write a function to produce a Gaussian kernel, i
n which the standard
deviation, sigma, is a parameter. Make sure the kernel is big enough to capture
99% of the area of the Gaussian. Plot it for sigma=2. Turn in the plot.
b)
10 points
Write a function to convolve a signal with a kernel in 1D. Test it
by
convolving a Gaussian with itself 2 and 3 times. Plot both. Turn in the plots.
c)
20 points
Write a 1D edge detector. This should take 2 parameters, the amount
of smoothing and a threshold on the strength of the edge. Test it by finding the
edges in
the following 1D image.
I = [zeros(1,50), .9*ones(1,10), zeros(1,10), .6*ones(1,40), zeros(1,50)].
d)
20 points
Use a very low threshold, which should work since there’s no noise.
For sigma = .5, 1, 1.5, 2, 2.5, 3, … 25 determine the location of the edges in image I
(from part 2c). Plot them in a 2D picture, where each row shows the edges detected
for a different sigma. Turn in the plot.
e)
20 points
Form and turn in the same plot, this time adding Gaussian noise to the
image with a standard deviation of 1 (see function
randn
).
pf3

Partial preview of the text

Download Problem Set 2 for CMSC 426: 1D Signal Processing and Edge Detection - Prof. David Jacobs and more Assignments Computer Science in PDF only on Docsity!

CMSC 426

Problem Set 2

Due: Tuesday, March 4, 2003, 11:00, at the start of class. Email all Matlab code to the TA before 11:00 also.

Readings: Forsyth & Ponce: Chapters 7 and 8.

  1. 10 points Prove that convolving a 1-D signal twice with a Gaussian kernel is equivalent to convolving the signal with a single Gaussian kernel with a larger standard deviation. (Hint: Make use of the identity:

A

Z

Ax Zx

e

A

e dx

with A>0.)

  1. 1D Edge Detection a) 10 points Write a function to produce a Gaussian kernel, in which the standard deviation, sigma, is a parameter. Make sure the kernel is big enough to capture 99% of the area of the Gaussian. Plot it for sigma=2. Turn in the plot.

b) 10 points Write a function to convolve a signal with a kernel in 1D. Test it by convolving a Gaussian with itself 2 and 3 times. Plot both. Turn in the plots.

c) 20 points Write a 1D edge detector. This should take 2 parameters, the amount of smoothing and a threshold on the strength of the edge. Test it by finding the edges in the following 1D image. I = [zeros(1,50), .9ones(1,10), zeros(1,10), .6ones(1,40), zeros(1,50)].

d) 20 points Use a very low threshold, which should work since there’s no noise. For sigma = .5, 1, 1.5, 2, 2.5, 3, … 25 determine the location of the edges in image I (from part 2c). Plot them in a 2D picture, where each row shows the edges detected for a different sigma. Turn in the plot.

e) 20 points Form and turn in the same plot, this time adding Gaussian noise to the image with a standard deviation of 1 (see function randn ).

  1. 10 points Download two images from the internet, or take two images yourself if you have a digital camera. The first image should be one you think will be easy to find edges in, the second image should be one that seems hard. Choose a black and white image, or convert it with rgb2gray. For each image: Run the canny edge detectors, with the default parameters: edge(I,'canny',[.02,.1],1). Then play with the parameters until you get the best results you can. On this final, best, version, circle and label two places where you think the edge detector made a mistake, if it did. Explain why you think it got the wrong answer.

For each image, turn in the image, the edges found using default parameters, and edges with the best hand-chosen parameters with points labeled. List the parameters you used. Also turn in your explanation for why any failures occurred.

  1. 20 points Challenge problem (this is optional for extra credit): Consider a 1D box kernel of width 2m, and height 1. Call this kernel, k. k must lie entirely in the interval 0 to 2pi, so assume m<pi Write k as a linear combination of the basis elements:

, sin 2

sin 2 , cos 2

cos 2 , sin

sin , cos

cos

θ

θ

θ

θ

θ

θ

θ

θ

Hint: you are free to place k anywhere in the interval 0 to 2pi. Put it somewhere that will make your life easier.