Kate,

I’m not are what you mean. This is a finite difference approximation to the derivative. Additionally we approximate by assuming *h* doesn’t change, even though it does.

]]>Kate,

Yes, well spotted! Indeed, you would normally divide by *h*^{2} and *h*^{4} for the second and fourth derivative, assuming the distances between samples are all *h*. In reality, the distances between samples (the points that form the snake) are all different, so we should divide by whatever distances are really there. But computing these distances every iteration would make the method significantly more expensive, as the values in the matrix we invert would keep changing every iteration, meaning we would have to invert that (large!) matrix every iteration.

So to keep things simple, in the derivation of the snake it is assumed that these distances are all more or less the same. These factors *h* are then folded into the constants α and β. If the points move closer together or further apart, these two constants effectively change, meaning that the speed of the snake changes too. It is good to resample the snake every certain number of iterations to avoid the distance between points to deviate too much. This resampling also avoids other issues that happen when points get too close together, and prevents the snake from folding in on itself. I think I didn’t discuss the resampling in this post, but it is in the linked implementation.

Tristan,

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, ]]>

Hanting,

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. ]]>

Teera,

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?