Updates snake in order to minimize its total energy that is a sum of internal energy that depends on contour shape (the smoother contour is, the smaller internal energy is) and external energy that depends on the energy field and reaches minimum at the local energy extremums that correspond to the image edges in case of image gradient.

C# | Visual Basic | Visual C++ |
public static void cvSnakeImage( IntPtr image, IntPtr points, int length, float[] alpha, float[] beta, float[] gamma, int coeffUsage, MCvSize win, MCvTermCriteria criteria, int calcGradient )

- image (IntPtr)
- The source image or external energy field
- points (IntPtr)
- Seq points (snake).
- length (Int32)
- Number of points in the contour
- alpha (array< Single >[]()[])
- Weight[s] of continuity energy, single float or array of length floats, one per each contour point
- beta (array< Single >[]()[])
- Weight[s] of curvature energy, similar to alpha
- gamma (array< Single >[]()[])
- Weight[s] of image energy, similar to alpha
- coeffUsage (Int32)
- Variant of usage of the previous three parameters: CV_VALUE indicates that each of alpha, beta, gamma is a pointer to a single value to be used for all points; CV_ARRAY indicates that each of alpha, beta, gamma is a pointer to an array of coefficients different for all the points of the snake. All the arrays must have the size equal to the contour size.
- win (MCvSize)
- Size of neighborhood of every point used to search the minimum, both win.width and win.height must be odd
- criteria (MCvTermCriteria)
- Termination criteria
- calcGradient (Int32)
- Gradient flag. If != 0, the function calculates gradient magnitude for every image pixel and consideres it as the energy field, otherwise the input image itself is considered