1 function B=SnakeInternalForceMatrix2D(nPoints,alpha,beta,gamma)
\r
3 % B=SnakeInternalForceMatrix2D(nPoints,alpha,beta,gamma)
\r
6 % nPoints : The number of snake contour points
\r
7 % alpha : membrame energy (first order)
\r
8 % beta : thin plate energy (second order)
\r
9 % gamma : Step Size (Time)
\r
12 % B : The Snake Smoothness regulation matrix
\r
14 % Function is written by D.Kroon University of Twente (July 2010)
\r
16 % Penta diagonal matrix, one row:
\r
18 b(2)=-(alpha + 4*beta);
\r
19 b(3)=(2*alpha + 6 *beta);
\r
23 % Make the penta matrix (for every contour point)
\r
24 A=b(1)*circshift(eye(nPoints),2);
\r
25 A=A+b(2)*circshift(eye(nPoints),1);
\r
26 A=A+b(3)*circshift(eye(nPoints),0);
\r
27 A=A+b(4)*circshift(eye(nPoints),-1);
\r
28 A=A+b(5)*circshift(eye(nPoints),-2);
\r
30 % Calculate the inverse
\r
31 B=inv(A + gamma.* eye(nPoints));
\r