Code covered by the BSD License  

Highlights from
Snake : Active Contour

image thumbnail

Snake : Active Contour


Dirk-Jan Kroon


08 Jul 2010 (Updated )

Snake Segmentation (Kass et al), 2D/3D including GVF and balloon force (Easy to read code)

function P=MakeContourClockwise2D(P)
% This function MakeContourClockwise will make a contour clockwise 
% contour clockwise. This is done by calculating the area inside the 
% contour, if it is positive we change the contour orientation.
%  P=MakeContourClockwise2D(P);
% Function is written by D.Kroon University of Twente (July 2010)

% Area inside contour
area = 0.5*sum((O((1:size(P,1))+1,1) .* (O((1:size(P,1))+2,2) - O((1:size(P,1)),2))));

% If the area inside  the contour is positive, change from counter-clockwise to 
% clockwise
if(area>0), P=P(end:-1:1,:); end

Contact us