Lab05: Parallel Computer Vision Processing

Objective
To "parallelize" a C program that shifts an image a to the right or left a certain number of pixels.
download pgmReader.c, a C program that reads a "PGM" image file.

--Sample PGM image files:

Background material on PGM image files (these are uncompressed ASCII files
containing numbers representing pixel values):
Explanation of PGM and PPM image file format

  • Viewing an image file with "xv".
    1. Type "xv &" on the command line, this loads "XV by John Bradley"
    2. Right click on this XV image. This should bring up the menu "xv controls"
    3. Load "fig1.pgm". This is a 128 pixels (rows) by 97 pixels (cols) image of a camera tripod (black and white)
    4. Load "widget.pgm". This is a very small image, 12 pixels (rows) by 15 pixels (cols).
      In order to see the image, increase its size by dragging the corner with your mouse.

  • Assignment
    1. Become familiar with "pgmReader.c" and image files
      --Read an image file (a ".pgm" file) and write the pixel data to "newPic.pgm"
      --With vi, view newPic.pgm
    2. Modify pgmReader.c so that it reads the image file and shifts the image
      a certain number of pixels to the right.
      For example, shift the image of the tripod 25 pixels to the right.
    3. Next, write a version to shift the image to the left.
    4. Save each transformed image and display on your website portfolio
    5. Describe your algorithm - how did you shift the image?
    6. Use MPI_Wtime() to analyze the efficiency of using various numbers of processes.