;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; LUSH Lisp Universal Shell
;;;   Copyright (C) 2002 Leon Bottou, Yann Le Cun, AT&T Corp, NECI.
;;; Includes parts of TL3:
;;;   Copyright (C) 1987-1999 Leon Bottou and Neuristique.
;;; Includes selected parts of SN3.2:
;;;   Copyright (C) 1991-2001 AT&T Corp.
;;;
;;; Includes information derived from the GSL (Gnu Scientific Library)
;;;   header files which are copyrighted and distributed under the GPL
;;;   by their respective authors.
;;;
;;; This program is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 2 of the License, or
;;; (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(libload "opencv/cv-config")



#? *** snake

;; dummy function that adds OpenCV C header files in C file
(eval `(de dummy_snake () ,cv-cpheader-cmd ()))

;; #? * (dummy_snake)
;; #? * (cvsnakeimage <src> <points> <length> <alpha> <beta> <gamma> <coeffusage> <win> <criteria> <calcgradient>)

;; ********************************************************

;;  /****************************************************************************************\
;;  *                                  Active contours                                       *
;;  \****************************************************************************************/

#? (cvSnakeImage  <src> <points> <length> <alpha> <beta> <gamma> <coeffusage> <win> <criteria> <calcgradient>)
;;.VP
;;  /*F///////////////////////////////////////////////////////////////////////////////////////
;;  //    Name:       cvSnakeImage
;;  //    Purpose:    Updates active contour in order to minimize its cummulative (internal
;;  //                and external) energy.
;;  //    Context:
;;  //    Parameters:
;;  //      src - source image that represent external energy.
;;  //      points - array of points in the snake.
;;  //      length - number of points
;;  //      alpha, beta, gamma - weights of different energy components
;;  //      coeffUsage - if it is CV_ARRAY then previous three parameters are array of 
;;  //                   <length> elements, otherwise each of them is a pointer to
;;  //                   scalar values.
;;  //      win - half-size of search window. 
;;  //      criteria - termination criteria.
;;  //      calcGradient - if not 0, the function uses magnitude of the source image gradient
;;  //                     as external energy, otherwise the source image pixel values
;;  //                     are just used for this purpose.  
;;  //    Returns:
;;  //    Notes:
;;  //F*/
;;  OPENCVAPI  void  cvSnakeImage( IplImage* src, CvPoint* points,
;;                              int  length, float* alpha,
;;                              float* beta, float* gamma,
;;                              CvCoeffType coeffUsage, CvSize  win,
;;                              CvTermCriteria criteria, int calcGradient CV_DEFAULT(1));
(de cvSnakeImage (src points length alpha beta gamma coeffusage win criteria calcgradient)
    ((-gptr- "IplImage *") src)
    ((-gptr- "CvPoint *") points)
    ((-int-) length calcgradient)
    ((-gptr- "float *") alpha beta gamma)
    ((-int-) coeffusage)
    ((-gptr- "CvSize *") win)
    ((-gptr- "CvTermCriteria *") criteria)
    #{ cvSnakeImage($src, $points, $length, $alpha, $beta, $gamma, $coeffusage, *$win, *$criteria, $calcgradient); #}
    ())
;; ********************************************************

(dhc-make ()
  dummy_snake
  cvsnakeimage
)
