Assignment 1: projection profiles
Note: the content of this page might change slightly; be sure to refresh (F5) right before you start.
Goal
The goal of this assignment is to make a program that draws the horizontal and vertical projection profile on an image.
Projection profiles (also called projection histograms) are a common technique to determine where in the image the objects are. They are created by summing the number of dark pixels in every row (horizontal projection profile) or in every column (vertical projection profile).
Assignment
- Make a Python program that reads a .ppm image, draws its horizontal and vertical projection profile onto the image and writes the result as another .ppm image. It should be called like this:
python draw-projection.py input.ppm output.ppm
.
It should read input.ppm and write output.ppm.
- Make sure that the C++ part of your code compiles with the command 'make'. This is required.
- Submit your program using Nestor's Digital Dropbox.
Hints
- Look at examples of visualised projection profiles: Figure 2 and 6 in
this publication and Figure 4 in this one.
- Copy the quickstart files:
cp -r /home/student/hwr/assignment1 ~/hwr/
Note: the files are described in the Appendix below.
- For your convenience, the files include a piece of C++ code named drawlib; you can use it to draw lines. Notice the ampersand ('&') in its function calls; if you have a C++ pointer to a PamImage object then you need to dereference it at the call by adding an asterisk ('*').
Grading
- The result will be visually checked. The submission is acceptable if good projection profiles are shown in the output file.
Appendix: Description of files in assignment1/
File | Description |
drawlib.cpp | Draw lines in p*m images. (you do not need to view this file). |
drawlib.h | Header for drawlib.cpp; check here what you can do with drawlib. |
drawlib.i | Interface between C++ and Python for drawlib. |
Makefile | Instructions for 'make' to compile the code. |
pamImage.cpp@ | Link to file in toolbox/ |
pamImage.h@ | Link to file in toolbox/ |
pamImage.i@ | Link to file in toolbox/ |
Last modified: 20 April 2010, by Jean-Paul van Oosten.