;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; 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")



#? *** thresholds

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

;; #? * (dummy_thresholds)
;; #? * (cvthreshold <src> <dst> <thresh> <maxvalue> <type>)
;; #? * (cvadaptivethreshold <src> <dst> <maxvalue> <method> <type> <parameters>)

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

;;  /****************************************************************************************\
;;  *                                      Thresholds                                        *
;;  \****************************************************************************************/

#? (cvThreshold  <src> <dst> <thresh> <maxvalue> <type>)
;;.VP
;;  /*F///////////////////////////////////////////////////////////////////////////////////////
;;  //    Name:    cvThreshold
;;  //    Purpose: Applies fixed threshold to the grayscale image
;;  //    Context:
;;  //    Parameters:
;;  //      src     - source image
;;  //      dst     - destination image (can be the same as the source image)
;;  //      threshold - threshold value
;;  //      maxValue  - the maximum value of the image pixel
;;  //      type      - thresholding type, must be one of
;;  //                  CV_THRESH_BINARY       - val =(val > Thresh ? maxValue : 0)
;;  //                  CV_THRESH_BINARY_INV   - val =(val > Thresh ? 0   : maxValue)
;;  //                  CV_THRESH_TOZERO       - val =(val > Thresh ? val : 0)
;;  //                  CV_THRESH_TOZERO_INV   - val =(val > Thresh ? 0   : val)
;;  //    Returns:
;;  //    Notes:
;;  //F*/
;;  OPENCVAPI  void  cvThreshold( const CvArr*  src, CvArr*  dst,
;;                                double  thresh,  double  maxValue,
;;                                CvThreshType type );

(de cvThreshold( src dst thresh maxvalue type)
    ((-gptr- "const CvArr *") src)
    ((-gptr- "CvArr *") dst)
    ((-double-) thresh maxvalue)
    ((-int-) type)
    #{ cvThreshold($src, $dst, $thresh, $maxvalue, $type); #}
    ())

#? (cvAdaptiveThreshold  <src> <dst> <max-value> <method> <type> <block-size> <param1>)
;;.VP
;;  /*F///////////////////////////////////////////////////////////////////////////////////////
;;  //    Name:    cvAdaptiveThreshold
;;  //    Purpose: Applies adaptive threshold to the grayscale image
;;  //    Context:
;;  //    Parameters:
;;  //      src     - source image
;;  //      dst     - destination image
;;  //      max_value - the maximum value of the image pixel
;;  //      method    - method for the adaptive threshold calculation
;;                     (now CV_STDDEF_ADAPTIVE_THRESH only)
;;  //      type      - thresholding type, must be one of
;;  //                  CV_THRESH_BINARY       - val =(val > Thresh ? MAX    : 0)
;;  //                  CV_THRESH_BINARY_INV   - val =(val > Thresh ? 0      : MAX)
;;  //                  CV_THRESH_TOZERO       - val =(val > Thresh ? val    : 0)
;;  //                  CV_THRESH_TOZERO_INV   - val =(val > Thresh ? 0      : val)
;;  //      param1   - The method-dependent parameter. For the methods 
;;  //                 CV_ADAPTIVE_THRESH_MEAN_C and CV_ADAPTIVE_THRESH_GAUSSIAN_C 
;;  //                 it is a constant subtracted from mean or weighted mean (see
;;  //                 the discussion), though it may be negative.
;;  //    Returns:
;;  //    Notes:
;;  //F*/
;;  OPENCVAPI  void  cvAdaptiveThreshold( const CvArr* src, CvArr* dst, double maxValue,
;;                                        CvAdaptiveThreshMethod method, CvThreshType type,
;;                                        int block_size, double param1);

(de cvAdaptiveThreshold( src dst max-value method type block-size param1)
    ((-gptr- "const CvArr *") src)
    ((-gptr- "CvArr *") dst)
    ((-double-) max-value param1)
    ((-int-) method type block-size)
    #{ cvAdaptiveThreshold($src, $dst, $max_value, $method, $type, $block_size, $param1); #}
    ())
;; ********************************************************

(dhc-make ()
  dummy_thresholds
  cvthreshold
  cvadaptivethreshold
)
