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:
- image1.pgm,
an 8 pixel by 8 pixel image of a pattern.
- widget.pgm,
a 12 pixel (rows) by 15 pixel (columns) image of a pattern.
- fig1.pgm,
a 128 pixel (rows) by 97 pixel (columns) image of a camera tripod.
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".
- Type "xv &" on the command line, this loads "XV by John Bradley"
- Right click on this XV image. This should bring up the menu "xv
controls"
- Load "fig1.pgm". This is a 128 pixels (rows) by 97 pixels (cols) image of a camera
tripod (black and white)
- 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
- 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
- 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.
- Next, write a version to shift the image to the left.
- Save each transformed image and display on your website portfolio
- Describe your algorithm - how did you shift the image?
- Use MPI_Wtime() to analyze the efficiency of using various numbers of
processes.