Laboratory Exercise

The goal of Lab 1 is to refresh your memory of C++ and familiarize you with the image processing libraries that will be used throughout the course. If you haven't studied C++ yet, or it's been a long time, look at the C++ tutorial before continuing.

In this lab we will pixelate an image. Having read in the image we want to change each 4x4 block of the 512x512 image. Each 4x4 block should be set to the average of that 4x4 block. So for example, say the first 4x4 block of the image is:

100  20 150  80
250 200 100  90
 80  70  50 100
100  30  70  90

Then we would compute the average of this 4x4 block to be (100+20+...+95)/16=98.75 and set the entire 4x4 block to this value.

Code is provided to read an image and save it. You have to fill out the code to calculate the averages of the blocks and set the pixels to this value. If you haven't yet, read the introduction to the C++ image processing library to find out the syntax for how to do this.