github.com/kaydxh/golang@v0.0.131/pkg/gocv/cgo/third_path/opencv4/include/opencv2/imgproc/imgproc_c.h (about)

     1  /*M///////////////////////////////////////////////////////////////////////////////////////
     2  //
     3  //  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
     4  //
     5  //  By downloading, copying, installing or using the software you agree to this license.
     6  //  If you do not agree to this license, do not download, install,
     7  //  copy or use the software.
     8  //
     9  //
    10  //                           License Agreement
    11  //                For Open Source Computer Vision Library
    12  //
    13  // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
    14  // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
    15  // Third party copyrights are property of their respective owners.
    16  //
    17  // Redistribution and use in source and binary forms, with or without modification,
    18  // are permitted provided that the following conditions are met:
    19  //
    20  //   * Redistribution's of source code must retain the above copyright notice,
    21  //     this list of conditions and the following disclaimer.
    22  //
    23  //   * Redistribution's in binary form must reproduce the above copyright notice,
    24  //     this list of conditions and the following disclaimer in the documentation
    25  //     and/or other materials provided with the distribution.
    26  //
    27  //   * The name of the copyright holders may not be used to endorse or promote products
    28  //     derived from this software without specific prior written permission.
    29  //
    30  // This software is provided by the copyright holders and contributors "as is" and
    31  // any express or implied warranties, including, but not limited to, the implied
    32  // warranties of merchantability and fitness for a particular purpose are disclaimed.
    33  // In no event shall the Intel Corporation or contributors be liable for any direct,
    34  // indirect, incidental, special, exemplary, or consequential damages
    35  // (including, but not limited to, procurement of substitute goods or services;
    36  // loss of use, data, or profits; or business interruption) however caused
    37  // and on any theory of liability, whether in contract, strict liability,
    38  // or tort (including negligence or otherwise) arising in any way out of
    39  // the use of this software, even if advised of the possibility of such damage.
    40  //
    41  //M*/
    42  
    43  #ifndef OPENCV_IMGPROC_IMGPROC_C_H
    44  #define OPENCV_IMGPROC_IMGPROC_C_H
    45  
    46  #include "opencv2/imgproc/types_c.h"
    47  
    48  #ifdef __cplusplus
    49  extern "C" {
    50  #endif
    51  
    52  /** @addtogroup imgproc_c
    53  @{
    54  */
    55  
    56  /*********************** Background statistics accumulation *****************************/
    57  
    58  /** @brief Adds image to accumulator
    59  @see cv::accumulate
    60  */
    61  CVAPI(void)  cvAcc( const CvArr* image, CvArr* sum,
    62                     const CvArr* mask CV_DEFAULT(NULL) );
    63  
    64  /** @brief Adds squared image to accumulator
    65  @see cv::accumulateSquare
    66  */
    67  CVAPI(void)  cvSquareAcc( const CvArr* image, CvArr* sqsum,
    68                           const CvArr* mask CV_DEFAULT(NULL) );
    69  
    70  /** @brief Adds a product of two images to accumulator
    71  @see cv::accumulateProduct
    72  */
    73  CVAPI(void)  cvMultiplyAcc( const CvArr* image1, const CvArr* image2, CvArr* acc,
    74                             const CvArr* mask CV_DEFAULT(NULL) );
    75  
    76  /** @brief Adds image to accumulator with weights: acc = acc*(1-alpha) + image*alpha
    77  @see cv::accumulateWeighted
    78  */
    79  CVAPI(void)  cvRunningAvg( const CvArr* image, CvArr* acc, double alpha,
    80                            const CvArr* mask CV_DEFAULT(NULL) );
    81  
    82  /****************************************************************************************\
    83  *                                    Image Processing                                    *
    84  \****************************************************************************************/
    85  
    86  /** Copies source 2D array inside of the larger destination array and
    87     makes a border of the specified type (IPL_BORDER_*) around the copied area. */
    88  CVAPI(void) cvCopyMakeBorder( const CvArr* src, CvArr* dst, CvPoint offset,
    89                                int bordertype, CvScalar value CV_DEFAULT(cvScalarAll(0)));
    90  
    91  /** @brief Smooths the image in one of several ways.
    92  
    93  @param src The source image
    94  @param dst The destination image
    95  @param smoothtype Type of the smoothing, see SmoothMethod_c
    96  @param size1 The first parameter of the smoothing operation, the aperture width. Must be a
    97  positive odd number (1, 3, 5, ...)
    98  @param size2 The second parameter of the smoothing operation, the aperture height. Ignored by
    99  CV_MEDIAN and CV_BILATERAL methods. In the case of simple scaled/non-scaled and Gaussian blur if
   100  size2 is zero, it is set to size1. Otherwise it must be a positive odd number.
   101  @param sigma1 In the case of a Gaussian parameter this parameter may specify Gaussian \f$\sigma\f$
   102  (standard deviation). If it is zero, it is calculated from the kernel size:
   103  \f[\sigma  = 0.3 (n/2 - 1) + 0.8  \quad   \text{where}   \quad  n= \begin{array}{l l} \mbox{\texttt{size1} for horizontal kernel} \\ \mbox{\texttt{size2} for vertical kernel} \end{array}\f]
   104  Using standard sigma for small kernels ( \f$3\times 3\f$ to \f$7\times 7\f$ ) gives better speed. If
   105  sigma1 is not zero, while size1 and size2 are zeros, the kernel size is calculated from the
   106  sigma (to provide accurate enough operation).
   107  @param sigma2 additional parameter for bilateral filtering
   108  
   109  @see cv::GaussianBlur, cv::blur, cv::medianBlur, cv::bilateralFilter.
   110   */
   111  CVAPI(void) cvSmooth( const CvArr* src, CvArr* dst,
   112                        int smoothtype CV_DEFAULT(CV_GAUSSIAN),
   113                        int size1 CV_DEFAULT(3),
   114                        int size2 CV_DEFAULT(0),
   115                        double sigma1 CV_DEFAULT(0),
   116                        double sigma2 CV_DEFAULT(0));
   117  
   118  /** @brief Convolves an image with the kernel.
   119  
   120  @param src input image.
   121  @param dst output image of the same size and the same number of channels as src.
   122  @param kernel convolution kernel (or rather a correlation kernel), a single-channel floating point
   123  matrix; if you want to apply different kernels to different channels, split the image into
   124  separate color planes using split and process them individually.
   125  @param anchor anchor of the kernel that indicates the relative position of a filtered point within
   126  the kernel; the anchor should lie within the kernel; default value (-1,-1) means that the anchor
   127  is at the kernel center.
   128  
   129  @see cv::filter2D
   130   */
   131  CVAPI(void) cvFilter2D( const CvArr* src, CvArr* dst, const CvMat* kernel,
   132                          CvPoint anchor CV_DEFAULT(cvPoint(-1,-1)));
   133  
   134  /** @brief Finds integral image: SUM(X,Y) = sum(x<X,y<Y)I(x,y)
   135  @see cv::integral
   136  */
   137  CVAPI(void) cvIntegral( const CvArr* image, CvArr* sum,
   138                         CvArr* sqsum CV_DEFAULT(NULL),
   139                         CvArr* tilted_sum CV_DEFAULT(NULL));
   140  
   141  /** @brief Smoothes the input image with gaussian kernel and then down-samples it.
   142  
   143     dst_width = floor(src_width/2)[+1],
   144     dst_height = floor(src_height/2)[+1]
   145     @see cv::pyrDown
   146  */
   147  CVAPI(void)  cvPyrDown( const CvArr* src, CvArr* dst,
   148                          int filter CV_DEFAULT(CV_GAUSSIAN_5x5) );
   149  
   150  /** @brief Up-samples image and smoothes the result with gaussian kernel.
   151  
   152     dst_width = src_width*2,
   153     dst_height = src_height*2
   154     @see cv::pyrUp
   155  */
   156  CVAPI(void)  cvPyrUp( const CvArr* src, CvArr* dst,
   157                        int filter CV_DEFAULT(CV_GAUSSIAN_5x5) );
   158  
   159  /** @brief Builds pyramid for an image
   160  @see buildPyramid
   161  */
   162  CVAPI(CvMat**) cvCreatePyramid( const CvArr* img, int extra_layers, double rate,
   163                                  const CvSize* layer_sizes CV_DEFAULT(0),
   164                                  CvArr* bufarr CV_DEFAULT(0),
   165                                  int calc CV_DEFAULT(1),
   166                                  int filter CV_DEFAULT(CV_GAUSSIAN_5x5) );
   167  
   168  /** @brief Releases pyramid */
   169  CVAPI(void)  cvReleasePyramid( CvMat*** pyramid, int extra_layers );
   170  
   171  
   172  /** @brief Filters image using meanshift algorithm
   173  @see cv::pyrMeanShiftFiltering
   174  */
   175  CVAPI(void) cvPyrMeanShiftFiltering( const CvArr* src, CvArr* dst,
   176      double sp, double sr, int max_level CV_DEFAULT(1),
   177      CvTermCriteria termcrit CV_DEFAULT(cvTermCriteria(CV_TERMCRIT_ITER+CV_TERMCRIT_EPS,5,1)));
   178  
   179  /** @brief Segments image using seed "markers"
   180  @see cv::watershed
   181  */
   182  CVAPI(void) cvWatershed( const CvArr* image, CvArr* markers );
   183  
   184  /** @brief Calculates an image derivative using generalized Sobel
   185  
   186     (aperture_size = 1,3,5,7) or Scharr (aperture_size = -1) operator.
   187     Scharr can be used only for the first dx or dy derivative
   188  @see cv::Sobel
   189  */
   190  CVAPI(void) cvSobel( const CvArr* src, CvArr* dst,
   191                      int xorder, int yorder,
   192                      int aperture_size CV_DEFAULT(3));
   193  
   194  /** @brief Calculates the image Laplacian: (d2/dx + d2/dy)I
   195  @see cv::Laplacian
   196  */
   197  CVAPI(void) cvLaplace( const CvArr* src, CvArr* dst,
   198                        int aperture_size CV_DEFAULT(3) );
   199  
   200  /** @brief Converts input array pixels from one color space to another
   201  @see cv::cvtColor
   202  */
   203  CVAPI(void)  cvCvtColor( const CvArr* src, CvArr* dst, int code );
   204  
   205  
   206  /** @brief Resizes image (input array is resized to fit the destination array)
   207  @see cv::resize
   208  */
   209  CVAPI(void)  cvResize( const CvArr* src, CvArr* dst,
   210                         int interpolation CV_DEFAULT( CV_INTER_LINEAR ));
   211  
   212  /** @brief Warps image with affine transform
   213  @note ::cvGetQuadrangleSubPix is similar to ::cvWarpAffine, but the outliers are extrapolated using
   214  replication border mode.
   215  @see cv::warpAffine
   216  */
   217  CVAPI(void)  cvWarpAffine( const CvArr* src, CvArr* dst, const CvMat* map_matrix,
   218                             int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS),
   219                             CvScalar fillval CV_DEFAULT(cvScalarAll(0)) );
   220  
   221  /** @brief Computes affine transform matrix for mapping src[i] to dst[i] (i=0,1,2)
   222  @see cv::getAffineTransform
   223  */
   224  CVAPI(CvMat*) cvGetAffineTransform( const CvPoint2D32f * src,
   225                                      const CvPoint2D32f * dst,
   226                                      CvMat * map_matrix );
   227  
   228  /** @brief Computes rotation_matrix matrix
   229  @see cv::getRotationMatrix2D
   230  */
   231  CVAPI(CvMat*)  cv2DRotationMatrix( CvPoint2D32f center, double angle,
   232                                     double scale, CvMat* map_matrix );
   233  
   234  /** @brief Warps image with perspective (projective) transform
   235  @see cv::warpPerspective
   236  */
   237  CVAPI(void)  cvWarpPerspective( const CvArr* src, CvArr* dst, const CvMat* map_matrix,
   238                                  int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS),
   239                                  CvScalar fillval CV_DEFAULT(cvScalarAll(0)) );
   240  
   241  /** @brief Computes perspective transform matrix for mapping src[i] to dst[i] (i=0,1,2,3)
   242  @see cv::getPerspectiveTransform
   243  */
   244  CVAPI(CvMat*) cvGetPerspectiveTransform( const CvPoint2D32f* src,
   245                                           const CvPoint2D32f* dst,
   246                                           CvMat* map_matrix );
   247  
   248  /** @brief Performs generic geometric transformation using the specified coordinate maps
   249  @see cv::remap
   250  */
   251  CVAPI(void)  cvRemap( const CvArr* src, CvArr* dst,
   252                        const CvArr* mapx, const CvArr* mapy,
   253                        int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS),
   254                        CvScalar fillval CV_DEFAULT(cvScalarAll(0)) );
   255  
   256  /** @brief Converts mapx & mapy from floating-point to integer formats for cvRemap
   257  @see cv::convertMaps
   258  */
   259  CVAPI(void)  cvConvertMaps( const CvArr* mapx, const CvArr* mapy,
   260                              CvArr* mapxy, CvArr* mapalpha );
   261  
   262  /** @brief Performs forward or inverse log-polar image transform
   263  @see cv::warpPolar
   264  */
   265  CVAPI(void)  cvLogPolar( const CvArr* src, CvArr* dst,
   266                           CvPoint2D32f center, double M,
   267                           int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS));
   268  
   269  /** Performs forward or inverse linear-polar image transform
   270  @see cv::warpPolar
   271  */
   272  CVAPI(void)  cvLinearPolar( const CvArr* src, CvArr* dst,
   273                           CvPoint2D32f center, double maxRadius,
   274                           int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS));
   275  
   276  /** @brief Returns a structuring element of the specified size and shape for morphological operations.
   277  
   278  @note the created structuring element IplConvKernel\* element must be released in the end using
   279  `cvReleaseStructuringElement(&element)`.
   280  
   281  @param cols Width of the structuring element
   282  @param rows Height of the structuring element
   283  @param anchor_x x-coordinate of the anchor
   284  @param anchor_y y-coordinate of the anchor
   285  @param shape element shape that could be one of the cv::MorphShapes_c
   286  @param values integer array of cols*rows elements that specifies the custom shape of the
   287  structuring element, when shape=CV_SHAPE_CUSTOM.
   288  
   289  @see cv::getStructuringElement
   290   */
   291   CVAPI(IplConvKernel*)  cvCreateStructuringElementEx(
   292              int cols, int  rows, int  anchor_x, int  anchor_y,
   293              int shape, int* values CV_DEFAULT(NULL) );
   294  
   295  /** @brief releases structuring element
   296  @see cvCreateStructuringElementEx
   297  */
   298  CVAPI(void)  cvReleaseStructuringElement( IplConvKernel** element );
   299  
   300  /** @brief erodes input image (applies minimum filter) one or more times.
   301     If element pointer is NULL, 3x3 rectangular element is used
   302  @see cv::erode
   303  */
   304  CVAPI(void)  cvErode( const CvArr* src, CvArr* dst,
   305                        IplConvKernel* element CV_DEFAULT(NULL),
   306                        int iterations CV_DEFAULT(1) );
   307  
   308  /** @brief dilates input image (applies maximum filter) one or more times.
   309  
   310     If element pointer is NULL, 3x3 rectangular element is used
   311  @see cv::dilate
   312  */
   313  CVAPI(void)  cvDilate( const CvArr* src, CvArr* dst,
   314                         IplConvKernel* element CV_DEFAULT(NULL),
   315                         int iterations CV_DEFAULT(1) );
   316  
   317  /** @brief Performs complex morphological transformation
   318  @see cv::morphologyEx
   319  */
   320  CVAPI(void)  cvMorphologyEx( const CvArr* src, CvArr* dst,
   321                               CvArr* temp, IplConvKernel* element,
   322                               int operation, int iterations CV_DEFAULT(1) );
   323  
   324  /** @brief Calculates all spatial and central moments up to the 3rd order
   325  @see cv::moments
   326  */
   327  CVAPI(void) cvMoments( const CvArr* arr, CvMoments* moments, int binary CV_DEFAULT(0));
   328  
   329  /** @brief Retrieve spatial moments */
   330  CVAPI(double)  cvGetSpatialMoment( CvMoments* moments, int x_order, int y_order );
   331  /** @brief Retrieve central moments */
   332  CVAPI(double)  cvGetCentralMoment( CvMoments* moments, int x_order, int y_order );
   333  /** @brief Retrieve normalized central moments */
   334  CVAPI(double)  cvGetNormalizedCentralMoment( CvMoments* moments,
   335                                               int x_order, int y_order );
   336  
   337  /** @brief Calculates 7 Hu's invariants from precalculated spatial and central moments
   338  @see cv::HuMoments
   339  */
   340  CVAPI(void) cvGetHuMoments( CvMoments*  moments, CvHuMoments*  hu_moments );
   341  
   342  /*********************************** data sampling **************************************/
   343  
   344  /** @brief Fetches pixels that belong to the specified line segment and stores them to the buffer.
   345  
   346     Returns the number of retrieved points.
   347  @see cv::LineSegmentDetector
   348  */
   349  CVAPI(int)  cvSampleLine( const CvArr* image, CvPoint pt1, CvPoint pt2, void* buffer,
   350                            int connectivity CV_DEFAULT(8));
   351  
   352  /** @brief Retrieves the rectangular image region with specified center from the input array.
   353  
   354   dst(x,y) <- src(x + center.x - dst_width/2, y + center.y - dst_height/2).
   355   Values of pixels with fractional coordinates are retrieved using bilinear interpolation
   356  @see cv::getRectSubPix
   357  */
   358  CVAPI(void)  cvGetRectSubPix( const CvArr* src, CvArr* dst, CvPoint2D32f center );
   359  
   360  
   361  /** @brief Retrieves quadrangle from the input array.
   362  
   363      matrixarr = ( a11  a12 | b1 )   dst(x,y) <- src(A[x y]' + b)
   364                  ( a21  a22 | b2 )   (bilinear interpolation is used to retrieve pixels
   365                                       with fractional coordinates)
   366  @see cvWarpAffine
   367  */
   368  CVAPI(void)  cvGetQuadrangleSubPix( const CvArr* src, CvArr* dst,
   369                                      const CvMat* map_matrix );
   370  
   371  /** @brief Measures similarity between template and overlapped windows in the source image
   372     and fills the resultant image with the measurements
   373  @see cv::matchTemplate
   374  */
   375  CVAPI(void)  cvMatchTemplate( const CvArr* image, const CvArr* templ,
   376                                CvArr* result, int method );
   377  
   378  /** @brief Computes earth mover distance between
   379     two weighted point sets (called signatures)
   380  @see cv::EMD
   381  */
   382  CVAPI(float)  cvCalcEMD2( const CvArr* signature1,
   383                            const CvArr* signature2,
   384                            int distance_type,
   385                            CvDistanceFunction distance_func CV_DEFAULT(NULL),
   386                            const CvArr* cost_matrix CV_DEFAULT(NULL),
   387                            CvArr* flow CV_DEFAULT(NULL),
   388                            float* lower_bound CV_DEFAULT(NULL),
   389                            void* userdata CV_DEFAULT(NULL));
   390  
   391  /****************************************************************************************\
   392  *                              Contours retrieving                                       *
   393  \****************************************************************************************/
   394  
   395  /** @brief Retrieves outer and optionally inner boundaries of white (non-zero) connected
   396     components in the black (zero) background
   397  @see cv::findContours, cvStartFindContours, cvFindNextContour, cvSubstituteContour, cvEndFindContours
   398  */
   399  CVAPI(int)  cvFindContours( CvArr* image, CvMemStorage* storage, CvSeq** first_contour,
   400                              int header_size CV_DEFAULT(sizeof(CvContour)),
   401                              int mode CV_DEFAULT(CV_RETR_LIST),
   402                              int method CV_DEFAULT(CV_CHAIN_APPROX_SIMPLE),
   403                              CvPoint offset CV_DEFAULT(cvPoint(0,0)));
   404  
   405  /** @brief Initializes contour retrieving process.
   406  
   407     Calls cvStartFindContours.
   408     Calls cvFindNextContour until null pointer is returned
   409     or some other condition becomes true.
   410     Calls cvEndFindContours at the end.
   411  @see cvFindContours
   412  */
   413  CVAPI(CvContourScanner)  cvStartFindContours( CvArr* image, CvMemStorage* storage,
   414                              int header_size CV_DEFAULT(sizeof(CvContour)),
   415                              int mode CV_DEFAULT(CV_RETR_LIST),
   416                              int method CV_DEFAULT(CV_CHAIN_APPROX_SIMPLE),
   417                              CvPoint offset CV_DEFAULT(cvPoint(0,0)));
   418  
   419  /** @brief Retrieves next contour
   420  @see cvFindContours
   421  */
   422  CVAPI(CvSeq*)  cvFindNextContour( CvContourScanner scanner );
   423  
   424  
   425  /** @brief Substitutes the last retrieved contour with the new one
   426  
   427     (if the substitutor is null, the last retrieved contour is removed from the tree)
   428  @see cvFindContours
   429  */
   430  CVAPI(void)   cvSubstituteContour( CvContourScanner scanner, CvSeq* new_contour );
   431  
   432  
   433  /** @brief Releases contour scanner and returns pointer to the first outer contour
   434  @see cvFindContours
   435  */
   436  CVAPI(CvSeq*)  cvEndFindContours( CvContourScanner* scanner );
   437  
   438  /** @brief Approximates Freeman chain(s) with a polygonal curve.
   439  
   440  This is a standalone contour approximation routine, not represented in the new interface. When
   441  cvFindContours retrieves contours as Freeman chains, it calls the function to get approximated
   442  contours, represented as polygons.
   443  
   444  @param src_seq Pointer to the approximated Freeman chain that can refer to other chains.
   445  @param storage Storage location for the resulting polylines.
   446  @param method Approximation method (see the description of the function :ocvFindContours ).
   447  @param parameter Method parameter (not used now).
   448  @param minimal_perimeter Approximates only those contours whose perimeters are not less than
   449  minimal_perimeter . Other chains are removed from the resulting structure.
   450  @param recursive Recursion flag. If it is non-zero, the function approximates all chains that can
   451  be obtained from chain by using the h_next or v_next links. Otherwise, the single input chain is
   452  approximated.
   453  @see cvStartReadChainPoints, cvReadChainPoint
   454   */
   455  CVAPI(CvSeq*) cvApproxChains( CvSeq* src_seq, CvMemStorage* storage,
   456                              int method CV_DEFAULT(CV_CHAIN_APPROX_SIMPLE),
   457                              double parameter CV_DEFAULT(0),
   458                              int  minimal_perimeter CV_DEFAULT(0),
   459                              int  recursive CV_DEFAULT(0));
   460  
   461  /** @brief Initializes Freeman chain reader.
   462  
   463     The reader is used to iteratively get coordinates of all the chain points.
   464     If the Freeman codes should be read as is, a simple sequence reader should be used
   465  @see cvApproxChains
   466  */
   467  CVAPI(void) cvStartReadChainPoints( CvChain* chain, CvChainPtReader* reader );
   468  
   469  /** @brief Retrieves the next chain point
   470  @see cvApproxChains
   471  */
   472  CVAPI(CvPoint) cvReadChainPoint( CvChainPtReader* reader );
   473  
   474  
   475  /****************************************************************************************\
   476  *                            Contour Processing and Shape Analysis                       *
   477  \****************************************************************************************/
   478  
   479  /** @brief Approximates a single polygonal curve (contour) or
   480     a tree of polygonal curves (contours)
   481  @see cv::approxPolyDP
   482  */
   483  CVAPI(CvSeq*)  cvApproxPoly( const void* src_seq,
   484                               int header_size, CvMemStorage* storage,
   485                               int method, double eps,
   486                               int recursive CV_DEFAULT(0));
   487  
   488  /** @brief Calculates perimeter of a contour or length of a part of contour
   489  @see cv::arcLength
   490  */
   491  CVAPI(double)  cvArcLength( const void* curve,
   492                              CvSlice slice CV_DEFAULT(CV_WHOLE_SEQ),
   493                              int is_closed CV_DEFAULT(-1));
   494  
   495  /** same as cvArcLength for closed contour
   496  */
   497  CV_INLINE double cvContourPerimeter( const void* contour )
   498  {
   499      return cvArcLength( contour, CV_WHOLE_SEQ, 1 );
   500  }
   501  
   502  
   503  /** @brief Calculates contour bounding rectangle (update=1) or
   504     just retrieves pre-calculated rectangle (update=0)
   505  @see cv::boundingRect
   506  */
   507  CVAPI(CvRect)  cvBoundingRect( CvArr* points, int update CV_DEFAULT(0) );
   508  
   509  /** @brief Calculates area of a contour or contour segment
   510  @see cv::contourArea
   511  */
   512  CVAPI(double)  cvContourArea( const CvArr* contour,
   513                                CvSlice slice CV_DEFAULT(CV_WHOLE_SEQ),
   514                                int oriented CV_DEFAULT(0));
   515  
   516  /** @brief Finds minimum area rotated rectangle bounding a set of points
   517  @see cv::minAreaRect
   518  */
   519  CVAPI(CvBox2D)  cvMinAreaRect2( const CvArr* points,
   520                                  CvMemStorage* storage CV_DEFAULT(NULL));
   521  
   522  /** @brief Finds minimum enclosing circle for a set of points
   523  @see cv::minEnclosingCircle
   524  */
   525  CVAPI(int)  cvMinEnclosingCircle( const CvArr* points,
   526                                    CvPoint2D32f* center, float* radius );
   527  
   528  /** @brief Compares two contours by matching their moments
   529  @see cv::matchShapes
   530  */
   531  CVAPI(double)  cvMatchShapes( const void* object1, const void* object2,
   532                                int method, double parameter CV_DEFAULT(0));
   533  
   534  /** @brief Calculates exact convex hull of 2d point set
   535  @see cv::convexHull
   536  */
   537  CVAPI(CvSeq*) cvConvexHull2( const CvArr* input,
   538                               void* hull_storage CV_DEFAULT(NULL),
   539                               int orientation CV_DEFAULT(CV_CLOCKWISE),
   540                               int return_points CV_DEFAULT(0));
   541  
   542  /** @brief Checks whether the contour is convex or not (returns 1 if convex, 0 if not)
   543  @see cv::isContourConvex
   544  */
   545  CVAPI(int)  cvCheckContourConvexity( const CvArr* contour );
   546  
   547  
   548  /** @brief Finds convexity defects for the contour
   549  @see cv::convexityDefects
   550  */
   551  CVAPI(CvSeq*)  cvConvexityDefects( const CvArr* contour, const CvArr* convexhull,
   552                                     CvMemStorage* storage CV_DEFAULT(NULL));
   553  
   554  /** @brief Fits ellipse into a set of 2d points
   555  @see cv::fitEllipse
   556  */
   557  CVAPI(CvBox2D) cvFitEllipse2( const CvArr* points );
   558  
   559  /** @brief Finds minimum rectangle containing two given rectangles */
   560  CVAPI(CvRect)  cvMaxRect( const CvRect* rect1, const CvRect* rect2 );
   561  
   562  /** @brief Finds coordinates of the box vertices */
   563  CVAPI(void) cvBoxPoints( CvBox2D box, CvPoint2D32f pt[4] );
   564  
   565  /** @brief Initializes sequence header for a matrix (column or row vector) of points
   566  
   567     a wrapper for cvMakeSeqHeaderForArray (it does not initialize bounding rectangle!!!) */
   568  CVAPI(CvSeq*) cvPointSeqFromMat( int seq_kind, const CvArr* mat,
   569                                   CvContour* contour_header,
   570                                   CvSeqBlock* block );
   571  
   572  /** @brief Checks whether the point is inside polygon, outside, on an edge (at a vertex).
   573  
   574     Returns positive, negative or zero value, correspondingly.
   575     Optionally, measures a signed distance between
   576     the point and the nearest polygon edge (measure_dist=1)
   577  @see cv::pointPolygonTest
   578  */
   579  CVAPI(double) cvPointPolygonTest( const CvArr* contour,
   580                                    CvPoint2D32f pt, int measure_dist );
   581  
   582  /****************************************************************************************\
   583  *                                  Histogram functions                                   *
   584  \****************************************************************************************/
   585  
   586  /** @brief Creates a histogram.
   587  
   588  The function creates a histogram of the specified size and returns a pointer to the created
   589  histogram. If the array ranges is 0, the histogram bin ranges must be specified later via the
   590  function cvSetHistBinRanges. Though cvCalcHist and cvCalcBackProject may process 8-bit images
   591  without setting bin ranges, they assume they are equally spaced in 0 to 255 bins.
   592  
   593  @param dims Number of histogram dimensions.
   594  @param sizes Array of the histogram dimension sizes.
   595  @param type Histogram representation format. CV_HIST_ARRAY means that the histogram data is
   596  represented as a multi-dimensional dense array CvMatND. CV_HIST_SPARSE means that histogram data
   597  is represented as a multi-dimensional sparse array CvSparseMat.
   598  @param ranges Array of ranges for the histogram bins. Its meaning depends on the uniform parameter
   599  value. The ranges are used when the histogram is calculated or backprojected to determine which
   600  histogram bin corresponds to which value/tuple of values from the input image(s).
   601  @param uniform Uniformity flag. If not zero, the histogram has evenly spaced bins and for every
   602  \f$0<=i<cDims\f$ ranges[i] is an array of two numbers: lower and upper boundaries for the i-th
   603  histogram dimension. The whole range [lower,upper] is then split into dims[i] equal parts to
   604  determine the i-th input tuple value ranges for every histogram bin. And if uniform=0 , then the
   605  i-th element of the ranges array contains dims[i]+1 elements: \f$\texttt{lower}_0,
   606  \texttt{upper}_0, \texttt{lower}_1, \texttt{upper}_1 = \texttt{lower}_2,
   607  ...
   608  \texttt{upper}_{dims[i]-1}\f$ where \f$\texttt{lower}_j\f$ and \f$\texttt{upper}_j\f$ are lower
   609  and upper boundaries of the i-th input tuple value for the j-th bin, respectively. In either
   610  case, the input values that are beyond the specified range for a histogram bin are not counted
   611  by cvCalcHist and filled with 0 by cvCalcBackProject.
   612   */
   613  CVAPI(CvHistogram*)  cvCreateHist( int dims, int* sizes, int type,
   614                                     float** ranges CV_DEFAULT(NULL),
   615                                     int uniform CV_DEFAULT(1));
   616  
   617  /** @brief Sets the bounds of the histogram bins.
   618  
   619  This is a standalone function for setting bin ranges in the histogram. For a more detailed
   620  description of the parameters ranges and uniform, see the :ocvCalcHist function that can initialize
   621  the ranges as well. Ranges for the histogram bins must be set before the histogram is calculated or
   622  the backproject of the histogram is calculated.
   623  
   624  @param hist Histogram.
   625  @param ranges Array of bin ranges arrays. See :ocvCreateHist for details.
   626  @param uniform Uniformity flag. See :ocvCreateHist for details.
   627   */
   628  CVAPI(void)  cvSetHistBinRanges( CvHistogram* hist, float** ranges,
   629                                  int uniform CV_DEFAULT(1));
   630  
   631  /** @brief Makes a histogram out of an array.
   632  
   633  The function initializes the histogram, whose header and bins are allocated by the user.
   634  cvReleaseHist does not need to be called afterwards. Only dense histograms can be initialized this
   635  way. The function returns hist.
   636  
   637  @param dims Number of the histogram dimensions.
   638  @param sizes Array of the histogram dimension sizes.
   639  @param hist Histogram header initialized by the function.
   640  @param data Array used to store histogram bins.
   641  @param ranges Histogram bin ranges. See cvCreateHist for details.
   642  @param uniform Uniformity flag. See cvCreateHist for details.
   643   */
   644  CVAPI(CvHistogram*)  cvMakeHistHeaderForArray(
   645                              int  dims, int* sizes, CvHistogram* hist,
   646                              float* data, float** ranges CV_DEFAULT(NULL),
   647                              int uniform CV_DEFAULT(1));
   648  
   649  /** @brief Releases the histogram.
   650  
   651  The function releases the histogram (header and the data). The pointer to the histogram is cleared
   652  by the function. If \*hist pointer is already NULL, the function does nothing.
   653  
   654  @param hist Double pointer to the released histogram.
   655   */
   656  CVAPI(void)  cvReleaseHist( CvHistogram** hist );
   657  
   658  /** @brief Clears the histogram.
   659  
   660  The function sets all of the histogram bins to 0 in case of a dense histogram and removes all
   661  histogram bins in case of a sparse array.
   662  
   663  @param hist Histogram.
   664   */
   665  CVAPI(void)  cvClearHist( CvHistogram* hist );
   666  
   667  /** @brief Finds the minimum and maximum histogram bins.
   668  
   669  The function finds the minimum and maximum histogram bins and their positions. All of output
   670  arguments are optional. Among several extremas with the same value the ones with the minimum index
   671  (in the lexicographical order) are returned. In case of several maximums or minimums, the earliest
   672  in the lexicographical order (extrema locations) is returned.
   673  
   674  @param hist Histogram.
   675  @param min_value Pointer to the minimum value of the histogram.
   676  @param max_value Pointer to the maximum value of the histogram.
   677  @param min_idx Pointer to the array of coordinates for the minimum.
   678  @param max_idx Pointer to the array of coordinates for the maximum.
   679   */
   680  CVAPI(void)  cvGetMinMaxHistValue( const CvHistogram* hist,
   681                                     float* min_value, float* max_value,
   682                                     int* min_idx CV_DEFAULT(NULL),
   683                                     int* max_idx CV_DEFAULT(NULL));
   684  
   685  
   686  /** @brief Normalizes the histogram.
   687  
   688  The function normalizes the histogram bins by scaling them so that the sum of the bins becomes equal
   689  to factor.
   690  
   691  @param hist Pointer to the histogram.
   692  @param factor Normalization factor.
   693   */
   694  CVAPI(void)  cvNormalizeHist( CvHistogram* hist, double factor );
   695  
   696  
   697  /** @brief Thresholds the histogram.
   698  
   699  The function clears histogram bins that are below the specified threshold.
   700  
   701  @param hist Pointer to the histogram.
   702  @param threshold Threshold level.
   703   */
   704  CVAPI(void)  cvThreshHist( CvHistogram* hist, double threshold );
   705  
   706  
   707  /** Compares two histogram */
   708  CVAPI(double)  cvCompareHist( const CvHistogram* hist1,
   709                                const CvHistogram* hist2,
   710                                int method);
   711  
   712  /** @brief Copies a histogram.
   713  
   714  The function makes a copy of the histogram. If the second histogram pointer \*dst is NULL, a new
   715  histogram of the same size as src is created. Otherwise, both histograms must have equal types and
   716  sizes. Then the function copies the bin values of the source histogram to the destination histogram
   717  and sets the same bin value ranges as in src.
   718  
   719  @param src Source histogram.
   720  @param dst Pointer to the destination histogram.
   721   */
   722  CVAPI(void)  cvCopyHist( const CvHistogram* src, CvHistogram** dst );
   723  
   724  
   725  /** @brief Calculates bayesian probabilistic histograms
   726     (each or src and dst is an array of _number_ histograms */
   727  CVAPI(void)  cvCalcBayesianProb( CvHistogram** src, int number,
   728                                  CvHistogram** dst);
   729  
   730  /** @brief Calculates array histogram
   731  @see cv::calcHist
   732  */
   733  CVAPI(void)  cvCalcArrHist( CvArr** arr, CvHistogram* hist,
   734                              int accumulate CV_DEFAULT(0),
   735                              const CvArr* mask CV_DEFAULT(NULL) );
   736  
   737  /** @overload */
   738  CV_INLINE  void  cvCalcHist( IplImage** image, CvHistogram* hist,
   739                               int accumulate CV_DEFAULT(0),
   740                               const CvArr* mask CV_DEFAULT(NULL) )
   741  {
   742      cvCalcArrHist( (CvArr**)image, hist, accumulate, mask );
   743  }
   744  
   745  /** @brief Calculates back project
   746  @see cvCalcBackProject, cv::calcBackProject
   747  */
   748  CVAPI(void)  cvCalcArrBackProject( CvArr** image, CvArr* dst,
   749                                     const CvHistogram* hist );
   750  
   751  #define  cvCalcBackProject(image, dst, hist) cvCalcArrBackProject((CvArr**)image, dst, hist)
   752  
   753  
   754  /** @brief Locates a template within an image by using a histogram comparison.
   755  
   756  The function calculates the back projection by comparing histograms of the source image patches with
   757  the given histogram. The function is similar to matchTemplate, but instead of comparing the raster
   758  patch with all its possible positions within the search window, the function CalcBackProjectPatch
   759  compares histograms. See the algorithm diagram below:
   760  
   761  ![image](pics/backprojectpatch.png)
   762  
   763  @param image Source images (though, you may pass CvMat\*\* as well).
   764  @param dst Destination image.
   765  @param range
   766  @param hist Histogram.
   767  @param method Comparison method passed to cvCompareHist (see the function description).
   768  @param factor Normalization factor for histograms that affects the normalization scale of the
   769  destination image. Pass 1 if not sure.
   770  
   771  @see cvCalcBackProjectPatch
   772   */
   773  CVAPI(void)  cvCalcArrBackProjectPatch( CvArr** image, CvArr* dst, CvSize range,
   774                                          CvHistogram* hist, int method,
   775                                          double factor );
   776  
   777  #define  cvCalcBackProjectPatch( image, dst, range, hist, method, factor ) \
   778       cvCalcArrBackProjectPatch( (CvArr**)image, dst, range, hist, method, factor )
   779  
   780  
   781  /** @brief Divides one histogram by another.
   782  
   783  The function calculates the object probability density from two histograms as:
   784  
   785  \f[\texttt{disthist} (I)= \forkthree{0}{if \(\texttt{hist1}(I)=0\)}{\texttt{scale}}{if \(\texttt{hist1}(I) \ne 0\) and \(\texttt{hist2}(I) > \texttt{hist1}(I)\)}{\frac{\texttt{hist2}(I) \cdot \texttt{scale}}{\texttt{hist1}(I)}}{if \(\texttt{hist1}(I) \ne 0\) and \(\texttt{hist2}(I) \le \texttt{hist1}(I)\)}\f]
   786  
   787  @param hist1 First histogram (the divisor).
   788  @param hist2 Second histogram.
   789  @param dst_hist Destination histogram.
   790  @param scale Scale factor for the destination histogram.
   791   */
   792  CVAPI(void)  cvCalcProbDensity( const CvHistogram* hist1, const CvHistogram* hist2,
   793                                  CvHistogram* dst_hist, double scale CV_DEFAULT(255) );
   794  
   795  /** @brief equalizes histogram of 8-bit single-channel image
   796  @see cv::equalizeHist
   797  */
   798  CVAPI(void)  cvEqualizeHist( const CvArr* src, CvArr* dst );
   799  
   800  
   801  /** @brief Applies distance transform to binary image
   802  @see cv::distanceTransform
   803  */
   804  CVAPI(void)  cvDistTransform( const CvArr* src, CvArr* dst,
   805                                int distance_type CV_DEFAULT(CV_DIST_L2),
   806                                int mask_size CV_DEFAULT(3),
   807                                const float* mask CV_DEFAULT(NULL),
   808                                CvArr* labels CV_DEFAULT(NULL),
   809                                int labelType CV_DEFAULT(CV_DIST_LABEL_CCOMP));
   810  
   811  
   812  /** @brief Applies fixed-level threshold to grayscale image.
   813  
   814     This is a basic operation applied before retrieving contours
   815  @see cv::threshold
   816  */
   817  CVAPI(double)  cvThreshold( const CvArr*  src, CvArr*  dst,
   818                              double  threshold, double  max_value,
   819                              int threshold_type );
   820  
   821  /** @brief Applies adaptive threshold to grayscale image.
   822  
   823     The two parameters for methods CV_ADAPTIVE_THRESH_MEAN_C and
   824     CV_ADAPTIVE_THRESH_GAUSSIAN_C are:
   825     neighborhood size (3, 5, 7 etc.),
   826     and a constant subtracted from mean (...,-3,-2,-1,0,1,2,3,...)
   827  @see cv::adaptiveThreshold
   828  */
   829  CVAPI(void)  cvAdaptiveThreshold( const CvArr* src, CvArr* dst, double max_value,
   830                                    int adaptive_method CV_DEFAULT(CV_ADAPTIVE_THRESH_MEAN_C),
   831                                    int threshold_type CV_DEFAULT(CV_THRESH_BINARY),
   832                                    int block_size CV_DEFAULT(3),
   833                                    double param1 CV_DEFAULT(5));
   834  
   835  /** @brief Fills the connected component until the color difference gets large enough
   836  @see cv::floodFill
   837  */
   838  CVAPI(void)  cvFloodFill( CvArr* image, CvPoint seed_point,
   839                            CvScalar new_val, CvScalar lo_diff CV_DEFAULT(cvScalarAll(0)),
   840                            CvScalar up_diff CV_DEFAULT(cvScalarAll(0)),
   841                            CvConnectedComp* comp CV_DEFAULT(NULL),
   842                            int flags CV_DEFAULT(4),
   843                            CvArr* mask CV_DEFAULT(NULL));
   844  
   845  /****************************************************************************************\
   846  *                                  Feature detection                                     *
   847  \****************************************************************************************/
   848  
   849  /** @brief Runs canny edge detector
   850  @see cv::Canny
   851  */
   852  CVAPI(void)  cvCanny( const CvArr* image, CvArr* edges, double threshold1,
   853                        double threshold2, int  aperture_size CV_DEFAULT(3) );
   854  
   855  /** @brief Calculates constraint image for corner detection
   856  
   857     Dx^2 * Dyy + Dxx * Dy^2 - 2 * Dx * Dy * Dxy.
   858     Applying threshold to the result gives coordinates of corners
   859  @see cv::preCornerDetect
   860  */
   861  CVAPI(void) cvPreCornerDetect( const CvArr* image, CvArr* corners,
   862                                 int aperture_size CV_DEFAULT(3) );
   863  
   864  /** @brief Calculates eigen values and vectors of 2x2
   865     gradient covariation matrix at every image pixel
   866  @see cv::cornerEigenValsAndVecs
   867  */
   868  CVAPI(void)  cvCornerEigenValsAndVecs( const CvArr* image, CvArr* eigenvv,
   869                                         int block_size, int aperture_size CV_DEFAULT(3) );
   870  
   871  /** @brief Calculates minimal eigenvalue for 2x2 gradient covariation matrix at
   872     every image pixel
   873  @see cv::cornerMinEigenVal
   874  */
   875  CVAPI(void)  cvCornerMinEigenVal( const CvArr* image, CvArr* eigenval,
   876                                    int block_size, int aperture_size CV_DEFAULT(3) );
   877  
   878  /** @brief Harris corner detector:
   879  
   880     Calculates det(M) - k*(trace(M)^2), where M is 2x2 gradient covariation matrix for each pixel
   881  @see cv::cornerHarris
   882  */
   883  CVAPI(void)  cvCornerHarris( const CvArr* image, CvArr* harris_response,
   884                               int block_size, int aperture_size CV_DEFAULT(3),
   885                               double k CV_DEFAULT(0.04) );
   886  
   887  /** @brief Adjust corner position using some sort of gradient search
   888  @see cv::cornerSubPix
   889  */
   890  CVAPI(void)  cvFindCornerSubPix( const CvArr* image, CvPoint2D32f* corners,
   891                                   int count, CvSize win, CvSize zero_zone,
   892                                   CvTermCriteria  criteria );
   893  
   894  /** @brief Finds a sparse set of points within the selected region
   895     that seem to be easy to track
   896  @see cv::goodFeaturesToTrack
   897  */
   898  CVAPI(void)  cvGoodFeaturesToTrack( const CvArr* image, CvArr* eig_image,
   899                                      CvArr* temp_image, CvPoint2D32f* corners,
   900                                      int* corner_count, double  quality_level,
   901                                      double  min_distance,
   902                                      const CvArr* mask CV_DEFAULT(NULL),
   903                                      int block_size CV_DEFAULT(3),
   904                                      int use_harris CV_DEFAULT(0),
   905                                      double k CV_DEFAULT(0.04) );
   906  
   907  /** @brief Finds lines on binary image using one of several methods.
   908  
   909     line_storage is either memory storage or 1 x _max number of lines_ CvMat, its
   910     number of columns is changed by the function.
   911     method is one of CV_HOUGH_*;
   912     rho, theta and threshold are used for each of those methods;
   913     param1 ~ line length, param2 ~ line gap - for probabilistic,
   914     param1 ~ srn, param2 ~ stn - for multi-scale
   915  @see cv::HoughLines
   916  */
   917  CVAPI(CvSeq*)  cvHoughLines2( CvArr* image, void* line_storage, int method,
   918                                double rho, double theta, int threshold,
   919                                double param1 CV_DEFAULT(0), double param2 CV_DEFAULT(0),
   920                                double min_theta CV_DEFAULT(0), double max_theta CV_DEFAULT(CV_PI));
   921  
   922  /** @brief Finds circles in the image
   923  @see cv::HoughCircles
   924  */
   925  CVAPI(CvSeq*) cvHoughCircles( CvArr* image, void* circle_storage,
   926                                int method, double dp, double min_dist,
   927                                double param1 CV_DEFAULT(100),
   928                                double param2 CV_DEFAULT(100),
   929                                int min_radius CV_DEFAULT(0),
   930                                int max_radius CV_DEFAULT(0));
   931  
   932  /** @brief Fits a line into set of 2d or 3d points in a robust way (M-estimator technique)
   933  @see cv::fitLine
   934  */
   935  CVAPI(void)  cvFitLine( const CvArr* points, int dist_type, double param,
   936                          double reps, double aeps, float* line );
   937  
   938  /****************************************************************************************\
   939  *                                     Drawing                                            *
   940  \****************************************************************************************/
   941  
   942  /****************************************************************************************\
   943  *       Drawing functions work with images/matrices of arbitrary type.                   *
   944  *       For color images the channel order is BGR[A]                                     *
   945  *       Antialiasing is supported only for 8-bit image now.                              *
   946  *       All the functions include parameter color that means rgb value (that may be      *
   947  *       constructed with CV_RGB macro) for color images and brightness                   *
   948  *       for grayscale images.                                                            *
   949  *       If a drawn figure is partially or completely outside of the image, it is clipped.*
   950  \****************************************************************************************/
   951  
   952  #define CV_FILLED -1
   953  
   954  #define CV_AA 16
   955  
   956  /** @brief Draws 4-connected, 8-connected or antialiased line segment connecting two points
   957  @see cv::line
   958  */
   959  CVAPI(void)  cvLine( CvArr* img, CvPoint pt1, CvPoint pt2,
   960                       CvScalar color, int thickness CV_DEFAULT(1),
   961                       int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) );
   962  
   963  /** @brief Draws a rectangle given two opposite corners of the rectangle (pt1 & pt2)
   964  
   965     if thickness<0 (e.g. thickness == CV_FILLED), the filled box is drawn
   966  @see cv::rectangle
   967  */
   968  CVAPI(void)  cvRectangle( CvArr* img, CvPoint pt1, CvPoint pt2,
   969                            CvScalar color, int thickness CV_DEFAULT(1),
   970                            int line_type CV_DEFAULT(8),
   971                            int shift CV_DEFAULT(0));
   972  
   973  /** @brief Draws a rectangle specified by a CvRect structure
   974  @see cv::rectangle
   975  */
   976  CVAPI(void)  cvRectangleR( CvArr* img, CvRect r,
   977                             CvScalar color, int thickness CV_DEFAULT(1),
   978                             int line_type CV_DEFAULT(8),
   979                             int shift CV_DEFAULT(0));
   980  
   981  
   982  /** @brief Draws a circle with specified center and radius.
   983  
   984     Thickness works in the same way as with cvRectangle
   985  @see cv::circle
   986  */
   987  CVAPI(void)  cvCircle( CvArr* img, CvPoint center, int radius,
   988                         CvScalar color, int thickness CV_DEFAULT(1),
   989                         int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0));
   990  
   991  /** @brief Draws ellipse outline, filled ellipse, elliptic arc or filled elliptic sector
   992  
   993     depending on _thickness_, _start_angle_ and _end_angle_ parameters. The resultant figure
   994     is rotated by _angle_. All the angles are in degrees
   995  @see cv::ellipse
   996  */
   997  CVAPI(void)  cvEllipse( CvArr* img, CvPoint center, CvSize axes,
   998                          double angle, double start_angle, double end_angle,
   999                          CvScalar color, int thickness CV_DEFAULT(1),
  1000                          int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0));
  1001  
  1002  CV_INLINE  void  cvEllipseBox( CvArr* img, CvBox2D box, CvScalar color,
  1003                                 int thickness CV_DEFAULT(1),
  1004                                 int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) )
  1005  {
  1006      CvSize axes = cvSize(
  1007          cvRound(box.size.width*0.5),
  1008          cvRound(box.size.height*0.5)
  1009      );
  1010  
  1011      cvEllipse( img, cvPointFrom32f( box.center ), axes, box.angle,
  1012                 0, 360, color, thickness, line_type, shift );
  1013  }
  1014  
  1015  /** @brief Fills convex or monotonous polygon.
  1016  @see cv::fillConvexPoly
  1017  */
  1018  CVAPI(void)  cvFillConvexPoly( CvArr* img, const CvPoint* pts, int npts, CvScalar color,
  1019                                 int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0));
  1020  
  1021  /** @brief Fills an area bounded by one or more arbitrary polygons
  1022  @see cv::fillPoly
  1023  */
  1024  CVAPI(void)  cvFillPoly( CvArr* img, CvPoint** pts, const int* npts,
  1025                           int contours, CvScalar color,
  1026                           int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) );
  1027  
  1028  /** @brief Draws one or more polygonal curves
  1029  @see cv::polylines
  1030  */
  1031  CVAPI(void)  cvPolyLine( CvArr* img, CvPoint** pts, const int* npts, int contours,
  1032                           int is_closed, CvScalar color, int thickness CV_DEFAULT(1),
  1033                           int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) );
  1034  
  1035  #define cvDrawRect cvRectangle
  1036  #define cvDrawLine cvLine
  1037  #define cvDrawCircle cvCircle
  1038  #define cvDrawEllipse cvEllipse
  1039  #define cvDrawPolyLine cvPolyLine
  1040  
  1041  /** @brief Clips the line segment connecting *pt1 and *pt2
  1042     by the rectangular window
  1043  
  1044     (0<=x<img_size.width, 0<=y<img_size.height).
  1045  @see cv::clipLine
  1046  */
  1047  CVAPI(int) cvClipLine( CvSize img_size, CvPoint* pt1, CvPoint* pt2 );
  1048  
  1049  /** @brief Initializes line iterator.
  1050  
  1051  Initially, line_iterator->ptr will point to pt1 (or pt2, see left_to_right description) location in
  1052  the image. Returns the number of pixels on the line between the ending points.
  1053  @see cv::LineIterator
  1054  */
  1055  CVAPI(int)  cvInitLineIterator( const CvArr* image, CvPoint pt1, CvPoint pt2,
  1056                                  CvLineIterator* line_iterator,
  1057                                  int connectivity CV_DEFAULT(8),
  1058                                  int left_to_right CV_DEFAULT(0));
  1059  
  1060  #define CV_NEXT_LINE_POINT( line_iterator )                     \
  1061  {                                                               \
  1062      int _line_iterator_mask = (line_iterator).err < 0 ? -1 : 0; \
  1063      (line_iterator).err += (line_iterator).minus_delta +        \
  1064          ((line_iterator).plus_delta & _line_iterator_mask);     \
  1065      (line_iterator).ptr += (line_iterator).minus_step +         \
  1066          ((line_iterator).plus_step & _line_iterator_mask);      \
  1067  }
  1068  
  1069  
  1070  #define CV_FONT_HERSHEY_SIMPLEX         0
  1071  #define CV_FONT_HERSHEY_PLAIN           1
  1072  #define CV_FONT_HERSHEY_DUPLEX          2
  1073  #define CV_FONT_HERSHEY_COMPLEX         3
  1074  #define CV_FONT_HERSHEY_TRIPLEX         4
  1075  #define CV_FONT_HERSHEY_COMPLEX_SMALL   5
  1076  #define CV_FONT_HERSHEY_SCRIPT_SIMPLEX  6
  1077  #define CV_FONT_HERSHEY_SCRIPT_COMPLEX  7
  1078  
  1079  #define CV_FONT_ITALIC                 16
  1080  
  1081  #define CV_FONT_VECTOR0    CV_FONT_HERSHEY_SIMPLEX
  1082  
  1083  
  1084  /** Font structure */
  1085  typedef struct CvFont
  1086  {
  1087    const char* nameFont;   //Qt:nameFont
  1088    CvScalar color;       //Qt:ColorFont -> cvScalar(blue_component, green_component, red_component[, alpha_component])
  1089      int         font_face;    //Qt: bool italic         /** =CV_FONT_* */
  1090      const int*  ascii;      //!< font data and metrics
  1091      const int*  greek;
  1092      const int*  cyrillic;
  1093      float       hscale, vscale;
  1094      float       shear;      //!< slope coefficient: 0 - normal, >0 - italic
  1095      int         thickness;    //!< Qt: weight               /** letters thickness */
  1096      float       dx;       //!< horizontal interval between letters
  1097      int         line_type;    //!< Qt: PointSize
  1098  }
  1099  CvFont;
  1100  
  1101  /** @brief Initializes font structure (OpenCV 1.x API).
  1102  
  1103  The function initializes the font structure that can be passed to text rendering functions.
  1104  
  1105  @param font Pointer to the font structure initialized by the function
  1106  @param font_face Font name identifier. See cv::HersheyFonts and corresponding old CV_* identifiers.
  1107  @param hscale Horizontal scale. If equal to 1.0f , the characters have the original width
  1108  depending on the font type. If equal to 0.5f , the characters are of half the original width.
  1109  @param vscale Vertical scale. If equal to 1.0f , the characters have the original height depending
  1110  on the font type. If equal to 0.5f , the characters are of half the original height.
  1111  @param shear Approximate tangent of the character slope relative to the vertical line. A zero
  1112  value means a non-italic font, 1.0f means about a 45 degree slope, etc.
  1113  @param thickness Thickness of the text strokes
  1114  @param line_type Type of the strokes, see line description
  1115  
  1116  @sa cvPutText
  1117   */
  1118  CVAPI(void)  cvInitFont( CvFont* font, int font_face,
  1119                           double hscale, double vscale,
  1120                           double shear CV_DEFAULT(0),
  1121                           int thickness CV_DEFAULT(1),
  1122                           int line_type CV_DEFAULT(8));
  1123  
  1124  CV_INLINE CvFont cvFont( double scale, int thickness CV_DEFAULT(1) )
  1125  {
  1126      CvFont font;
  1127      cvInitFont( &font, CV_FONT_HERSHEY_PLAIN, scale, scale, 0, thickness, CV_AA );
  1128      return font;
  1129  }
  1130  
  1131  /** @brief Renders text stroke with specified font and color at specified location.
  1132     CvFont should be initialized with cvInitFont
  1133  @see cvInitFont, cvGetTextSize, cvFont, cv::putText
  1134  */
  1135  CVAPI(void)  cvPutText( CvArr* img, const char* text, CvPoint org,
  1136                          const CvFont* font, CvScalar color );
  1137  
  1138  /** @brief Calculates bounding box of text stroke (useful for alignment)
  1139  @see cv::getTextSize
  1140  */
  1141  CVAPI(void)  cvGetTextSize( const char* text_string, const CvFont* font,
  1142                              CvSize* text_size, int* baseline );
  1143  
  1144  /** @brief Unpacks color value
  1145  
  1146  if arrtype is CV_8UC?, _color_ is treated as packed color value, otherwise the first channels
  1147  (depending on arrtype) of destination scalar are set to the same value = _color_
  1148  */
  1149  CVAPI(CvScalar)  cvColorToScalar( double packed_color, int arrtype );
  1150  
  1151  /** @brief Returns the polygon points which make up the given ellipse.
  1152  
  1153  The ellipse is define by the box of size 'axes' rotated 'angle' around the 'center'. A partial
  1154  sweep of the ellipse arc can be done by specifying arc_start and arc_end to be something other than
  1155  0 and 360, respectively. The input array 'pts' must be large enough to hold the result. The total
  1156  number of points stored into 'pts' is returned by this function.
  1157  @see cv::ellipse2Poly
  1158  */
  1159  CVAPI(int) cvEllipse2Poly( CvPoint center, CvSize axes,
  1160                   int angle, int arc_start, int arc_end, CvPoint * pts, int delta );
  1161  
  1162  /** @brief Draws contour outlines or filled interiors on the image
  1163  @see cv::drawContours
  1164  */
  1165  CVAPI(void)  cvDrawContours( CvArr *img, CvSeq* contour,
  1166                               CvScalar external_color, CvScalar hole_color,
  1167                               int max_level, int thickness CV_DEFAULT(1),
  1168                               int line_type CV_DEFAULT(8),
  1169                               CvPoint offset CV_DEFAULT(cvPoint(0,0)));
  1170  
  1171  /** @} */
  1172  
  1173  #ifdef __cplusplus
  1174  }
  1175  #endif
  1176  
  1177  #endif