Yes, it’s a balancing act. The smoothness constraint wants to minimize curvature, and a larger circle has a lower curvature than a smaller circle. You can add a balloon force (there’s a link to the paper towards the bottom of the blog post) to counteract that tendency, but if you initialize your snake close enough to the edges this should not be necessary.

]]>Very helpful tutorial!! I wrote my own program in C++ based on Kass’ paper, but my results are quite surprising.

The tricky task is the tuning of the weights alpha, beta, gamma. Imagine we do not consider the image energy at first time, only continuity and smoothness. Is the circle supposed to keep the same shape and size throughout the iterations? Mine is growing endlessly…

Is there a way to ensure a stable internal force?

Thank you very much, ]]>

I’m glad this was useful to you. I have never heard of ribbon snakes before. I suggest you read whatever paper that proposes it a few more times, understanding new work is not always trivial. And if you get really stuck, contact its authors; they might be willing to share their code.

]]>You really make it very easy to understand.I am trying to extracting roads using ribbon snake. However I can’t reduplicate the code for ribbon snake. Can you write annother blog about ribbon snake? Thank you very much. ]]>

Honestly, I don’t remember why this difference, or who’s definition I was following when I wrote this post. But given that γ is a constant, you can set γ_{mine} = -1/γ_{theirs}, and get the same equation back.

I highly recommend that you write out the derivation for yourself, you’ll learn a lot from it, and you might discover typos in Kass’ paper or in my blog post. ðŸ™‚

]]>You’ve got: AXt + fx = (Xtâ€“Xt-1) / Î³.

But in the original paper in equation (17)

They’ve got: AXt + fx= -Î³(Xtâ€“Xt-1).

Could you please clarify me why the original paper have minus for the gamma value?

The matrix elements come from the two equations that are written just above it. The matrix elements at (0,0), (1,1), … (i,i) (i.e. the main diagonal) correspond to the component of the equation that multiplies *x*(*i*). The diagonals one to the right and left of the main diagonal correspond to the *x*(*i*+1) and *x*(*i*-1) components, etc.

I am trying to understand how you computed the matrix A whose values are represented in the combinations of Î± and Î². For instance, how did you arrive at the A[0,0] value -2Î±-6Î²? I would highly appreciate your help. Thank you for your time!

]]>Those are the top-right and bottom-left corners of the matrix A. They represent the effect of points on the start of the snake on those at the end, and vice versa. If you leave these six values out, then the snake is not circular, it’s a cord with two loose ends.

]]>Have a question regarding matrix A:

Can you please explain why do you add these terms to your diagonals:

diag( b, -N+1);

diag( b, N-1);

diag([c,c],-N+2);

diag([c,c], N-2); ]]>