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);
00351 enum { MORPH_ERODE=CV_MOP_ERODE, MORPH_DILATE=CV_MOP_DILATE,
00352        MORPH_OPEN=CV_MOP_OPEN, MORPH_CLOSE=CV_MOP_CLOSE,
00353        MORPH_GRADIENT=CV_MOP_GRADIENT, MORPH_TOPHAT=CV_MOP_TOPHAT,
00354        MORPH_BLACKHAT=CV_MOP_BLACKHAT };
00355 
00357 CV_EXPORTS Ptr<BaseRowFilter> getMorphologyRowFilter(int op, int type, int ksize, int anchor=-1);
00359 CV_EXPORTS Ptr<BaseColumnFilter> getMorphologyColumnFilter(int op, int type, int ksize, int anchor=-1);
00361 CV_EXPORTS Ptr<BaseFilter> getMorphologyFilter(int op, int type, InputArray kernel,
00362                                                Point anchor=Point(-1,-1));
00363     
00365 static inline Scalar morphologyDefaultBorderValue() { return Scalar::all(DBL_MAX); }
00366 
00368 CV_EXPORTS Ptr<FilterEngine> createMorphologyFilter(int op, int type, InputArray kernel,
00369                     Point anchor=Point(-1,-1), int _rowBorderType=BORDER_CONSTANT,
00370                     int _columnBorderType=-1,
00371                     const Scalar& _borderValue=morphologyDefaultBorderValue());
00372 
00374 enum { MORPH_RECT=0, MORPH_CROSS=1, MORPH_ELLIPSE=2 };
00376 CV_EXPORTS_W Mat getStructuringElement(int shape, Size ksize, Point anchor=Point(-1,-1));
00377 
00378 template<> CV_EXPORTS void Ptr<IplConvKernel>::delete_obj();
00379 
00381 CV_EXPORTS_W void copyMakeBorder( InputArray src, OutputArray dst,
00382                                 int top, int bottom, int left, int right,
00383                                 int borderType, const Scalar& value=Scalar() );
00384 
00386 CV_EXPORTS_W void medianBlur( InputArray src, OutputArray dst, int ksize );
00388 CV_EXPORTS_W void GaussianBlur( InputArray src,
00389                                                OutputArray dst, Size ksize,
00390                                                double sigma1, double sigma2=0,
00391                                                int borderType=BORDER_DEFAULT );
00393 CV_EXPORTS_W void bilateralFilter( InputArray src, OutputArray dst, int d,
00394                                    double sigmaColor, double sigmaSpace,
00395                                    int borderType=BORDER_DEFAULT );
00397 CV_EXPORTS_W void boxFilter( InputArray src, OutputArray dst, int ddepth,
00398                              Size ksize, Point anchor=Point(-1,-1),
00399                              bool normalize=true,
00400                              int borderType=BORDER_DEFAULT );
00402 CV_EXPORTS_W void blur( InputArray src, OutputArray dst,
00403                         Size ksize, Point anchor=Point(-1,-1),
00404                         int borderType=BORDER_DEFAULT );
00405 
00407 CV_EXPORTS_W void filter2D( InputArray src, OutputArray dst, int ddepth,
00408                             InputArray kernel, Point anchor=Point(-1,-1),
00409                             double delta=0, int borderType=BORDER_DEFAULT );
00410 
00412 CV_EXPORTS_W void sepFilter2D( InputArray src, OutputArray dst, int ddepth,
00413                                InputArray kernelX, InputArray kernelY,
00414                                Point anchor=Point(-1,-1),
00415                                double delta=0, int borderType=BORDER_DEFAULT );
00416     
00418 CV_EXPORTS_W void Sobel( InputArray src, OutputArray dst, int ddepth,
00419                          int dx, int dy, int ksize=3,
00420                          double scale=1, double delta=0,
00421                          int borderType=BORDER_DEFAULT );
00422 
00424 CV_EXPORTS_W void Scharr( InputArray src, OutputArray dst, int ddepth,
00425                           int dx, int dy, double scale=1, double delta=0,
00426                           int borderType=BORDER_DEFAULT );
00427 
00429 CV_EXPORTS_W void Laplacian( InputArray src, OutputArray dst, int ddepth,
00430                              int ksize=1, double scale=1, double delta=0,
00431                              int borderType=BORDER_DEFAULT );
00432 
00434 CV_EXPORTS_W void Canny( InputArray image, OutputArray edges,
00435                          double threshold1, double threshold2,
00436                          int apertureSize=3, bool L2gradient=false );
00437 
00439 CV_EXPORTS_W void cornerMinEigenVal( InputArray src, OutputArray dst,
00440                                    int blockSize, int ksize=3,
00441                                    int borderType=BORDER_DEFAULT );
00442 
00444 CV_EXPORTS_W void cornerHarris( InputArray src, OutputArray dst, int blockSize,
00445                                 int ksize, double k,
00446                                 int borderType=BORDER_DEFAULT );
00447 
00449 CV_EXPORTS_W void cornerEigenValsAndVecs( InputArray src, OutputArray dst,
00450                                           int blockSize, int ksize,
00451                                           int borderType=BORDER_DEFAULT );
00452 
00454 CV_EXPORTS_W void preCornerDetect( InputArray src, OutputArray dst, int ksize,
00455                                    int borderType=BORDER_DEFAULT );
00456 
00458 CV_EXPORTS void cornerSubPix( InputArray image, InputOutputArray corners,
00459                               Size winSize, Size zeroZone,
00460                               TermCriteria criteria );
00461 
00463 CV_EXPORTS_W void goodFeaturesToTrack( InputArray image, OutputArray corners,
00464                                      int maxCorners, double qualityLevel, double minDistance,
00465                                      InputArray mask=noArray(), int blockSize=3,
00466                                      bool useHarrisDetector=false, double k=0.04 );
00467 
00469 CV_EXPORTS_W void HoughLines( InputArray image, OutputArray lines,
00470                               double rho, double theta, int threshold,
00471                               double srn=0, double stn=0 );
00472 
00474 CV_EXPORTS_W void HoughLinesP( InputArray image, OutputArray lines,
00475                                double rho, double theta, int threshold,
00476                                double minLineLength=0, double maxLineGap=0 );
00477 
00479 CV_EXPORTS_W void HoughCircles( InputArray image, OutputArray circles,
00480                                int method, double dp, double minDist,
00481                                double param1=100, double param2=100,
00482                                int minRadius=0, int maxRadius=0 );
00483 
00485 CV_EXPORTS_W void erode( InputArray src, OutputArray dst, InputArray kernel,
00486                          Point anchor=Point(-1,-1), int iterations=1,
00487                          int borderType=BORDER_CONSTANT,
00488                          const Scalar& borderValue=morphologyDefaultBorderValue() );
00489     
00491 CV_EXPORTS_W void dilate( InputArray src, OutputArray dst, InputArray kernel,
00492                           Point anchor=Point(-1,-1), int iterations=1,
00493                           int borderType=BORDER_CONSTANT,
00494                           const Scalar& borderValue=morphologyDefaultBorderValue() );
00495     
00497 CV_EXPORTS_W void morphologyEx( InputArray src, OutputArray dst,
00498                                 int op, InputArray kernel,
00499                                 Point anchor=Point(-1,-1), int iterations=1,
00500                                 int borderType=BORDER_CONSTANT,
00501                                 const Scalar& borderValue=morphologyDefaultBorderValue() );
00502 
00504 enum
00505 {
00506     INTER_NEAREST=CV_INTER_NN, 
00507     INTER_LINEAR=CV_INTER_LINEAR, 
00508     INTER_CUBIC=CV_INTER_CUBIC, 
00509     INTER_AREA=CV_INTER_AREA, 
00510     INTER_LANCZOS4=CV_INTER_LANCZOS4, 
00511     INTER_MAX=7,
00512     WARP_INVERSE_MAP=CV_WARP_INVERSE_MAP
00513 };
00514 
00516 CV_EXPORTS_W void resize( InputArray src, OutputArray dst,
00517                           Size dsize, double fx=0, double fy=0,
00518                           int interpolation=INTER_LINEAR );
00519 
00521 CV_EXPORTS_W void warpAffine( InputArray src, OutputArray dst,
00522                               InputArray M, Size dsize,
00523                               int flags=INTER_LINEAR,
00524                               int borderMode=BORDER_CONSTANT,
00525                               const Scalar& borderValue=Scalar());
00526     
00528 CV_EXPORTS_W void warpPerspective( InputArray src, OutputArray dst,
00529                                    InputArray M, Size dsize,
00530                                    int flags=INTER_LINEAR,
00531                                    int borderMode=BORDER_CONSTANT,
00532                                    const Scalar& borderValue=Scalar());
00533 
00534 enum
00535 {
00536     INTER_BITS=5, INTER_BITS2=INTER_BITS*2,
00537     INTER_TAB_SIZE=(1<<INTER_BITS),
00538     INTER_TAB_SIZE2=INTER_TAB_SIZE*INTER_TAB_SIZE
00539 };
00540 
00542 CV_EXPORTS_W void remap( InputArray src, OutputArray dst,
00543                          InputArray map1, InputArray map2,
00544                          int interpolation, int borderMode=BORDER_CONSTANT,
00545                          const Scalar& borderValue=Scalar());
00546 
00548 CV_EXPORTS_W void convertMaps( InputArray map1, InputArray map2,
00549                                OutputArray dstmap1, OutputArray dstmap2,
00550                                int dstmap1type, bool nninterpolation=false );
00551                              
00553 CV_EXPORTS_W Mat getRotationMatrix2D( Point2f center, double angle, double scale );
00555 CV_EXPORTS Mat getPerspectiveTransform( const Point2f src[], const Point2f dst[] );
00557 CV_EXPORTS Mat getAffineTransform( const Point2f src[], const Point2f dst[] );
00559 CV_EXPORTS_W void invertAffineTransform( InputArray M, OutputArray iM );
00560 
00562 CV_EXPORTS_W void getRectSubPix( InputArray image, Size patchSize,
00563                                  Point2f center, OutputArray patch, int patchType=-1 );
00564 
00566 CV_EXPORTS_W void integral( InputArray src, OutputArray sum, int sdepth=-1 );
00567 
00569 CV_EXPORTS_AS(integral2) void integral( InputArray src, OutputArray sum,
00570                                         OutputArray sqsum, int sdepth=-1 );
00572 CV_EXPORTS_AS(integral3) void integral( InputArray src, OutputArray sum,
00573                                         OutputArray sqsum, OutputArray tilted,
00574                                         int sdepth=-1 );
00575 
00577 CV_EXPORTS_W void accumulate( InputArray src, CV_IN_OUT InputOutputArray dst,
00578                               InputArray mask=noArray() );
00580 CV_EXPORTS_W void accumulateSquare( InputArray src, CV_IN_OUT InputOutputArray dst,
00581                                     InputArray mask=noArray() );
00583 CV_EXPORTS_W void accumulateProduct( InputArray src1, InputArray src2,
00584                                      CV_IN_OUT InputOutputArray dst, InputArray mask=noArray() );
00586 CV_EXPORTS_W void accumulateWeighted( InputArray src, CV_IN_OUT InputOutputArray dst,
00587                                       double alpha, InputArray mask=noArray() );
00588     
00590 enum { THRESH_BINARY=CV_THRESH_BINARY, THRESH_BINARY_INV=CV_THRESH_BINARY_INV,
00591        THRESH_TRUNC=CV_THRESH_TRUNC, THRESH_TOZERO=CV_THRESH_TOZERO,
00592        THRESH_TOZERO_INV=CV_THRESH_TOZERO_INV, THRESH_MASK=CV_THRESH_MASK,
00593        THRESH_OTSU=CV_THRESH_OTSU };
00594 
00596 CV_EXPORTS_W double threshold( InputArray src, OutputArray dst,
00597                                double thresh, double maxval, int type );
00598 
00600 enum { ADAPTIVE_THRESH_MEAN_C=0, ADAPTIVE_THRESH_GAUSSIAN_C=1 };
00601 
00603 CV_EXPORTS_W void adaptiveThreshold( InputArray src, OutputArray dst,
00604                                      double maxValue, int adaptiveMethod,
00605                                      int thresholdType, int blockSize, double C );
00606 
00608 CV_EXPORTS_W void pyrDown( InputArray src, OutputArray dst,
00609                            const Size& dstsize=Size());
00611 CV_EXPORTS_W void pyrUp( InputArray src, OutputArray dst,
00612                          const Size& dstsize=Size());
00613 
00615 CV_EXPORTS void buildPyramid( InputArray src, OutputArrayOfArrays dst, int maxlevel );
00616 
00618 CV_EXPORTS_W void undistort( InputArray src, OutputArray dst,
00619                              InputArray cameraMatrix,
00620                              InputArray distCoeffs,
00621                              InputArray newCameraMatrix=noArray() );
00622     
00624 CV_EXPORTS_W void initUndistortRectifyMap( InputArray cameraMatrix, InputArray distCoeffs,
00625                            InputArray R, InputArray newCameraMatrix,
00626                            Size size, int m1type, OutputArray map1, OutputArray map2 );
00627 
00628 enum
00629 {
00630     PROJ_SPHERICAL_ORTHO = 0,
00631     PROJ_SPHERICAL_EQRECT = 1
00632 };    
00633     
00635 CV_EXPORTS_W float initWideAngleProjMap( InputArray cameraMatrix, InputArray distCoeffs,
00636                                          Size imageSize, int destImageWidth,
00637                                          int m1type, OutputArray map1, OutputArray map2,
00638                                          int projType=PROJ_SPHERICAL_EQRECT, double alpha=0);
00639     
00641 CV_EXPORTS_W Mat getDefaultNewCameraMatrix( InputArray cameraMatrix, Size imgsize=Size(),
00642                                             bool centerPrincipalPoint=false );
00643     
00645 CV_EXPORTS void undistortPoints( InputArray src, OutputArray dst,
00646                                  InputArray cameraMatrix, InputArray distCoeffs,
00647                                  InputArray R=noArray(), InputArray P=noArray());
00648 
00649 template<> CV_EXPORTS void Ptr<CvHistogram>::delete_obj();
00650     
00652 CV_EXPORTS void calcHist( const Mat* images, int nimages,
00653                           const int* channels, InputArray mask,
00654                           OutputArray hist, int dims, const int* histSize,
00655                           const float** ranges, bool uniform=true, bool accumulate=false );
00656 
00658 CV_EXPORTS void calcHist( const Mat* images, int nimages,
00659                           const int* channels, InputArray mask,
00660                           SparseMat& hist, int dims,
00661                           const int* histSize, const float** ranges,
00662                           bool uniform=true, bool accumulate=false );
00663 
00665 CV_EXPORTS void calcBackProject( const Mat* images, int nimages,
00666                                  const int* channels, InputArray hist,
00667                                  OutputArray backProject, const float** ranges,
00668                                  double scale=1, bool uniform=true );
00669 
00671 CV_EXPORTS void calcBackProject( const Mat* images, int nimages,
00672                                  const int* channels, const SparseMat& hist, 
00673                                  OutputArray backProject, const float** ranges,
00674                                  double scale=1, bool uniform=true );
00675 
00677 CV_EXPORTS_W double compareHist( InputArray H1, InputArray H2, int method );
00678 
00680 CV_EXPORTS double compareHist( const SparseMat& H1, const SparseMat& H2, int method );
00681 
00683 CV_EXPORTS_W void equalizeHist( InputArray src, OutputArray dst );
00684     
00685 CV_EXPORTS float EMD( InputArray signature1, InputArray signature2,
00686                       int distType, InputArray cost=noArray(),
00687                       float* lowerBound=0, OutputArray flow=noArray() );
00688 
00690 CV_EXPORTS_W void watershed( InputArray image, InputOutputArray markers );
00691 
00693 CV_EXPORTS_W void pyrMeanShiftFiltering( InputArray src, OutputArray dst,
00694                                          double sp, double sr, int maxLevel=1,
00695                                          TermCriteria termcrit=TermCriteria(
00696                                             TermCriteria::MAX_ITER+TermCriteria::EPS,5,1) );
00697 
00699 enum
00700 {
00701     GC_BGD    = 0,  
00702     GC_FGD    = 1,  
00703     GC_PR_BGD = 2,  
00704     GC_PR_FGD = 3   
00705 };
00706 
00708 enum
00709 {
00710     GC_INIT_WITH_RECT  = 0,
00711     GC_INIT_WITH_MASK  = 1,
00712     GC_EVAL            = 2
00713 };
00714 
00716 CV_EXPORTS_W void grabCut( InputArray img, InputOutputArray mask, Rect rect, 
00717                            InputOutputArray bgdModel, InputOutputArray fgdModel,
00718                            int iterCount, int mode = GC_EVAL );
00719 
00721 enum
00722 {
00723     INPAINT_NS=CV_INPAINT_NS, // Navier-Stokes algorithm
00724     INPAINT_TELEA=CV_INPAINT_TELEA // A. Telea algorithm
00725 };
00726 
00728 CV_EXPORTS_W void inpaint( InputArray src, InputArray inpaintMask,
00729                            OutputArray dst, double inpaintRange, int flags );
00730 
00732 CV_EXPORTS_W void distanceTransform( InputArray src, OutputArray dst,
00733                                      OutputArray labels, int distanceType, int maskSize );
00734 
00736 CV_EXPORTS void distanceTransform( InputArray src, OutputArray dst,
00737                                    int distanceType, int maskSize );
00738 
00739 enum { FLOODFILL_FIXED_RANGE = 1 << 16, FLOODFILL_MASK_ONLY = 1 << 17 };
00740 
00742 CV_EXPORTS int floodFill( InputOutputArray image,
00743                           Point seedPoint, Scalar newVal, CV_OUT Rect* rect=0,
00744                           Scalar loDiff=Scalar(), Scalar upDiff=Scalar(),
00745                           int flags=4 );
00746 
00748 CV_EXPORTS_W int floodFill( InputOutputArray image, InputOutputArray mask,
00749                             Point seedPoint, Scalar newVal, CV_OUT Rect* rect=0,
00750                             Scalar loDiff=Scalar(), Scalar upDiff=Scalar(),
00751                             int flags=4 );
00752 
00754 CV_EXPORTS_W void cvtColor( InputArray src, OutputArray dst, int code, int dstCn=0 );
00755 
00757 class CV_EXPORTS_W_MAP Moments
00758 {
00759 public:
00761     Moments();
00763     Moments(double m00, double m10, double m01, double m20, double m11,
00764             double m02, double m30, double m21, double m12, double m03 );
00766     Moments( const CvMoments& moments );
00768     operator CvMoments() const;
00769     
00771     CV_PROP_RW double  m00, m10, m01, m20, m11, m02, m30, m21, m12, m03;
00773     CV_PROP_RW double  mu20, mu11, mu02, mu30, mu21, mu12, mu03;
00775     CV_PROP_RW double  nu20, nu11, nu02, nu30, nu21, nu12, nu03;
00776 };
00777 
00779 CV_EXPORTS_W Moments moments( InputArray array, bool binaryImage=false );
00780 
00782 CV_EXPORTS void HuMoments( const Moments& moments, double hu[7] );
00783 
00785 enum { TM_SQDIFF=0, TM_SQDIFF_NORMED=1, TM_CCORR=2, TM_CCORR_NORMED=3, TM_CCOEFF=4, TM_CCOEFF_NORMED=5 };
00786 
00788 CV_EXPORTS_W void matchTemplate( InputArray image, InputArray templ,
00789                                  OutputArray result, int method );
00790 
00792 enum
00793 {
00794     RETR_EXTERNAL=CV_RETR_EXTERNAL, 
00795     RETR_LIST=CV_RETR_LIST, 
00796     RETR_CCOMP=CV_RETR_CCOMP, 
00797     RETR_TREE=CV_RETR_TREE 
00798 };
00799 
00801 enum
00802 {
00803     CHAIN_APPROX_NONE=CV_CHAIN_APPROX_NONE,
00804     CHAIN_APPROX_SIMPLE=CV_CHAIN_APPROX_SIMPLE,
00805     CHAIN_APPROX_TC89_L1=CV_CHAIN_APPROX_TC89_L1,
00806     CHAIN_APPROX_TC89_KCOS=CV_CHAIN_APPROX_TC89_KCOS
00807 };
00808 
00810 CV_EXPORTS void findContours( InputOutputArray image, OutputArrayOfArrays contours,
00811                               OutputArray hierarchy, int mode,
00812                               int method, Point offset=Point());
00813 
00815 CV_EXPORTS void findContours( InputOutputArray image, OutputArrayOfArrays contours,
00816                               int mode, int method, Point offset=Point());
00817 
00819 CV_EXPORTS void drawContours( InputOutputArray image, InputArrayOfArrays contours,
00820                               int contourIdx, const Scalar& color,
00821                               int thickness=1, int lineType=8,
00822                               InputArray hierarchy=noArray(),
00823                               int maxLevel=INT_MAX, Point offset=Point() );
00824 
00826 CV_EXPORTS void approxPolyDP( InputArray curve,
00827                               OutputArray approxCurve,
00828                               double epsilon, bool closed );
00829 
00831 CV_EXPORTS_W double arcLength( InputArray curve, bool closed );
00833 CV_EXPORTS_W Rect boundingRect( InputArray points );
00835 CV_EXPORTS_W double contourArea( InputArray contour, bool oriented=false );
00837 CV_EXPORTS_W RotatedRect minAreaRect( InputArray points );
00839 CV_EXPORTS_W void minEnclosingCircle( InputArray points,
00840                                       Point2f& center, float& radius );    
00842 CV_EXPORTS_W double matchShapes( InputArray contour1, InputArray contour2,
00843                                  int method, double parameter );
00845 CV_EXPORTS void convexHull( InputArray points, OutputArray hull,
00846                             bool clockwise=false, bool returnPoints=true );
00847 
00849 CV_EXPORTS_W bool isContourConvex( InputArray contour );
00850 
00852 CV_EXPORTS_W RotatedRect fitEllipse( InputArray points );
00853 
00855 CV_EXPORTS void fitLine( InputArray points, OutputArray line, int distType,
00856                          double param, double reps, double aeps );
00858 CV_EXPORTS_W double pointPolygonTest( InputArray contour, Point2f pt, bool measureDist );
00859         
00860 }
00861 
00862 // 2009-01-12, Xavier Delacour <xavier.delacour@gmail.com>
00863 
00864 struct lsh_hash {
00865   int h1, h2;
00866 };
00867 
00868 struct CvLSHOperations
00869 {
00870   virtual ~CvLSHOperations() {}
00871 
00872   virtual int vector_add(const void* data) = 0;
00873   virtual void vector_remove(int i) = 0;
00874   virtual const void* vector_lookup(int i) = 0;
00875   virtual void vector_reserve(int n) = 0;
00876   virtual unsigned int vector_count() = 0;
00877 
00878   virtual void hash_insert(lsh_hash h, int l, int i) = 0;
00879   virtual void hash_remove(lsh_hash h, int l, int i) = 0;
00880   virtual int hash_lookup(lsh_hash h, int l, int* ret_i, int ret_i_max) = 0;
00881 };
00882 
00883 #endif /* __cplusplus */
00884 
00885 #endif
00886 
00887 /* End of file. */