Image Processing Assignment
Assignment: Edge Detection - The horizontal and vertical edge detection techniques are demonstrated below.
Implement the Robert's cross and Sobel edge detection methods and compare with horizontal/vertical methods.
- Also, feel free to experiment with your own image processing algorithms
- Horizontal and vertical differencing work as follows: a pixel's new value becomes the
absolute value difference between itself and it's neighbor (either horizontal or vertical neighbor).
If the difference between the two pixel values is high, the pixel will be
brighter because it has a high value. If the difference is low, the pixel will be darker
because of the low value
- Robert's cross assigns the value to each pixel based upon the difference of it's four neighbors
- North, South, East, West
- Sobel's method assigns the value to each pixel based upon the difference of it's 8 neighbors
- North, South, East, West, NorthEast, SouthEast, SouthWest, NorthWest
- Which method do think shows the best results. Is a wider brighter edge detection result
necessarily better than a sharper, less bright result?
Explanation of "edge detection" algorithms: Horizontal/Vertical differencing, Robert's cross, Sobel's
Explanation of ascii file formats,
images.c, an example starter program for edge detection,
fig1.pgm camera tripod pgm b/w image
images.f90,
images.c (in process of being completed)
The algorithms above work with black and white images (gray scale)
and highlight the edges in the image.
This is a first step in identification of objects in an image
The techniques here are horizontal and vertical differencing, Roberts, and Sobel.
tripod.pgm
rotatetest3.pgm
generated by
rotateimage.f90
Horizontal and vertical edge detection examples by
edgedetect.f90:
horizedge.pgm
vertedge.pgm
Here's the beginning of tripod.pgm.
Brief explanation:
'P2' is the type of file - ascii greyscale.
# CREATOR... is a comment line
97 128 means there are 97 columns and 128 rows of pixels in the image
255 means that 255 is the highest pixel value (white) vs 0 (black)
Beginning of the file tripod.pgm:
P2
# CREATOR: The GIMP's PNM Filter Version 1.0
97 128
255
45
45
49
57
65
65
ISS-four.pgm (from the space station)
greyscale version for image processing:
brightened version by images.f90 (the program linked at the top of this page)
ISS-5.pgm (from the space station)
greyscale version for image processing:
Assignments:
- Experiment with brightening/darkening these images. If you're using the Cray,
you need to copy these files onto the Cray.
- Use a matrix transpose operation to flip the images.
- Try the edge detection algorithms on the link above.
You need to read in the "pgm" file, read in the number columns and rows of the figure.
Next, process through the matrix of pixel values for the image,
and change each pixel value based on the surrounding pixels
A pixel is turned brighter based on the rate of change of it and its neighbors.
A higher rate of change (this happens on an edge) is colored brighter
than a low rate of change (not an edge)
More image processing ideas.
After doing some serial (non-parallel) edge detections,
try to parallelize your code.