Analysis of Algorithms: Project 1
Deadline: February 9
The purpose of the first project is to help you learn basic operations
on PGM images. The task is to implement a program that inputs the name
of a PGM file, loads it from the disk, and then computes the minimal,
maximal, and average pixel value for this file. After the program completes
the computation, it must explicitly free the memory taken by the image.
Note
that you need to use some of the basic functions
for loading images into memory. The output of your program should look
as follows:
minimum |
= |
15 |
|
(darkest pixel) |
maximum |
= |
240 |
|
(lightest pixel) |
average |
= |
67 |
|
(mean of pixels) |
Download the following four images and use them to test your program.
To download an image, point the mouse, click the right button, and
then select "Save Link As" or "Save Target As" in the resulting
menu.
space.pgm |
Spiral and elliptical galaxies by the Hubble Telescope. |
blocks.pgm |
Wooden blocks on a dark background. |
stlouis.pgm |
Picture of St. Louis by a spaceborne imaging radar. |
mgram.pgm |
Reduced-resolution copy of a mammogram. |
Answer the following questions in your report:
-
What is the minimum, maximum, and average pixel value for each image?
-
How long does your program run on each of the images?
-
What is the dependency of its running time on the image size?
-
What takes longer: loading the image or computing the required values?
Back to the Projects page