CS9629 Homework Assignment #2

Livewire, Snakes, Distance Transforms

Overview

You should implement live-wire and snake-based segmentation tools for 2D photo or medical images. The first one requires implementation of Dijkstra algorithm on image contrast weighted graph. The snake tool should use Dynamic Programming (Viterbi) algorithm to compute each iteration of local snake optimization. You are given two starter Visual Studio projects for
"live-wire" and "snake" using the same C++ libraries as in HW1.

PART I (Live Wire) The programming for this part requires mostly changing code in function "compute_paths" (inside wire.cpp). Provided starter project has BFS traversal of the graph. Instead, you should implement Dijkstra. Weight edges using direct approach on slides 8-12 (topic 5) using Gaussian function "g(x)=const*exp(-x*x/(2*sigma*sigma))" where "sigma" is a sensitivity parameter. Your report should contain the following experiemnts:

PART II (Snake) The programming for this part requires mostly changing code in function "DP_move" (inside snake.cpp). Provided starter project makes random moves. Instead, you should implement Viterbi algorithm optimizing certain snake energies. You should experiment with different (pair-wise interaction) snakes as detailed below:

Use any real or synthetic images for your tests. Some sample images are posted at image samples section. In general, you should come up with specific examples for your report that illustrate different snake properties (strong or weak). In general, as future developers and/or researchers you should learn to identify srengths/weaknesses of different algorithms based on your conceptual/theoretical knowledge. Such analytical skills are essential for many jobs in high-tech industries or in academia.

Set up

The starter projects allow you to load (bmp) images, to enter clicks for live wire or snale initialization, to press keys/buttons calling your snake-moving methods, and to save your results as images. You should be primarily concerned only with files wire.cpp and snake.cpp where you can implementat all methods required to complete the tasks above. All functions in these files are called from main according to GUI functionality implemented in there. The provided GUI is in a "working" condition (compiles and runs). Livewire GUI is mainly designed to enter clicks and change some parameters. Main GUI features for the snake project are: left click = add snake nodes, right click = "close" the snake, key 's' = one iteration of DP-snake, key 'c' = run iterations until snake convergence (local minima is found), hit 'n'-key followed by a left (right) mouse click to add an attractive (repulsive) nudge.

What to submit and grading

Submit a .pdf file with your report (at most 2 pages of text, but any number of images). Use OWL to submit wire.cpp snake.cpp and any other project files where you changed some code. If you used special images, submit the corresponding image files.