openCV library for Renesas RZ/A

Dependents:   RZ_A2M_Mbed_samples

Committer:
RyoheiHagimoto
Date:
Fri Jan 29 04:53:38 2021 +0000
Revision:
0:0e0631af0305
copied from https://github.com/d-kato/opencv-lib.

Who changed what in which revision?

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