
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
ZxAx
e
A
dxe
22
1
2
2
2
with A>0.)
2) 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), .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).
3) 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