Things are more complicated in discretized form. Say a line when discretized is not actually a line, Right(remembering the bresenham line algorithm ) ? Same thing goes to circle or any shapes. So for computing the associated properties we need more techniques. Implicit surface helps us to compute such properties.
Before I explain about implicit surfaces, you tell be what is the gradient of a scalar surface/curve.
Say you define a 3D surface by the equation x*x + y*y + z*z = 9, we can easily see that this surface is nothing but a sphere with radius 3. Right ?
So Q(x,y,z) = x*x + y*y + z*z - 9 = 0.
What is the gradient of Q then ? it represents the normal at any point on this surface , and it is (2x,2y,2z) (not normalized).
Why i said this was to show you how easy it is compute the gradient of a surface with an explicit equation. We can also easily compute other properties related with that surface like tangent,curvature,etc.
But what can you do if you don't have such explicit equations. In practical things will be like this.
In Implicit form we can define a shape implicitly. Our shape must be closed and non-self intersecting. With this agreement we can define the shape with following definitions.
Let P ( { Xi,Yi } ) be our point set which denotes the boundaries of our shape. We can define shape implicitly based on the following conditions.
1. For all points in shape boundaries ∅ (Pi) = 0
2. For all other points outside the shape ∅(Pi) must be > 0
3. For all other points inside the shape ∅(Pi) must be < 0 . (Conditions 2,3 can be interchanged though)
Based on the earlier definitions consider the above picture. Pixel's with green boundary is our shape where ∅(Pi) will be 0. pixels having red color will have negative value, and rest of the pixels (blue) will have positive value. This is how we define implicit functions for complicated shapes. In the next post I will show you how we can numerically compute the properties of these shapes from this definitions also will introduce about level sets. It is not a big deal( Actually i had intention to write more about this, but I lost my mood so stopping now )
Showing posts with label curve parameterization. Show all posts
Showing posts with label curve parameterization. Show all posts
Sunday, July 14, 2013
Wednesday, May 22, 2013
Simple 2 Dimensional Curve Matching
In my previous post I have explained about curvature in depth. Now to the practical side, I created a simple application which will use these curvature to compare two simple planar curves. In the following video you can see two feature vectors indicates the similarity of curves;
See the video here.
The angle difference between the feature vectors indicates how similar those shapes are.In the video, you can also see that this matching is invariant to rotation and scale(when shape gets bigger, curvature will becomes lower). Right now the algorithm I used for computing the curvature 'Feature vector' is based on centroid. It needs to be refined further,But the underlying theory is very solid.Also the first impression giving me a very good hope on the concept.
However I am stopping my work on this concept, I don't have time to refine it. Next my target is 'level set methods' or solving the thin plate spline equation. The second one is duper super hard to fully understand , I already attempted it and lost my mind and motivation.Whenever I take it , suddenly everything becomes complicated, even my life (incidents!). So it is like the book of Amun-ra But after looking it, I knew that i need to improve my 'calculus of variation' skills , and that topic is very nice.The same thing which helps to solve missile guidance problems!.
See the video here.
The angle difference between the feature vectors indicates how similar those shapes are.In the video, you can also see that this matching is invariant to rotation and scale(when shape gets bigger, curvature will becomes lower). Right now the algorithm I used for computing the curvature 'Feature vector' is based on centroid. It needs to be refined further,But the underlying theory is very solid.Also the first impression giving me a very good hope on the concept.
Sunday, August 12, 2012
Bending Energy & Parameterization of Curve over length
What is bending Energy ? The precise definition is "it is the sum of squares of curvature of the curve function parameterized over curve length". Bending energy gives the energy stored in the curve. We know any bented objects will store some energy. Bending energy formulation helps to find a value proportional to the energy stored in the curve. For a straight line bending energy is Zero.
Before look into it we need to understand how we can parametrize curve over length
The tricky part is how we can parameterize over curve length.
Consider a vector valued function F(t) = < X(t),Y(t),Z(t) > , t is the parameter , ranges between some values.
F'(t) can be found easily by applying partial differentiation on F with respect to 't' .
Lets now find the length (length function) of this curve
it has been shown by Kennedy, John (2011) in his paper, how to derive expression for F'(s)
Differentiating this with respect to s , we will get
1 = || F'(s) || (of-course s is based on t)
That means after changing the parameter from t to s(length param) the length of F'(s) is getting 1. It is very interesting concept, that means on moving through function F(S) we are moving exactly by unit length. If you imagine this it seems true. Because no matter where the curve is going its length get incremented in equal length.
So how we can find the equation for F'(s) ? Intuitively we can think like this. Anyway F(s) and F(t) represents same curve , only different is magnitude of F'(s) is 1 , But F'(t) may not be 1. But both these vectors points to the same direction. right ? so we(I)can conclude like this
F'(s) = F'(t) / || F'(t) ||
Other-way is like this.
Now Differentiating both sides with respect to t.
ds/dt = || F'(t) ||
If we differentiate function F(t) with respect to s (length) we get
= F'(t) * dt/ds (chain rule of differentiation)
= F'(t) / (ds/dt)
= F'(t) / || F'(t) || ( we know ds/dt = || F'(t) || )
that is dF(t)/ds = F'(t) / || F'(t) which is eqult to F'(s). This is fantastic. :)
Now Next step is finding F''(s) , I will explain that in next post. It is time to sleep.
Nowadays days I am getting more into mathematics than software engineering. To really understand things you need to have great patience and curiosity. After all these years , I am still a novice.
Subscribe to:
Posts (Atom)
