
CAP5415 Computer Vision
Programming Assignment # 1
1. Write a function Convolution(Image I, Kernel H) that has arguments
a. Image I (Images may be of varying sizes and you may want to give the
size as arguments. If you are using MATLAB, you can compute size
within the function)
b. Kernel H (Again, you should allow varying size Kernels)
The output of function should be the convolution of I with H. Test your function
and show results on the following Kernels.
i. Averaging Kernel ( 33
and 55
)
ii. Gaussian Kernel ( 3,2,1
) Use )13()13(
as size of
Kernel (You may want to write a separate function to generate
Gaussian Kernels for different values of
)
iii. Roberts Edge Operators: ๎
๎
๎
๎
๎
๎
โ
โ
11
11 and ๎
๎
๎
๎
๎
๎
โ
โ
11
11
iv. Sobel Edge Operators
๎
๎
๎
๎
๎
๎
๎
๎
๎
๎โโโ
121
000
121
and
๎
๎
๎
๎
๎
๎
๎
๎
๎
๎
โ
โ
โ
101
202
101
v. Prewitt Edge Operators
๎
๎
๎
๎
๎
๎
๎
๎
๎
๎
โ
โโ
โ
111
121
111
and
๎
๎
๎
๎
๎
๎
๎
๎
๎
๎
โโ
โโ
111
121
111
2. Write a function Reduce(Image I) that has an image as an input and the output
should be re-sampled copy of half the width and height of the input image. Use
the two 1D gaussian kernels as discussed in class.
3. Write a function Expand(Image I) that has an image as an input and the output is
the expanded copy of input image, twice the width and height of original image.
4. Use the Reduce function in (2) to write a function GaussianPyramids(Image I,
Levels n) that produces n levels of gaussian pyramid for image I.
5. Use the above functions to write a function LaplacianPyramids(Image I, Levels n)
that produces n levels of Laplacian pyramid of image I.