include/opencv2/imgproc/imgproc.hpp
Go to the documentation of this file.
00001 
00005 /*M///////////////////////////////////////////////////////////////////////////////////////
00006 //
00007 //  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
00008 //
00009 //  By downloading, copying, installing or using the software you agree to this license.
00010 //  If you do not agree to this license, do not download, install,
00011 //  copy or use the software.
00012 //
00013 //
00014 //                           License Agreement
00015 //                For Open Source Computer Vision Library
00016 //
00017 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
00018 // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
00019 // Third party copyrights are property of their respective owners.
00020 //
00021 // Redistribution and use in source and binary forms, with or without modification,
00022 // are permitted provided that the following conditions are met:
00023 //
00024 //   * Redistribution's of source code must retain the above copyright notice,
00025 //     this list of conditions and the following disclaimer.
00026 //
00027 //   * Redistribution's in binary form must reproduce the above copyright notice,
00028 //     this list of conditions and the following disclaimer in the documentation
00029 //     and/or other materials provided with the distribution.
00030 //
00031 //   * The name of the copyright holders may not be used to endorse or promote products
00032 //     derived from this software without specific prior written permission.
00033 //
00034 // This software is provided by the copyright holders and contributors "as is" and
00035 // any express or implied warranties, including, but not limited to, the implied
00036 // warranties of merchantability and fitness for a particular purpose are disclaimed.
00037 // In no event shall the Intel Corporation or contributors be liable for any direct,
00038 // indirect, incidental, special, exemplary, or consequential damages
00039 // (including, but not limited to, procurement of substitute goods or services;
00040 // loss of use, data, or profits; or business interruption) however caused
00041 // and on any theory of liability, whether in contract, strict liability,
00042 // or tort (including negligence or otherwise) arising in any way out of
00043 // the use of this software, even if advised of the possibility of such damage.
00044 //
00045 //M*/
00046 
00047 #ifndef __OPENCV_IMGPROC_HPP__
00048 #define __OPENCV_IMGPROC_HPP__
00049 
00050 #include "opencv2/core/core.hpp"
00051 #include "opencv2/imgproc/types_c.h"
00052 
00053 #ifdef __cplusplus
00054 
00058 namespace cv
00059 {
00060 
00062 enum { BORDER_REPLICATE=IPL_BORDER_REPLICATE, BORDER_CONSTANT=IPL_BORDER_CONSTANT,
00063        BORDER_REFLECT=IPL_BORDER_REFLECT, BORDER_WRAP=IPL_BORDER_WRAP,
00064        BORDER_REFLECT_101=IPL_BORDER_REFLECT_101, BORDER_REFLECT101=BORDER_REFLECT_101,
00065        BORDER_TRANSPARENT=IPL_BORDER_TRANSPARENT,
00066        BORDER_DEFAULT=BORDER_REFLECT_101, BORDER_ISOLATED=16 };
00067 
00069 CV_EXPORTS_W int borderInterpolate( int p, int len, int borderType );
00070 
00080 class CV_EXPORTS BaseRowFilter
00081 {
00082 public:
00084     BaseRowFilter();
00086     virtual ~BaseRowFilter();
00088     virtual void operator()(const uchar* src, uchar* dst,
00089                             int width, int cn) = 0;
00090     int ksize, anchor;
00091 };
00092 
00093 
00107 class CV_EXPORTS BaseColumnFilter
00108 {
00109 public:
00111     BaseColumnFilter();
00113     virtual ~BaseColumnFilter();
00115     virtual void operator()(const uchar** src, uchar* dst, int dststep,
00116                             int dstcount, int width) = 0;
00118     virtual void reset();
00119     int ksize, anchor;
00120 };
00121 
00133 class CV_EXPORTS BaseFilter
00134 {
00135 public:
00137     BaseFilter();
00139     virtual ~BaseFilter();
00141     virtual void operator()(const uchar** src, uchar* dst, int dststep,
00142                             int dstcount, int width, int cn) = 0;
00144     virtual void reset();
00145     Size ksize;
00146     Point anchor;
00147 };
00148 
00222 class CV_EXPORTS FilterEngine
00223 {
00224 public:
00226     FilterEngine();
00228     FilterEngine(const Ptr<BaseFilter>& _filter2D,
00229                  const Ptr<BaseRowFilter>& _rowFilter,
00230                  const Ptr<BaseColumnFilter>& _columnFilter,
00231                  int srcType, int dstType, int bufType,
00232                  int _rowBorderType=BORDER_REPLICATE,
00233                  int _columnBorderType=-1,
00234                  const Scalar& _borderValue=Scalar());
00236     virtual ~FilterEngine();
00238     void init(const Ptr<BaseFilter>& _filter2D,
00239               const Ptr<BaseRowFilter>& _rowFilter,
00240               const Ptr<BaseColumnFilter>& _columnFilter,
00241               int srcType, int dstType, int bufType,
00242               int _rowBorderType=BORDER_REPLICATE, int _columnBorderType=-1,
00243               const Scalar& _borderValue=Scalar());
00245     virtual int start(Size wholeSize, Rect roi, int maxBufRows=-1);
00247     virtual int start(const Mat& src, const Rect& srcRoi=Rect(0,0,-1,-1),
00248                       bool isolated=false, int maxBufRows=-1);
00250     virtual int proceed(const uchar* src, int srcStep, int srcCount,
00251                         uchar* dst, int dstStep);
00253     virtual void apply( const Mat& src, Mat& dst,
00254                         const Rect& srcRoi=Rect(0,0,-1,-1),
00255                         Point dstOfs=Point(0,0),
00256                         bool isolated=false);
00258     bool isSeparable() const { return (const BaseFilter*)filter2D == 0; }
00260     int remainingInputRows() const;
00261     int remainingOutputRows() const;
00262 
00263     int srcType, dstType, bufType;
00264     Size ksize;
00265     Point anchor;
00266     int maxWidth;
00267     Size wholeSize;
00268     Rect roi;
00269     int dx1, dx2;
00270     int rowBorderType, columnBorderType;
00271     vector<int> borderTab;
00272     int borderElemSize;
00273     vector<uchar> ringBuf;
00274     vector<uchar> srcRow;
00275     vector<uchar> constBorderValue;
00276     vector<uchar> constBorderRow;
00277     int bufStep, startY, startY0, endY, rowCount, dstY;
00278     vector<uchar*> rows;
00279 
00280     Ptr<BaseFilter> filter2D;
00281     Ptr<BaseRowFilter> rowFilter;
00282     Ptr<BaseColumnFilter> columnFilter;
00283 };
00284 
00286 enum { KERNEL_GENERAL=0, KERNEL_SYMMETRICAL=1, KERNEL_ASYMMETRICAL=2,
00287        KERNEL_SMOOTH=4, KERNEL_INTEGER=8 };
00288 
00290 CV_EXPORTS int getKernelType(InputArray kernel, Point anchor);
00291 
00293 CV_EXPORTS Ptr<BaseRowFilter> getLinearRowFilter(int srcType, int bufType,
00294                                             InputArray kernel, int anchor,
00295                                             int symmetryType);
00296 
00298 CV_EXPORTS Ptr<BaseColumnFilter> getLinearColumnFilter(int bufType, int dstType,
00299                                             InputArray kernel, int anchor,
00300                                             int symmetryType, double delta=0,
00301                                             int bits=0);
00302 
00304 CV_EXPORTS Ptr<BaseFilter> getLinearFilter(int srcType, int dstType,
00305                                            InputArray kernel,
00306                                            Point anchor=Point(-1,-1),
00307                                            double delta=0, int bits=0);
00308 
00310 CV_EXPORTS Ptr<FilterEngine> createSeparableLinearFilter(int srcType, int dstType,
00311                           InputArray rowKernel, InputArray columnKernel,
00312                           Point anchor=Point(-1,-1), double delta=0,
00313                           int rowBorderType=BORDER_DEFAULT,
00314                           int columnBorderType=-1,
00315                           const Scalar& borderValue=Scalar());
00316 
00318 CV_EXPORTS Ptr<FilterEngine> createLinearFilter(int srcType, int dstType,
00319                  InputArray kernel, Point _anchor=Point(-1,-1),
00320                  double delta=0, int rowBorderType=BORDER_DEFAULT,
00321                  int columnBorderType=-1, const Scalar& borderValue=Scalar());
00322 
00324 CV_EXPORTS_W Mat getGaussianKernel( int ksize, double sigma, int ktype=CV_64F );
00325 
00327 CV_EXPORTS Ptr<FilterEngine> createGaussianFilter( int type, Size ksize,
00328                                     double sigma1, double sigma2=0,
00329                                     int borderType=BORDER_DEFAULT);
00331 CV_EXPORTS_W void getDerivKernels( OutputArray kx, OutputArray ky,
00332                                    int dx, int dy, int ksize,
00333                                    bool normalize=false, int ktype=CV_32F );
00335 CV_EXPORTS Ptr<FilterEngine> createDerivFilter( int srcType, int dstType,
00336                                         int dx, int dy, int ksize,
00337                                         int borderType=BORDER_DEFAULT );
00339 CV_EXPORTS Ptr<BaseRowFilter> getRowSumFilter(int srcType, int sumType,
00340                                               int ksize, int anchor=-1);
00342 CV_EXPORTS Ptr<BaseColumnFilter> getColumnSumFilter( int sumType, int dstType,
00343                                                      int ksize, int anchor=-1,
00344                                                      double scale=1);
00346 CV_EXPORTS Ptr<FilterEngine> createBoxFilter( int srcType, int dstType, Size ksize,
00347                                               Point anchor=Point(-1,-1),
00348                                               bool normalize=true,
00349                                               int borderType=BORDER_DEFAULT);
00350 
00352 CV_EXPORTS_W Mat getGaborKernel( Size ksize, double sigma, double theta, double lambd,
00353                                  double gamma, double psi=CV_PI*0.5, int ktype=CV_64F );
00354 
00356 enum { MORPH_ERODE=CV_MOP_ERODE, MORPH_DILATE=CV_MOP_DILATE,
00357        MORPH_OPEN=CV_MOP_OPEN, MORPH_CLOSE=CV_MOP_CLOSE,
00358        MORPH_GRADIENT=CV_MOP_GRADIENT, MORPH_TOPHAT=CV_MOP_TOPHAT,
00359        MORPH_BLACKHAT=CV_MOP_BLACKHAT };
00360 
00362 CV_EXPORTS Ptr<BaseRowFilter> getMorphologyRowFilter(int op, int type, int ksize, int anchor=-1);
00364 CV_EXPORTS Ptr<BaseColumnFilter> getMorphologyColumnFilter(int op, int type, int ksize, int anchor=-1);
00366 CV_EXPORTS Ptr<BaseFilter> getMorphologyFilter(int op, int type, InputArray kernel,
00367                                                Point anchor=Point(-1,-1));
00368 
00370 static inline Scalar morphologyDefaultBorderValue() { return Scalar::all(DBL_MAX); }
00371 
00373 CV_EXPORTS Ptr<FilterEngine> createMorphologyFilter(int op, int type, InputArray kernel,
00374                     Point anchor=Point(-1,-1), int rowBorderType=BORDER_CONSTANT,
00375                     int columnBorderType=-1,
00376                     const Scalar& borderValue=morphologyDefaultBorderValue());
00377 
00379 enum { MORPH_RECT=0, MORPH_CROSS=1, MORPH_ELLIPSE=2 };
00381 CV_EXPORTS_W Mat getStructuringElement(int shape, Size ksize, Point anchor=Point(-1,-1));
00382 
00383 template<> CV_EXPORTS void Ptr<IplConvKernel>::delete_obj();
00384 
00386 CV_EXPORTS_W void copyMakeBorder( InputArray src, OutputArray dst,
00387                                 int top, int bottom, int left, int right,
00388                                 int borderType, const Scalar& value=Scalar() );
00389 
00391 CV_EXPORTS_W void medianBlur( InputArray src, OutputArray dst, int ksize );
00393 CV_EXPORTS_W void GaussianBlur( InputArray src,
00394                                                OutputArray dst, Size ksize,
00395                                                double sigmaX, double sigmaY=0,
00396                                                int borderType=BORDER_DEFAULT );
00398 CV_EXPORTS_W void bilateralFilter( InputArray src, OutputArray dst, int d,
00399                                    double sigmaColor, double sigmaSpace,
00400                                    int borderType=BORDER_DEFAULT );
00402 CV_EXPORTS_W void boxFilter( InputArray src, OutputArray dst, int ddepth,
00403                              Size ksize, Point anchor=Point(-1,-1),
00404                              bool normalize=true,
00405                              int borderType=BORDER_DEFAULT );
00407 CV_EXPORTS_W void blur( InputArray src, OutputArray dst,
00408                         Size ksize, Point anchor=Point(-1,-1),
00409                         int borderType=BORDER_DEFAULT );
00410 
00412 CV_EXPORTS_W void filter2D( InputArray src, OutputArray dst, int ddepth,
00413                             InputArray kernel, Point anchor=Point(-1,-1),
00414                             double delta=0, int borderType=BORDER_DEFAULT );
00415 
00417 CV_EXPORTS_W void sepFilter2D( InputArray src, OutputArray dst, int ddepth,
00418                                InputArray kernelX, InputArray kernelY,
00419                                Point anchor=Point(-1,-1),
00420                                double delta=0, int borderType=BORDER_DEFAULT );
00421 
00423 CV_EXPORTS_W void Sobel( InputArray src, OutputArray dst, int ddepth,
00424                          int dx, int dy, int ksize=3,
00425                          double scale=1, double delta=0,
00426                          int borderType=BORDER_DEFAULT );
00427 
00429 CV_EXPORTS_W void Scharr( InputArray src, OutputArray dst, int ddepth,
00430                           int dx, int dy, double scale=1, double delta=0,
00431                           int borderType=BORDER_DEFAULT );
00432 
00434 CV_EXPORTS_W void Laplacian( InputArray src, OutputArray dst, int ddepth,
00435                              int ksize=1, double scale=1, double delta=0,
00436                              int borderType=BORDER_DEFAULT );
00437 
00439 CV_EXPORTS_W void Canny( InputArray image, OutputArray edges,
00440                          double threshold1, double threshold2,
00441                          int apertureSize=3, bool L2gradient=false );
00442 
00444 CV_EXPORTS_W void cornerMinEigenVal( InputArray src, OutputArray dst,
00445                                    int blockSize, int ksize=3,
00446                                    int borderType=BORDER_DEFAULT );
00447 
00449 CV_EXPORTS_W void cornerHarris( InputArray src, OutputArray dst, int blockSize,
00450                                 int ksize, double k,
00451                                 int borderType=BORDER_DEFAULT );
00452 
00453 // low-level function for computing eigenvalues and eigenvectors of 2x2 matrices
00454 CV_EXPORTS void eigen2x2( const float* a, float* e, int n );
00455 
00457 CV_EXPORTS_W void cornerEigenValsAndVecs( InputArray src, OutputArray dst,
00458                                           int blockSize, int ksize,
00459                                           int borderType=BORDER_DEFAULT );
00460 
00462 CV_EXPORTS_W void preCornerDetect( InputArray src, OutputArray dst, int ksize,
00463                                    int borderType=BORDER_DEFAULT );
00464 
00466 CV_EXPORTS_W void cornerSubPix( InputArray image, InputOutputArray corners,
00467                                 Size winSize, Size zeroZone,
00468                                 TermCriteria criteria );
00469 
00471 CV_EXPORTS_W void goodFeaturesToTrack( InputArray image, OutputArray corners,
00472                                      int maxCorners, double qualityLevel, double minDistance,
00473                                      InputArray mask=noArray(), int blockSize=3,
00474                                      bool useHarrisDetector=false, double k=0.04 );
00475 
00477 CV_EXPORTS_W void HoughLines( InputArray image, OutputArray lines,
00478                               double rho, double theta, int threshold,
00479                               double srn=0, double stn=0 );
00480 
00482 CV_EXPORTS_W void HoughLinesP( InputArray image, OutputArray lines,
00483                                double rho, double theta, int threshold,
00484                                double minLineLength=0, double maxLineGap=0 );
00485 
00487 CV_EXPORTS_W void HoughCircles( InputArray image, OutputArray circles,
00488                                int method, double dp, double minDist,
00489                                double param1=100, double param2=100,
00490                                int minRadius=0, int maxRadius=0 );
00491 
00492 enum
00493 {
00494     GHT_POSITION = 0,
00495     GHT_SCALE = 1,
00496     GHT_ROTATION = 2
00497 };
00498 
00502 class CV_EXPORTS GeneralizedHough : public Algorithm
00503 {
00504 public:
00505     static Ptr<GeneralizedHough> create(int method);
00506 
00507     virtual ~GeneralizedHough();
00508 
00510     void setTemplate(InputArray templ, int cannyThreshold = 100, Point templCenter = Point(-1, -1));
00511     void setTemplate(InputArray edges, InputArray dx, InputArray dy, Point templCenter = Point(-1, -1));
00512 
00514     void detect(InputArray image, OutputArray positions, OutputArray votes = cv::noArray(), int cannyThreshold = 100);
00515     void detect(InputArray edges, InputArray dx, InputArray dy, OutputArray positions, OutputArray votes = cv::noArray());
00516 
00517     void release();
00518 
00519 protected:
00520     virtual void setTemplateImpl(const Mat& edges, const Mat& dx, const Mat& dy, Point templCenter) = 0;
00521     virtual void detectImpl(const Mat& edges, const Mat& dx, const Mat& dy, OutputArray positions, OutputArray votes) = 0;
00522     virtual void releaseImpl() = 0;
00523 
00524 private:
00525     Mat edges_, dx_, dy_;
00526 };
00527 
00529 CV_EXPORTS_W void erode( InputArray src, OutputArray dst, InputArray kernel,
00530                          Point anchor=Point(-1,-1), int iterations=1,
00531                          int borderType=BORDER_CONSTANT,
00532                          const Scalar& borderValue=morphologyDefaultBorderValue() );
00533 
00535 CV_EXPORTS_W void dilate( InputArray src, OutputArray dst, InputArray kernel,
00536                           Point anchor=Point(-1,-1), int iterations=1,
00537                           int borderType=BORDER_CONSTANT,
00538                           const Scalar& borderValue=morphologyDefaultBorderValue() );
00539 
00541 CV_EXPORTS_W void morphologyEx( InputArray src, OutputArray dst,
00542                                 int op, InputArray kernel,
00543                                 Point anchor=Point(-1,-1), int iterations=1,
00544                                 int borderType=BORDER_CONSTANT,
00545                                 const Scalar& borderValue=morphologyDefaultBorderValue() );
00546 
00548 enum
00549 {
00550     INTER_NEAREST=CV_INTER_NN, 
00551     INTER_LINEAR=CV_INTER_LINEAR, 
00552     INTER_CUBIC=CV_INTER_CUBIC, 
00553     INTER_AREA=CV_INTER_AREA, 
00554     INTER_LANCZOS4=CV_INTER_LANCZOS4, 
00555     INTER_MAX=7,
00556     WARP_INVERSE_MAP=CV_WARP_INVERSE_MAP
00557 };
00558 
00560 CV_EXPORTS_W void resize( InputArray src, OutputArray dst,
00561                           Size dsize, double fx=0, double fy=0,
00562                           int interpolation=INTER_LINEAR );
00563 
00565 CV_EXPORTS_W void warpAffine( InputArray src, OutputArray dst,
00566                               InputArray M, Size dsize,
00567                               int flags=INTER_LINEAR,
00568                               int borderMode=BORDER_CONSTANT,
00569                               const Scalar& borderValue=Scalar());
00570 
00572 CV_EXPORTS_W void warpPerspective( InputArray src, OutputArray dst,
00573                                    InputArray M, Size dsize,
00574                                    int flags=INTER_LINEAR,
00575                                    int borderMode=BORDER_CONSTANT,
00576                                    const Scalar& borderValue=Scalar());
00577 
00578 enum
00579 {
00580     INTER_BITS=5, INTER_BITS2=INTER_BITS*2,
00581     INTER_TAB_SIZE=(1<<INTER_BITS),
00582     INTER_TAB_SIZE2=INTER_TAB_SIZE*INTER_TAB_SIZE
00583 };
00584 
00586 CV_EXPORTS_W void remap( InputArray src, OutputArray dst,
00587                          InputArray map1, InputArray map2,
00588                          int interpolation, int borderMode=BORDER_CONSTANT,
00589                          const Scalar& borderValue=Scalar());
00590 
00592 CV_EXPORTS_W void convertMaps( InputArray map1, InputArray map2,
00593                                OutputArray dstmap1, OutputArray dstmap2,
00594                                int dstmap1type, bool nninterpolation=false );
00595 
00597 CV_EXPORTS_W Mat getRotationMatrix2D( Point2f center, double angle, double scale );
00599 CV_EXPORTS Mat getPerspectiveTransform( const Point2f src[], const Point2f dst[] );
00601 CV_EXPORTS Mat getAffineTransform( const Point2f src[], const Point2f dst[] );
00603 CV_EXPORTS_W void invertAffineTransform( InputArray M, OutputArray iM );
00604 
00605 CV_EXPORTS_W Mat getPerspectiveTransform( InputArray src, InputArray dst );
00606 CV_EXPORTS_W Mat getAffineTransform( InputArray src, InputArray dst );
00607 
00609 CV_EXPORTS_W void getRectSubPix( InputArray image, Size patchSize,
00610                                  Point2f center, OutputArray patch, int patchType=-1 );
00611 
00613 CV_EXPORTS_W void integral( InputArray src, OutputArray sum, int sdepth=-1 );
00614 
00616 CV_EXPORTS_AS(integral2) void integral( InputArray src, OutputArray sum,
00617                                         OutputArray sqsum, int sdepth=-1 );
00619 CV_EXPORTS_AS(integral3) void integral( InputArray src, OutputArray sum,
00620                                         OutputArray sqsum, OutputArray tilted,
00621                                         int sdepth=-1 );
00622 
00624 CV_EXPORTS_W void accumulate( InputArray src, InputOutputArray dst,
00625                               InputArray mask=noArray() );
00627 CV_EXPORTS_W void accumulateSquare( InputArray src, InputOutputArray dst,
00628                                     InputArray mask=noArray() );
00630 CV_EXPORTS_W void accumulateProduct( InputArray src1, InputArray src2,
00631                                      InputOutputArray dst, InputArray mask=noArray() );
00633 CV_EXPORTS_W void accumulateWeighted( InputArray src, InputOutputArray dst,
00634                                       double alpha, InputArray mask=noArray() );
00635 
00637 CV_EXPORTS_W double PSNR(InputArray src1, InputArray src2);
00638 
00639 CV_EXPORTS_W Point2d phaseCorrelate(InputArray src1, InputArray src2,
00640                                   InputArray window = noArray());
00641 CV_EXPORTS_W Point2d phaseCorrelateRes(InputArray src1, InputArray src2,
00642                                     InputArray window, CV_OUT double* response = 0);
00643 CV_EXPORTS_W void createHanningWindow(OutputArray dst, Size winSize, int type);
00644 
00646 enum { THRESH_BINARY=CV_THRESH_BINARY, THRESH_BINARY_INV=CV_THRESH_BINARY_INV,
00647        THRESH_TRUNC=CV_THRESH_TRUNC, THRESH_TOZERO=CV_THRESH_TOZERO,
00648        THRESH_TOZERO_INV=CV_THRESH_TOZERO_INV, THRESH_MASK=CV_THRESH_MASK,
00649        THRESH_OTSU=CV_THRESH_OTSU };
00650 
00652 CV_EXPORTS_W double threshold( InputArray src, OutputArray dst,
00653                                double thresh, double maxval, int type );
00654 
00656 enum { ADAPTIVE_THRESH_MEAN_C=0, ADAPTIVE_THRESH_GAUSSIAN_C=1 };
00657 
00659 CV_EXPORTS_W void adaptiveThreshold( InputArray src, OutputArray dst,
00660                                      double maxValue, int adaptiveMethod,
00661                                      int thresholdType, int blockSize, double C );
00662 
00664 CV_EXPORTS_W void pyrDown( InputArray src, OutputArray dst,
00665                            const Size& dstsize=Size(), int borderType=BORDER_DEFAULT );
00667 CV_EXPORTS_W void pyrUp( InputArray src, OutputArray dst,
00668                          const Size& dstsize=Size(), int borderType=BORDER_DEFAULT );
00669 
00671 CV_EXPORTS void buildPyramid( InputArray src, OutputArrayOfArrays dst,
00672                               int maxlevel, int borderType=BORDER_DEFAULT );
00673 
00675 CV_EXPORTS_W void undistort( InputArray src, OutputArray dst,
00676                              InputArray cameraMatrix,
00677                              InputArray distCoeffs,
00678                              InputArray newCameraMatrix=noArray() );
00679 
00681 CV_EXPORTS_W void initUndistortRectifyMap( InputArray cameraMatrix, InputArray distCoeffs,
00682                            InputArray R, InputArray newCameraMatrix,
00683                            Size size, int m1type, OutputArray map1, OutputArray map2 );
00684 
00685 enum
00686 {
00687     PROJ_SPHERICAL_ORTHO = 0,
00688     PROJ_SPHERICAL_EQRECT = 1
00689 };
00690 
00692 CV_EXPORTS_W float initWideAngleProjMap( InputArray cameraMatrix, InputArray distCoeffs,
00693                                          Size imageSize, int destImageWidth,
00694                                          int m1type, OutputArray map1, OutputArray map2,
00695                                          int projType=PROJ_SPHERICAL_EQRECT, double alpha=0);
00696 
00698 CV_EXPORTS_W Mat getDefaultNewCameraMatrix( InputArray cameraMatrix, Size imgsize=Size(),
00699                                             bool centerPrincipalPoint=false );
00700 
00702 CV_EXPORTS_W void undistortPoints( InputArray src, OutputArray dst,
00703                                    InputArray cameraMatrix, InputArray distCoeffs,
00704                                    InputArray R=noArray(), InputArray P=noArray());
00705 
00706 template<> CV_EXPORTS void Ptr<CvHistogram>::delete_obj();
00707 
00709 CV_EXPORTS void calcHist( const Mat* images, int nimages,
00710                           const int* channels, InputArray mask,
00711                           OutputArray hist, int dims, const int* histSize,
00712                           const float** ranges, bool uniform=true, bool accumulate=false );
00713 
00715 CV_EXPORTS void calcHist( const Mat* images, int nimages,
00716                           const int* channels, InputArray mask,
00717                           SparseMat& hist, int dims,
00718                           const int* histSize, const float** ranges,
00719                           bool uniform=true, bool accumulate=false );
00720 
00721 CV_EXPORTS_W void calcHist( InputArrayOfArrays images,
00722                             const vector<int>& channels,
00723                             InputArray mask, OutputArray hist,
00724                             const vector<int>& histSize,
00725                             const vector<float>& ranges,
00726                             bool accumulate=false );
00727 
00729 CV_EXPORTS void calcBackProject( const Mat* images, int nimages,
00730                                  const int* channels, InputArray hist,
00731                                  OutputArray backProject, const float** ranges,
00732                                  double scale=1, bool uniform=true );
00733 
00735 CV_EXPORTS void calcBackProject( const Mat* images, int nimages,
00736                                  const int* channels, const SparseMat& hist,
00737                                  OutputArray backProject, const float** ranges,
00738                                  double scale=1, bool uniform=true );
00739 
00740 CV_EXPORTS_W void calcBackProject( InputArrayOfArrays images, const vector<int>& channels,
00741                                    InputArray hist, OutputArray dst,
00742                                    const vector<float>& ranges,
00743                                    double scale );
00744 
00745 /*CV_EXPORTS void calcBackProjectPatch( const Mat* images, int nimages, const int* channels,
00746                                       InputArray hist, OutputArray dst, Size patchSize,
00747                                       int method, double factor=1 );
00748 
00749 CV_EXPORTS_W void calcBackProjectPatch( InputArrayOfArrays images, const vector<int>& channels,
00750                                         InputArray hist, OutputArray dst, Size patchSize,
00751                                         int method, double factor=1 );*/
00752 
00754 CV_EXPORTS_W double compareHist( InputArray H1, InputArray H2, int method );
00755 
00757 CV_EXPORTS double compareHist( const SparseMat& H1, const SparseMat& H2, int method );
00758 
00760 CV_EXPORTS_W void equalizeHist( InputArray src, OutputArray dst );
00761 
00762 CV_EXPORTS float EMD( InputArray signature1, InputArray signature2,
00763                       int distType, InputArray cost=noArray(),
00764                       float* lowerBound=0, OutputArray flow=noArray() );
00765 
00767 CV_EXPORTS_W void watershed( InputArray image, InputOutputArray markers );
00768 
00770 CV_EXPORTS_W void pyrMeanShiftFiltering( InputArray src, OutputArray dst,
00771                                          double sp, double sr, int maxLevel=1,
00772                                          TermCriteria termcrit=TermCriteria(
00773                                             TermCriteria::MAX_ITER+TermCriteria::EPS,5,1) );
00774 
00776 enum
00777 {
00778     GC_BGD    = 0,  
00779     GC_FGD    = 1,  
00780     GC_PR_BGD = 2,  
00781     GC_PR_FGD = 3   
00782 };
00783 
00785 enum
00786 {
00787     GC_INIT_WITH_RECT  = 0,
00788     GC_INIT_WITH_MASK  = 1,
00789     GC_EVAL            = 2
00790 };
00791 
00793 CV_EXPORTS_W void grabCut( InputArray img, InputOutputArray mask, Rect rect,
00794                            InputOutputArray bgdModel, InputOutputArray fgdModel,
00795                            int iterCount, int mode = GC_EVAL );
00796 
00797 enum
00798 {
00799     DIST_LABEL_CCOMP = 0,
00800     DIST_LABEL_PIXEL = 1
00801 };
00802 
00804 CV_EXPORTS_AS(distanceTransformWithLabels) void distanceTransform( InputArray src, OutputArray dst,
00805                                      OutputArray labels, int distanceType, int maskSize,
00806                                      int labelType=DIST_LABEL_CCOMP );
00807 
00809 CV_EXPORTS_W void distanceTransform( InputArray src, OutputArray dst,
00810                                      int distanceType, int maskSize );
00811 
00812 enum { FLOODFILL_FIXED_RANGE = 1 << 16, FLOODFILL_MASK_ONLY = 1 << 17 };
00813 
00815 CV_EXPORTS int floodFill( InputOutputArray image,
00816                           Point seedPoint, Scalar newVal, CV_OUT Rect* rect=0,
00817                           Scalar loDiff=Scalar(), Scalar upDiff=Scalar(),
00818                           int flags=4 );
00819 
00821 CV_EXPORTS_W int floodFill( InputOutputArray image, InputOutputArray mask,
00822                             Point seedPoint, Scalar newVal, CV_OUT Rect* rect=0,
00823                             Scalar loDiff=Scalar(), Scalar upDiff=Scalar(),
00824                             int flags=4 );
00825 
00826 
00827 enum
00828 {
00829     COLOR_BGR2BGRA    =0,
00830     COLOR_RGB2RGBA    =COLOR_BGR2BGRA,
00831 
00832     COLOR_BGRA2BGR    =1,
00833     COLOR_RGBA2RGB    =COLOR_BGRA2BGR,
00834 
00835     COLOR_BGR2RGBA    =2,
00836     COLOR_RGB2BGRA    =COLOR_BGR2RGBA,
00837 
00838     COLOR_RGBA2BGR    =3,
00839     COLOR_BGRA2RGB    =COLOR_RGBA2BGR,
00840 
00841     COLOR_BGR2RGB     =4,
00842     COLOR_RGB2BGR     =COLOR_BGR2RGB,
00843 
00844     COLOR_BGRA2RGBA   =5,
00845     COLOR_RGBA2BGRA   =COLOR_BGRA2RGBA,
00846 
00847     COLOR_BGR2GRAY    =6,
00848     COLOR_RGB2GRAY    =7,
00849     COLOR_GRAY2BGR    =8,
00850     COLOR_GRAY2RGB    =COLOR_GRAY2BGR,
00851     COLOR_GRAY2BGRA   =9,
00852     COLOR_GRAY2RGBA   =COLOR_GRAY2BGRA,
00853     COLOR_BGRA2GRAY   =10,
00854     COLOR_RGBA2GRAY   =11,
00855 
00856     COLOR_BGR2BGR565  =12,
00857     COLOR_RGB2BGR565  =13,
00858     COLOR_BGR5652BGR  =14,
00859     COLOR_BGR5652RGB  =15,
00860     COLOR_BGRA2BGR565 =16,
00861     COLOR_RGBA2BGR565 =17,
00862     COLOR_BGR5652BGRA =18,
00863     COLOR_BGR5652RGBA =19,
00864 
00865     COLOR_GRAY2BGR565 =20,
00866     COLOR_BGR5652GRAY =21,
00867 
00868     COLOR_BGR2BGR555  =22,
00869     COLOR_RGB2BGR555  =23,
00870     COLOR_BGR5552BGR  =24,
00871     COLOR_BGR5552RGB  =25,
00872     COLOR_BGRA2BGR555 =26,
00873     COLOR_RGBA2BGR555 =27,
00874     COLOR_BGR5552BGRA =28,
00875     COLOR_BGR5552RGBA =29,
00876 
00877     COLOR_GRAY2BGR555 =30,
00878     COLOR_BGR5552GRAY =31,
00879 
00880     COLOR_BGR2XYZ     =32,
00881     COLOR_RGB2XYZ     =33,
00882     COLOR_XYZ2BGR     =34,
00883     COLOR_XYZ2RGB     =35,
00884 
00885     COLOR_BGR2YCrCb   =36,
00886     COLOR_RGB2YCrCb   =37,
00887     COLOR_YCrCb2BGR   =38,
00888     COLOR_YCrCb2RGB   =39,
00889 
00890     COLOR_BGR2HSV     =40,
00891     COLOR_RGB2HSV     =41,
00892 
00893     COLOR_BGR2Lab     =44,
00894     COLOR_RGB2Lab     =45,
00895 
00896     COLOR_BayerBG2BGR =46,
00897     COLOR_BayerGB2BGR =47,
00898     COLOR_BayerRG2BGR =48,
00899     COLOR_BayerGR2BGR =49,
00900 
00901     COLOR_BayerBG2RGB =COLOR_BayerRG2BGR,
00902     COLOR_BayerGB2RGB =COLOR_BayerGR2BGR,
00903     COLOR_BayerRG2RGB =COLOR_BayerBG2BGR,
00904     COLOR_BayerGR2RGB =COLOR_BayerGB2BGR,
00905 
00906     COLOR_BGR2Luv     =50,
00907     COLOR_RGB2Luv     =51,
00908     COLOR_BGR2HLS     =52,
00909     COLOR_RGB2HLS     =53,
00910 
00911     COLOR_HSV2BGR     =54,
00912     COLOR_HSV2RGB     =55,
00913 
00914     COLOR_Lab2BGR     =56,
00915     COLOR_Lab2RGB     =57,
00916     COLOR_Luv2BGR     =58,
00917     COLOR_Luv2RGB     =59,
00918     COLOR_HLS2BGR     =60,
00919     COLOR_HLS2RGB     =61,
00920 
00921     COLOR_BayerBG2BGR_VNG =62,
00922     COLOR_BayerGB2BGR_VNG =63,
00923     COLOR_BayerRG2BGR_VNG =64,
00924     COLOR_BayerGR2BGR_VNG =65,
00925 
00926     COLOR_BayerBG2RGB_VNG =COLOR_BayerRG2BGR_VNG,
00927     COLOR_BayerGB2RGB_VNG =COLOR_BayerGR2BGR_VNG,
00928     COLOR_BayerRG2RGB_VNG =COLOR_BayerBG2BGR_VNG,
00929     COLOR_BayerGR2RGB_VNG =COLOR_BayerGB2BGR_VNG,
00930 
00931     COLOR_BGR2HSV_FULL = 66,
00932     COLOR_RGB2HSV_FULL = 67,
00933     COLOR_BGR2HLS_FULL = 68,
00934     COLOR_RGB2HLS_FULL = 69,
00935 
00936     COLOR_HSV2BGR_FULL = 70,
00937     COLOR_HSV2RGB_FULL = 71,
00938     COLOR_HLS2BGR_FULL = 72,
00939     COLOR_HLS2RGB_FULL = 73,
00940 
00941     COLOR_LBGR2Lab     = 74,
00942     COLOR_LRGB2Lab     = 75,
00943     COLOR_LBGR2Luv     = 76,
00944     COLOR_LRGB2Luv     = 77,
00945 
00946     COLOR_Lab2LBGR     = 78,
00947     COLOR_Lab2LRGB     = 79,
00948     COLOR_Luv2LBGR     = 80,
00949     COLOR_Luv2LRGB     = 81,
00950 
00951     COLOR_BGR2YUV      = 82,
00952     COLOR_RGB2YUV      = 83,
00953     COLOR_YUV2BGR      = 84,
00954     COLOR_YUV2RGB      = 85,
00955 
00956     COLOR_BayerBG2GRAY = 86,
00957     COLOR_BayerGB2GRAY = 87,
00958     COLOR_BayerRG2GRAY = 88,
00959     COLOR_BayerGR2GRAY = 89,
00960 
00961     //YUV 4:2:0 formats family
00962     COLOR_YUV2RGB_NV12 = 90,
00963     COLOR_YUV2BGR_NV12 = 91,
00964     COLOR_YUV2RGB_NV21 = 92,
00965     COLOR_YUV2BGR_NV21 = 93,
00966     COLOR_YUV420sp2RGB = COLOR_YUV2RGB_NV21,
00967     COLOR_YUV420sp2BGR = COLOR_YUV2BGR_NV21,
00968 
00969     COLOR_YUV2RGBA_NV12 = 94,
00970     COLOR_YUV2BGRA_NV12 = 95,
00971     COLOR_YUV2RGBA_NV21 = 96,
00972     COLOR_YUV2BGRA_NV21 = 97,
00973     COLOR_YUV420sp2RGBA = COLOR_YUV2RGBA_NV21,
00974     COLOR_YUV420sp2BGRA = COLOR_YUV2BGRA_NV21,
00975 
00976     COLOR_YUV2RGB_YV12 = 98,
00977     COLOR_YUV2BGR_YV12 = 99,
00978     COLOR_YUV2RGB_IYUV = 100,
00979     COLOR_YUV2BGR_IYUV = 101,
00980     COLOR_YUV2RGB_I420 = COLOR_YUV2RGB_IYUV,
00981     COLOR_YUV2BGR_I420 = COLOR_YUV2BGR_IYUV,
00982     COLOR_YUV420p2RGB = COLOR_YUV2RGB_YV12,
00983     COLOR_YUV420p2BGR = COLOR_YUV2BGR_YV12,
00984 
00985     COLOR_YUV2RGBA_YV12 = 102,
00986     COLOR_YUV2BGRA_YV12 = 103,
00987     COLOR_YUV2RGBA_IYUV = 104,
00988     COLOR_YUV2BGRA_IYUV = 105,
00989     COLOR_YUV2RGBA_I420 = COLOR_YUV2RGBA_IYUV,
00990     COLOR_YUV2BGRA_I420 = COLOR_YUV2BGRA_IYUV,
00991     COLOR_YUV420p2RGBA = COLOR_YUV2RGBA_YV12,
00992     COLOR_YUV420p2BGRA = COLOR_YUV2BGRA_YV12,
00993 
00994     COLOR_YUV2GRAY_420 = 106,
00995     COLOR_YUV2GRAY_NV21 = COLOR_YUV2GRAY_420,
00996     COLOR_YUV2GRAY_NV12 = COLOR_YUV2GRAY_420,
00997     COLOR_YUV2GRAY_YV12 = COLOR_YUV2GRAY_420,
00998     COLOR_YUV2GRAY_IYUV = COLOR_YUV2GRAY_420,
00999     COLOR_YUV2GRAY_I420 = COLOR_YUV2GRAY_420,
01000     COLOR_YUV420sp2GRAY = COLOR_YUV2GRAY_420,
01001     COLOR_YUV420p2GRAY = COLOR_YUV2GRAY_420,
01002 
01003     //YUV 4:2:2 formats family
01004     COLOR_YUV2RGB_UYVY = 107,
01005     COLOR_YUV2BGR_UYVY = 108,
01006     //COLOR_YUV2RGB_VYUY = 109,
01007     //COLOR_YUV2BGR_VYUY = 110,
01008     COLOR_YUV2RGB_Y422 = COLOR_YUV2RGB_UYVY,
01009     COLOR_YUV2BGR_Y422 = COLOR_YUV2BGR_UYVY,
01010     COLOR_YUV2RGB_UYNV = COLOR_YUV2RGB_UYVY,
01011     COLOR_YUV2BGR_UYNV = COLOR_YUV2BGR_UYVY,
01012 
01013     COLOR_YUV2RGBA_UYVY = 111,
01014     COLOR_YUV2BGRA_UYVY = 112,
01015     //COLOR_YUV2RGBA_VYUY = 113,
01016     //COLOR_YUV2BGRA_VYUY = 114,
01017     COLOR_YUV2RGBA_Y422 = COLOR_YUV2RGBA_UYVY,
01018     COLOR_YUV2BGRA_Y422 = COLOR_YUV2BGRA_UYVY,
01019     COLOR_YUV2RGBA_UYNV = COLOR_YUV2RGBA_UYVY,
01020     COLOR_YUV2BGRA_UYNV = COLOR_YUV2BGRA_UYVY,
01021 
01022     COLOR_YUV2RGB_YUY2 = 115,
01023     COLOR_YUV2BGR_YUY2 = 116,
01024     COLOR_YUV2RGB_YVYU = 117,
01025     COLOR_YUV2BGR_YVYU = 118,
01026     COLOR_YUV2RGB_YUYV = COLOR_YUV2RGB_YUY2,
01027     COLOR_YUV2BGR_YUYV = COLOR_YUV2BGR_YUY2,
01028     COLOR_YUV2RGB_YUNV = COLOR_YUV2RGB_YUY2,
01029     COLOR_YUV2BGR_YUNV = COLOR_YUV2BGR_YUY2,
01030 
01031     COLOR_YUV2RGBA_YUY2 = 119,
01032     COLOR_YUV2BGRA_YUY2 = 120,
01033     COLOR_YUV2RGBA_YVYU = 121,
01034     COLOR_YUV2BGRA_YVYU = 122,
01035     COLOR_YUV2RGBA_YUYV = COLOR_YUV2RGBA_YUY2,
01036     COLOR_YUV2BGRA_YUYV = COLOR_YUV2BGRA_YUY2,
01037     COLOR_YUV2RGBA_YUNV = COLOR_YUV2RGBA_YUY2,
01038     COLOR_YUV2BGRA_YUNV = COLOR_YUV2BGRA_YUY2,
01039 
01040     COLOR_YUV2GRAY_UYVY = 123,
01041     COLOR_YUV2GRAY_YUY2 = 124,
01042     //COLOR_YUV2GRAY_VYUY = COLOR_YUV2GRAY_UYVY,
01043     COLOR_YUV2GRAY_Y422 = COLOR_YUV2GRAY_UYVY,
01044     COLOR_YUV2GRAY_UYNV = COLOR_YUV2GRAY_UYVY,
01045     COLOR_YUV2GRAY_YVYU = COLOR_YUV2GRAY_YUY2,
01046     COLOR_YUV2GRAY_YUYV = COLOR_YUV2GRAY_YUY2,
01047     COLOR_YUV2GRAY_YUNV = COLOR_YUV2GRAY_YUY2,
01048 
01049     // alpha premultiplication
01050     COLOR_RGBA2mRGBA = 125,
01051     COLOR_mRGBA2RGBA = 126,
01052 
01053     COLOR_COLORCVT_MAX  = 127
01054 };
01055 
01056 
01058 CV_EXPORTS_W void cvtColor( InputArray src, OutputArray dst, int code, int dstCn=0 );
01059 
01061 class CV_EXPORTS_W_MAP Moments
01062 {
01063 public:
01065     Moments();
01067     Moments(double m00, double m10, double m01, double m20, double m11,
01068             double m02, double m30, double m21, double m12, double m03 );
01070     Moments( const CvMoments& moments );
01072     operator CvMoments() const;
01073 
01075     CV_PROP_RW double  m00, m10, m01, m20, m11, m02, m30, m21, m12, m03;
01077     CV_PROP_RW double  mu20, mu11, mu02, mu30, mu21, mu12, mu03;
01079     CV_PROP_RW double  nu20, nu11, nu02, nu30, nu21, nu12, nu03;
01080 };
01081 
01083 CV_EXPORTS_W Moments moments( InputArray array, bool binaryImage=false );
01084 
01086 CV_EXPORTS void HuMoments( const Moments& moments, double hu[7] );
01087 CV_EXPORTS_W void HuMoments( const Moments& m, CV_OUT OutputArray hu );
01088 
01090 enum { TM_SQDIFF=0, TM_SQDIFF_NORMED=1, TM_CCORR=2, TM_CCORR_NORMED=3, TM_CCOEFF=4, TM_CCOEFF_NORMED=5 };
01091 
01093 CV_EXPORTS_W void matchTemplate( InputArray image, InputArray templ,
01094                                  OutputArray result, int method );
01095 
01097 enum
01098 {
01099     RETR_EXTERNAL=CV_RETR_EXTERNAL, 
01100     RETR_LIST=CV_RETR_LIST, 
01101     RETR_CCOMP=CV_RETR_CCOMP, 
01102     RETR_TREE=CV_RETR_TREE, 
01103     RETR_FLOODFILL=CV_RETR_FLOODFILL
01104 };
01105 
01107 enum
01108 {
01109     CHAIN_APPROX_NONE=CV_CHAIN_APPROX_NONE,
01110     CHAIN_APPROX_SIMPLE=CV_CHAIN_APPROX_SIMPLE,
01111     CHAIN_APPROX_TC89_L1=CV_CHAIN_APPROX_TC89_L1,
01112     CHAIN_APPROX_TC89_KCOS=CV_CHAIN_APPROX_TC89_KCOS
01113 };
01114 
01116 CV_EXPORTS_W void findContours( InputOutputArray image, OutputArrayOfArrays contours,
01117                               OutputArray hierarchy, int mode,
01118                               int method, Point offset=Point());
01119 
01121 CV_EXPORTS void findContours( InputOutputArray image, OutputArrayOfArrays contours,
01122                               int mode, int method, Point offset=Point());
01123 
01125 CV_EXPORTS_W void drawContours( InputOutputArray image, InputArrayOfArrays contours,
01126                               int contourIdx, const Scalar& color,
01127                               int thickness=1, int lineType=8,
01128                               InputArray hierarchy=noArray(),
01129                               int maxLevel=INT_MAX, Point offset=Point() );
01130 
01132 CV_EXPORTS_W void approxPolyDP( InputArray curve,
01133                                 OutputArray approxCurve,
01134                                 double epsilon, bool closed );
01135 
01137 CV_EXPORTS_W double arcLength( InputArray curve, bool closed );
01139 CV_EXPORTS_W Rect boundingRect( InputArray points );
01141 CV_EXPORTS_W double contourArea( InputArray contour, bool oriented=false );
01143 CV_EXPORTS_W RotatedRect minAreaRect( InputArray points );
01145 CV_EXPORTS_W void minEnclosingCircle( InputArray points,
01146                                       CV_OUT Point2f& center, CV_OUT float& radius );
01148 CV_EXPORTS_W double matchShapes( InputArray contour1, InputArray contour2,
01149                                  int method, double parameter );
01151 CV_EXPORTS_W void convexHull( InputArray points, OutputArray hull,
01152                               bool clockwise=false, bool returnPoints=true );
01154 CV_EXPORTS_W void convexityDefects( InputArray contour, InputArray convexhull, OutputArray convexityDefects );
01155 
01157 CV_EXPORTS_W bool isContourConvex( InputArray contour );
01158 
01160 CV_EXPORTS_W float intersectConvexConvex( InputArray _p1, InputArray _p2,
01161                                           OutputArray _p12, bool handleNested=true );
01162 
01164 CV_EXPORTS_W RotatedRect fitEllipse( InputArray points );
01165 
01167 CV_EXPORTS_W void fitLine( InputArray points, OutputArray line, int distType,
01168                            double param, double reps, double aeps );
01170 CV_EXPORTS_W double pointPolygonTest( InputArray contour, Point2f pt, bool measureDist );
01171 
01172 
01173 class CV_EXPORTS_W Subdiv2D
01174 {
01175 public:
01176     enum
01177     {
01178         PTLOC_ERROR = -2,
01179         PTLOC_OUTSIDE_RECT = -1,
01180         PTLOC_INSIDE = 0,
01181         PTLOC_VERTEX = 1,
01182         PTLOC_ON_EDGE = 2
01183     };
01184 
01185     enum
01186     {
01187         NEXT_AROUND_ORG   = 0x00,
01188         NEXT_AROUND_DST   = 0x22,
01189         PREV_AROUND_ORG   = 0x11,
01190         PREV_AROUND_DST   = 0x33,
01191         NEXT_AROUND_LEFT  = 0x13,
01192         NEXT_AROUND_RIGHT = 0x31,
01193         PREV_AROUND_LEFT  = 0x20,
01194         PREV_AROUND_RIGHT = 0x02
01195     };
01196 
01197     CV_WRAP Subdiv2D();
01198     CV_WRAP Subdiv2D(Rect rect);
01199     CV_WRAP void initDelaunay(Rect rect);
01200 
01201     CV_WRAP int insert(Point2f pt);
01202     CV_WRAP void insert(const vector<Point2f>& ptvec);
01203     CV_WRAP int locate(Point2f pt, CV_OUT int& edge, CV_OUT int& vertex);
01204 
01205     CV_WRAP int findNearest(Point2f pt, CV_OUT Point2f* nearestPt=0);
01206     CV_WRAP void getEdgeList(CV_OUT vector<Vec4f>& edgeList) const;
01207     CV_WRAP void getTriangleList(CV_OUT vector<Vec6f>& triangleList) const;
01208     CV_WRAP void getVoronoiFacetList(const vector<int>& idx, CV_OUT vector<vector<Point2f> >& facetList,
01209                                      CV_OUT vector<Point2f>& facetCenters);
01210 
01211     CV_WRAP Point2f getVertex(int vertex, CV_OUT int* firstEdge=0) const;
01212 
01213     CV_WRAP int getEdge( int edge, int nextEdgeType ) const;
01214     CV_WRAP int nextEdge(int edge) const;
01215     CV_WRAP int rotateEdge(int edge, int rotate) const;
01216     CV_WRAP int symEdge(int edge) const;
01217     CV_WRAP int edgeOrg(int edge, CV_OUT Point2f* orgpt=0) const;
01218     CV_WRAP int edgeDst(int edge, CV_OUT Point2f* dstpt=0) const;
01219 
01220 protected:
01221     int newEdge();
01222     void deleteEdge(int edge);
01223     int newPoint(Point2f pt, bool isvirtual, int firstEdge=0);
01224     void deletePoint(int vtx);
01225     void setEdgePoints( int edge, int orgPt, int dstPt );
01226     void splice( int edgeA, int edgeB );
01227     int connectEdges( int edgeA, int edgeB );
01228     void swapEdges( int edge );
01229     int isRightOf(Point2f pt, int edge) const;
01230     void calcVoronoi();
01231     void clearVoronoi();
01232     void checkSubdiv() const;
01233 
01234     struct CV_EXPORTS Vertex
01235     {
01236         Vertex();
01237         Vertex(Point2f pt, bool _isvirtual, int _firstEdge=0);
01238         bool isvirtual() const;
01239         bool isfree() const;
01240         int firstEdge;
01241         int type;
01242         Point2f pt;
01243     };
01244     struct CV_EXPORTS QuadEdge
01245     {
01246         QuadEdge();
01247         QuadEdge(int edgeidx);
01248         bool isfree() const;
01249         int next[4];
01250         int pt[4];
01251     };
01252 
01253     vector<Vertex> vtx;
01254     vector<QuadEdge> qedges;
01255     int freeQEdge;
01256     int freePoint;
01257     bool validGeometry;
01258 
01259     int recentEdge;
01260     Point2f topLeft;
01261     Point2f bottomRight;
01262 };
01263 
01264 }
01265 
01266 #endif /* __cplusplus */
01267 
01268 #endif
01269 
01270 /* End of file. */