April 16, 2019

Active Contours (SNAKES!)

Using QT I put together an interface to to demonstrate and interact with active contours (aka active deformable models, snakes.)

Active Contours (SNAKES!)

Recently I decided I wanted to create a project that allowed me to interact with QT / OpenCV to implement the edge detection algorithm Sobel. I just graduated and needed a project to take up some time while waiting for responses on job applications. Once I was able to make a video / camera / image display I implemented the algorithm fairly quickly (its not that complex.)

My adviser's research was in fractal based active contour models (snakes) so I decided to take a peak at what all of the fuss was about and found THIS PDF explaining basic snakes. I thought it would be best to introduce myself SLOWLY before jumping into what he was/is doing.

You can find the code on my Github.

Results / Demo

Main Window

From here, video, camera, or an image can be loaded to interact with a snake.


Launch parameters for the program. (Max points, α, β, γ, display, etc)

Snake Start

To initialize the snake, some points are selected by hand before hitting start.

Snake Result

The final result of the run. The red squares are the point's "neighborhood" as mentioned in the PDF link above.

The process of minimizing snake energy is shown frame-by-frame and can be seen here:

Last Words

This was a really interesting project that I may continue to play with. If you look in the code you'll see that there is some other nonsense I started to work with using a genetic algorithm to locate the best-fit snake as-well-as some code that does point-insertion based on intensity of angles found around the snake and a couple of different criteria.

It may be a while before I get back to this, as it was planned to just be a quick project that all-in-all took a couple of weeks (Making the QT interface, sobel, decision to implement, etc, etc.)