 |
|
|
THEORY: |
Greedy Algorithm (pg.3)
Snake Function
- Input: Image
- Define the initial snake
- Minimize the energy functional uses the Greedy algorithm
Algorithm:
while(IterNumber < MaxIterNumber) AND (MovingNumber>MaxMovingNumber)
MovingNumber = 0
increment IterNumber
for I <- 0 to n
Emin = BIG
for j <- 0 to m-1
Ej <- αi Econt,j + βi Ecurv,j + γi Eimage,j
if Ej < Emin then
Emin <- Ej
jmin <- j
Move vi to location jmin
if jmin not current location then
increment MovingNumber.
Recalculate energy at each vertex.
void SnakeImage( IplImage* image, CvPoint* points, int length, float* alpha, float* beta, float* gamma, Size win, TermCriteria criteria, int calcGradient=1 );
image Pointer to the source image.
Points Points of the contour.
Length Number of points in the contour.
alpha Weight of continuity energy.
beta Weight of curvature energy.
gamma Weight of image energy.
win Size of neighborhood of every point used to search the minimum;
criteria Termination criteria: MaxIterNumber and MaxMovingNumber
calcGradient Gradient flag. If not 0, the function counts source image gradient
magnitude as external energy, otherwise the image intensity is
considered.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|