CS 112 Project 10: Parallel Processing with OpenMP


  1. Practice using OpenMP operations.
  2. Work on an open-ended problem.


This week's project is a single person project. The project is to implement other image processing operations and use parallel execution to speed them up.

The Problem

In this week's lab, we used parallel execution to speed up the operation of inverting the colors of an image. This week's project is quite open-ended: you are to implement two operations from the following table. You may pick any two, provided they are from different columns:

Column 1 Column 2 Column 3
black and white conversion sepia conversion lighten
flip horizontal edge detection darken
tint color flip vertical blur
grayscale conversion rotate sharpen
zoom in (crop) mirror (horizontal or vertical) change background
shrink (resize smaller) enlarge (resize bigger) make collage from groupOfImages
replace color1 with color2 emboss find/reduce redeye

Alternatively, you may invent and implement your own original image conversion operation for one of your two operations (e.g., an Andy Warhol effect).

For each of your operations, you are to:

  1. Implement a sequential algorithm for the operation.
  2. Time and record the performance of that sequential operation.
  3. "Parallelize" your sequential operation.
  4. Time and record the performance of your parallel operation, using 2, 4, 6, 8, 10, 12, 14, and 16 threads.
  5. Using a spreadsheet, make a chart like the one we made in this week's lab exercise, showing the relationship between the number of threads and your operation's execution time.
  6. Save a copy of the image file created by your operation.

You are to research sequential algorithms for your operations, implement your algorithms in C++, use TSGL to display the resulting images, and parallelize your algorithms using OpenMP. There are many online sources for such algorithms. For example, this book by Mark Guzdial and Barbara Ericson contains Java implementations of many of these algorithms, which should be fairly easy to convert to C++. Likewise, there are many tutorials available (e.g., here and here).

You should make each operation a method of class ImageConverter, using the invertImage() operation from this week's lab exercise as a model. In particular, your operation should read pixels from one image (i.e., the image pointed to by myCanvas1) and write transformed pixels to a different Canvas object, rather than transforming the pixels of the original Canvas. Also, be sure to incorporate into your operation a Timer object and sleep() calls, to slow the processing sufficiently for you to see each thread drawing its pixels.

You may find the API documentation for TSGL to be useful, as well as this page of OpenMP resources.


CS > 112 > Projects > 10

This page maintained by Joel Adams.