Description
In this project each student must implement the active contour algorithm. The program
must load a grayscale PPM image and a list of contour points. The contour points must
be processed through the active contour algorithm using the options given below. The
program must output a copy of the image with the initial contour drawn on top of it, and a
second image with the final contour drawn on top of it. The program must also output a
list of the final contour pixel coordinates.
The program does not need to have a graphical user interface. It can run entirely from a
command line, and find the file names as either command line arguments or via string
prompts to the user. In the output images, each contour point should be drawn using a
“+” shape that is 7×7 pixels with a grayscale value of 0 so they can be clearly seen.
The file containing the list of contour points is a text file, with column and row
coordinates separated by spaces, and each point ending with a carriage return. An
example is given at the course website.
The active contour should use 2 internal energy terms and 1 external energy term. The
internal energy terms are the square of the distances between points, and the square of the
deviation from the average distance between points. The former term is detailed in the
lecture notes. The latter term can be found by first calculating the average distance
between all contour points, and then taking the square of the difference between that
average and the distance between the current contour point and the next contour point. It
can be assumed that the contour encloses an area, so that the last contour point can be
connected to the first contour point to calculate internal energy terms. The external
energy term is the square of the image gradient magnitude, and should be calculated
using convolution with a Sobel template.
The window around each contour point should be 7×7 pixels. Each energy term should
be normalized by rescaling from min-max value to 0-1. Each energy term should be
weighted equally. The active contour algorithm should run for 30 iterations.
You must write a brief report that includes the code. The report should show your result
for the Sobel edge gradient magnitude image. The program must be tested on the image
hawk.ppm and hawk_init.txt files at the course website. The image with the intial
contour should be displayed, along with the image with the final contour for comparison.
The image coordinates of the final contour should be provided in a list or table.
Submit your C-code (as an attachment) and report (as an attachment) to
ece_assign@clemson.edu. Use as subject header ECE4310-1,#5 or ECE6310-1,#5. This
email is due by midnight of the due date.