Starting from:
$30

$24

Digital Signal and Image Processing - Two-Dimensional Convolution Solution

Objectives




This programming assignment has three objectives:




Give you practice in using a program to perform digital signal processing.



Help to solidify your understanding of two-dimensional convolution.



Observe the e ects of three di erent kinds of image lters.



Instructions




The program should be written in C or C++.



Use the image.pgm le found on the Canvas website to test your program. You can learn about the



.pgm image format from a Google search. Remember that the pixels are 8-bit unsigned char values. You will need to truncate values greater than 255 to 255, and values less than zero to zero in the ltered images.




Write your output images in .pgm format.



Use zero padding to extend the input image for convolution.



Crop the output image back to the input image size.



Upload a short report and output images to the Canvas website. The report should include an in-troduction, a section describing your approach and ndings, and a conclusion. Please include your C/C++ code as an appendix.









Write a program that will read in the provided image, lter with an arbitrary-sized 2D lter, and write out the ltered image.



2. Filter the image with a lowpass lter given by the following:

1
22
4
6
4




1
2
3
2
H1 = 81
62
4
6
4




6










3
6
9
6








61
2
3
2




6










4









3

1

27

7

37 (1)

7

25

1
3. A common lter used for nding edges in an image is called a Sobel lter. The Sobel vertical and horizontal lter coe cients are de ned as two 3x3 matrices given by

3
1 0 1

S1 =
2
0
2
5
(2)


41
0
1


1for detecting vertical edges, and
3
1 2 1

S2 = 4
0
0
0


1
2
1 5
(3)
for detecting horizontal edges. The two lters are each convolved with the input image F giving


G1
= S1 F;


(4)
and
= S2 F:




G2


(5)
The absolute value of the resulting images are summed together to create the output image


M(m; n) = jG1(m; n)j + jG2(m; n)j:
(6)



Implement the Sobel lter using your program with appropriate modi cations.




Filter the image with the values in the le filter.pgm found on the Canvas site. Before you lter, subtract a scalar value from each value in the lter. The scalar is the minimum value in the lter. Scale the ltered image so that the maximum value in the image is 255, and all negative values after scaling are set to zero. (Scaling should be done before you write out the pixel values.)





















































































































2

More products