C++ #2

For this assignment you will be adding to your image processing code from before. You will be adding another image processing technique, blurring, and create a texture mapped scene.

I have uploaded a new main.cpp file for you that loads in your image-processed texture and texture maps three triangles.  The code loads an image and blurs it with a GAUSSIAN filter with r=10. Your code must be able to use the same function calls, that is, do not change the function parameters or return types.

Part 1: Image processing

Add a new image processing technique to your previous image processing code, blurring.

Step 1: Create a Filter class (Filter.cpp and Filter.h) that creates a 1D filter. Your constructor will take two integer parameters, filter_type and filter_r.

  • filter_type – Specifies the filter type to be created, either BOX, TENT, or GAUSSIAN. You should use enum{BOX, TENT, GAUSSIAN}; See enum documentation.
  • filter_r – Specifies the width of the filter such that the total width is 2*r+1.

Your Filter class will then make a 1D BOX, TENT, or GAUSSIAN filter of the specified width. Make sure your filter is normalized.

Step 2:

In Image.cpp, add the function blur that takes a Filter* as a parameter and blurs (using 2D convolution) the image with the given filter, and returns the image. Make sure your code is efficient. You may find it helpful to add additional methods to ImageIO.  Your blur function definition looks like this:

ImageIO* ImageIO::blur(Filter* f)

Part 2: Texture Mapping

Create a texture mapped scene. Your scene must use at least three different textures and three different shapes.  At least one of those textures must be blurred.

Questions

1. Give the running times (Big-Oh) of blurring an n x n image with an m x m separable filter and an m x m non-separable filter.

2. Describe, using pseudo-code and words, how to shrink an image.

3. Define aliasing and give two examples.

4. Explain in detail (give me equations) of how to texture map a sphere.

Submit

Submit all of your code (main.cpp. Filter.h, Filter.cpp, ImageIO.h, ImageIO.cpp) your writeup named netID.pdf, and a screen shot of your scene into a dropbox folder named c++_2.

Grading

Code (24 points: Part 1, each step x 2 and Part 2 x 2)

Questions (8 points)

4 (A) Completes all criteria, is creative, shows extensive effort, clean code
3 (B) Completes all criteria, shows basic effort
2 (C) Mostly there, but missing something
1 (D) You handed something in