$25
Exercise 1 Gaussian Image Pyramid
Write a new class ImagePyr in a file named as image pyr.cc that represents a Gaussian Pyramid with the following properties:
a. It should have the following private fields:
• an integer m n levels storing number of pyramid levels (octaves).
• an Image pointer m levels storing pyramid levels in an array of Images.
b. The constructor must take the desired number of levels, a pointer tothe base image to create the pyramid levels for and the initial sigma, sigma0, for the base image.
c. The destructor must deallocate all memory allocated by the construc-tor.
d. A getter for the number of levels.
e. A getter for the ith level image.
f. Level 0 is a copy of the base image given in the constructor (do notjust copy the pointer, create a new image that is a copy of the base image).
g. Level i is created by first Gaussian smoothing the image at level i−1 so that its scale (sigma value) is doubled. And then it is downsampled by two in x and y dimensions so that its width and height are the half of the width and height of the image at level i − 1 (Downsample by throwing out every other row and column of the smoothed image).
1
Exercise 2 Gaussian Image Pyramid Tester
Write the code for a new executable image-pyr-test in a file named as image pyr test.cc that reads an image from a file given as the first command line argument and creates an image pyramid with number of levels equal to the number given as the second command line argument. It should than save each pyramid level in files named as “/tmp/pyr level i.png” where i is the level number. The test program should display a usage message if there is a missing argument or it is given an argument with an invalid value. Modify CMakeLists.txt so that this test executable is compiled along with the existing executables in the project.