opencv 2.2.0
/usr/src/RPM/BUILD/libopencv2.2-2.2.0/modules/imgproc/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(const Mat& kernel, Point anchor);
00291 
00293 CV_EXPORTS Ptr<BaseRowFilter> getLinearRowFilter(int srcType, int bufType,
00294                                             const Mat& kernel, int anchor,
00295                                             int symmetryType);
00296 
00298 CV_EXPORTS Ptr<BaseColumnFilter> getLinearColumnFilter(int bufType, int dstType,
00299                                             const Mat& 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                                            const Mat& 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                           const Mat& rowKernel, const Mat& 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                  const Mat& 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( CV_OUT Mat& kx, CV_OUT Mat& 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, const Mat& 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, const Mat& 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( const Mat& src, CV_OUT Mat& dst,
00382                                 int top, int bottom, int left, int right,
00383                                 int borderType, const Scalar& value=Scalar() );
00384 
00386 CV_EXPORTS_W void medianBlur( const Mat& src, CV_OUT Mat& dst, int ksize );
00388 CV_EXPORTS_AS(gaussianBlur) void GaussianBlur( const Mat& src, CV_OUT Mat& dst, Size ksize,
00389                               double sigma1, double sigma2=0,
00390                               int borderType=BORDER_DEFAULT );
00392 CV_EXPORTS_W void bilateralFilter( const Mat& src, CV_OUT Mat& dst, int d,
00393                                  double sigmaColor, double sigmaSpace,
00394                                  int borderType=BORDER_DEFAULT );
00396 CV_EXPORTS_W void boxFilter( const Mat& src, CV_OUT Mat& dst, int ddepth,
00397                            Size ksize, Point anchor=Point(-1,-1),
00398                            bool normalize=true,
00399                            int borderType=BORDER_DEFAULT );
00401 CV_EXPORTS_W void blur( const Mat& src, CV_OUT Mat& dst,
00402                         Size ksize, Point anchor=Point(-1,-1),
00403                         int borderType=BORDER_DEFAULT );
00404 
00406 CV_EXPORTS_W void filter2D( const Mat& src, CV_OUT Mat& dst, int ddepth,
00407                           const Mat& kernel, Point anchor=Point(-1,-1),
00408                           double delta=0, int borderType=BORDER_DEFAULT );
00409 
00411 CV_EXPORTS_W void sepFilter2D( const Mat& src, CV_OUT Mat& dst, int ddepth,
00412                              const Mat& kernelX, const Mat& kernelY,
00413                              Point anchor=Point(-1,-1),
00414                              double delta=0, int borderType=BORDER_DEFAULT );
00415     
00417 CV_EXPORTS_AS(sobel) void Sobel( const Mat& src, CV_OUT Mat& dst, int ddepth,
00418                        int dx, int dy, int ksize=3,
00419                        double scale=1, double delta=0,
00420                        int borderType=BORDER_DEFAULT );
00421 
00423 CV_EXPORTS_AS(scharr) void Scharr( const Mat& src, CV_OUT Mat& dst, int ddepth,
00424                         int dx, int dy, double scale=1, double delta=0,
00425                         int borderType=BORDER_DEFAULT );
00426 
00428 CV_EXPORTS_AS(laplacian) void Laplacian( const Mat& src, CV_OUT Mat& dst, int ddepth,
00429                            int ksize=1, double scale=1, double delta=0,
00430                            int borderType=BORDER_DEFAULT );
00431 
00433 CV_EXPORTS_AS(canny) void Canny( const Mat& image, CV_OUT Mat& edges,
00434                        double threshold1, double threshold2,
00435                        int apertureSize=3, bool L2gradient=false );
00436 
00438 CV_EXPORTS_W void cornerMinEigenVal( const Mat& src, CV_OUT Mat& dst,
00439                                    int blockSize, int ksize=3,
00440                                    int borderType=BORDER_DEFAULT );
00441 
00443 CV_EXPORTS_W void cornerHarris( const Mat& src, CV_OUT Mat& dst, int blockSize,
00444                               int ksize, double k,
00445                               int borderType=BORDER_DEFAULT );
00446 
00448 CV_EXPORTS_W void cornerEigenValsAndVecs( const Mat& src, CV_OUT Mat& dst,
00449                                         int blockSize, int ksize,
00450                                         int borderType=BORDER_DEFAULT );
00451 
00453 CV_EXPORTS_W void preCornerDetect( const Mat& src, CV_OUT Mat& dst, int ksize,
00454                                  int borderType=BORDER_DEFAULT );
00455 
00457 CV_EXPORTS void cornerSubPix( const Mat& image, vector<Point2f>& corners,
00458                               Size winSize, Size zeroZone,
00459                               TermCriteria criteria );
00460 
00462 CV_EXPORTS_W void goodFeaturesToTrack( const Mat& image, CV_OUT vector<Point2f>& corners,
00463                                      int maxCorners, double qualityLevel, double minDistance,
00464                                      const Mat& mask=Mat(), int blockSize=3,
00465                                      bool useHarrisDetector=false, double k=0.04 );
00466 
00468 CV_EXPORTS_AS(houghLines) void HoughLines( const Mat& image, CV_OUT vector<Vec2f>& lines,
00469                             double rho, double theta, int threshold,
00470                             double srn=0, double stn=0 );
00471 
00473 CV_EXPORTS_AS(houghLinesP) void HoughLinesP( Mat& image, CV_OUT vector<Vec4i>& lines,
00474                              double rho, double theta, int threshold,
00475                              double minLineLength=0, double maxLineGap=0 );
00476 
00478 CV_EXPORTS_AS(houghCircles) void HoughCircles( const Mat& image, CV_OUT vector<Vec3f>& circles,
00479                               int method, double dp, double minDist,
00480                               double param1=100, double param2=100,
00481                               int minRadius=0, int maxRadius=0 );
00482 
00484 CV_EXPORTS_W void erode( const Mat& src, CV_OUT Mat& dst, const Mat& kernel,
00485                        Point anchor=Point(-1,-1), int iterations=1,
00486                        int borderType=BORDER_CONSTANT,
00487                        const Scalar& borderValue=morphologyDefaultBorderValue() );
00488     
00490 CV_EXPORTS_W void dilate( const Mat& src, CV_OUT Mat& dst, const Mat& kernel,
00491                         Point anchor=Point(-1,-1), int iterations=1,
00492                         int borderType=BORDER_CONSTANT,
00493                         const Scalar& borderValue=morphologyDefaultBorderValue() );
00494     
00496 CV_EXPORTS_W void morphologyEx( const Mat& src, CV_OUT Mat& dst,
00497                               int op, const Mat& kernel,
00498                               Point anchor=Point(-1,-1), int iterations=1,
00499                               int borderType=BORDER_CONSTANT,
00500                               const Scalar& borderValue=morphologyDefaultBorderValue() );
00501 
00503 enum
00504 {
00505     INTER_NEAREST=CV_INTER_NN, 
00506     INTER_LINEAR=CV_INTER_LINEAR, 
00507     INTER_CUBIC=CV_INTER_CUBIC, 
00508     INTER_AREA=CV_INTER_AREA, 
00509     INTER_LANCZOS4=CV_INTER_LANCZOS4, 
00510     INTER_MAX=7,
00511     WARP_INVERSE_MAP=CV_WARP_INVERSE_MAP
00512 };
00513 
00515 CV_EXPORTS_W void resize( const Mat& src, CV_OUT Mat& dst,
00516                         Size dsize, double fx=0, double fy=0,
00517                         int interpolation=INTER_LINEAR );
00518 
00520 CV_EXPORTS_W void warpAffine( const Mat& src, CV_OUT Mat& dst,
00521                             const Mat& M, Size dsize,
00522                             int flags=INTER_LINEAR,
00523                             int borderMode=BORDER_CONSTANT,
00524                             const Scalar& borderValue=Scalar());
00525     
00527 CV_EXPORTS_W void warpPerspective( const Mat& src, CV_OUT Mat& dst,
00528                                  const Mat& M, Size dsize,
00529                                  int flags=INTER_LINEAR,
00530                                  int borderMode=BORDER_CONSTANT,
00531                                  const Scalar& borderValue=Scalar());
00532 
00533 enum { INTER_BITS=5, INTER_BITS2=INTER_BITS*2,
00534     INTER_TAB_SIZE=(1<<INTER_BITS),
00535     INTER_TAB_SIZE2=INTER_TAB_SIZE*INTER_TAB_SIZE };    
00536 
00538 CV_EXPORTS_W void remap( const Mat& src, CV_OUT Mat& dst, const Mat& map1, const Mat& map2,
00539                        int interpolation, int borderMode=BORDER_CONSTANT,
00540                        const Scalar& borderValue=Scalar());
00541 
00543 CV_EXPORTS_W void convertMaps( const Mat& map1, const Mat& map2,
00544                              CV_OUT Mat& dstmap1, CV_OUT Mat& dstmap2,
00545                              int dstmap1type, bool nninterpolation=false );
00546                              
00548 CV_EXPORTS_W Mat getRotationMatrix2D( Point2f center, double angle, double scale );
00550 CV_EXPORTS Mat getPerspectiveTransform( const Point2f src[], const Point2f dst[] );
00552 CV_EXPORTS Mat getAffineTransform( const Point2f src[], const Point2f dst[] );
00554 CV_EXPORTS_W void invertAffineTransform( const Mat& M, CV_OUT Mat& iM );
00555 
00557 CV_EXPORTS_W void getRectSubPix( const Mat& image, Size patchSize,
00558                                Point2f center, CV_OUT Mat& patch, int patchType=-1 );
00559 
00561 CV_EXPORTS_W void integral( const Mat& src, CV_OUT Mat& sum, int sdepth=-1 );
00563 CV_EXPORTS_AS(integral2) void integral( const Mat& src, CV_OUT Mat& sum, CV_OUT Mat& sqsum, int sdepth=-1 );
00565 CV_EXPORTS_AS(integral3) void integral( const Mat& src, CV_OUT Mat& sum, CV_OUT Mat& sqsum, CV_OUT Mat& tilted, int sdepth=-1 );
00566 
00568 CV_EXPORTS_W void accumulate( const Mat& src, CV_IN_OUT Mat& dst, const Mat& mask=Mat() );
00570 CV_EXPORTS_W void accumulateSquare( const Mat& src, CV_IN_OUT Mat& dst, const Mat& mask=Mat() );
00572 CV_EXPORTS_W void accumulateProduct( const Mat& src1, const Mat& src2,
00573                                    CV_IN_OUT Mat& dst, const Mat& mask=Mat() );
00575 CV_EXPORTS_W void accumulateWeighted( const Mat& src, CV_IN_OUT Mat& dst,
00576                                       double alpha, const Mat& mask=Mat() );
00577     
00579 enum { THRESH_BINARY=CV_THRESH_BINARY, THRESH_BINARY_INV=CV_THRESH_BINARY_INV,
00580        THRESH_TRUNC=CV_THRESH_TRUNC, THRESH_TOZERO=CV_THRESH_TOZERO,
00581        THRESH_TOZERO_INV=CV_THRESH_TOZERO_INV, THRESH_MASK=CV_THRESH_MASK,
00582        THRESH_OTSU=CV_THRESH_OTSU };
00583 
00585 CV_EXPORTS_W double threshold( const Mat& src, CV_OUT Mat& dst, double thresh, double maxval, int type );
00586 
00588 enum { ADAPTIVE_THRESH_MEAN_C=0, ADAPTIVE_THRESH_GAUSSIAN_C=1 };
00589 
00591 CV_EXPORTS_W void adaptiveThreshold( const Mat& src, CV_OUT Mat& dst, double maxValue,
00592                                    int adaptiveMethod, int thresholdType,
00593                                    int blockSize, double C );
00594 
00596 CV_EXPORTS_W void pyrDown( const Mat& src, CV_OUT Mat& dst, const Size& dstsize=Size());
00598 CV_EXPORTS_W void pyrUp( const Mat& src, CV_OUT Mat& dst, const Size& dstsize=Size());
00600 CV_EXPORTS void buildPyramid( const Mat& src, CV_OUT vector<Mat>& dst, int maxlevel );
00601 
00603 CV_EXPORTS_W void undistort( const Mat& src, CV_OUT Mat& dst, const Mat& cameraMatrix,
00604                            const Mat& distCoeffs, const Mat& newCameraMatrix=Mat() );
00606 CV_EXPORTS_W void initUndistortRectifyMap( const Mat& cameraMatrix, const Mat& distCoeffs,
00607                            const Mat& R, const Mat& newCameraMatrix,
00608                            Size size, int m1type, CV_OUT Mat& map1, CV_OUT Mat& map2 );
00609 
00610 enum
00611 {
00612     PROJ_SPHERICAL_ORTHO = 0,
00613     PROJ_SPHERICAL_EQRECT = 1
00614 };    
00615     
00617 CV_EXPORTS_W float initWideAngleProjMap( const Mat& cameraMatrix, const Mat& distCoeffs,
00618                                        Size imageSize, int destImageWidth,
00619                                        int m1type, CV_OUT Mat& map1, CV_OUT Mat& map2,
00620                                        int projType=PROJ_SPHERICAL_EQRECT, double alpha=0);
00621     
00623 CV_EXPORTS_W Mat getDefaultNewCameraMatrix( const Mat& cameraMatrix, Size imgsize=Size(),
00624                                           bool centerPrincipalPoint=false );
00626 CV_EXPORTS void undistortPoints( const Mat& src, CV_OUT vector<Point2f>& dst,
00627                                  const Mat& cameraMatrix, const Mat& distCoeffs,
00628                                  const Mat& R=Mat(), const Mat& P=Mat());
00630 CV_EXPORTS_W void undistortPoints( const Mat& src, CV_OUT Mat& dst,
00631                                  const Mat& cameraMatrix, const Mat& distCoeffs,
00632                                  const Mat& R=Mat(), const Mat& P=Mat());
00633 
00634 template<> CV_EXPORTS void Ptr<CvHistogram>::delete_obj();
00635     
00637 CV_EXPORTS void calcHist( const Mat* images, int nimages,
00638                           const int* channels, const Mat& mask,
00639                           Mat& hist, int dims, const int* histSize,
00640                           const float** ranges, bool uniform=true, bool accumulate=false );
00641 
00643 CV_EXPORTS void calcHist( const Mat* images, int nimages,
00644                           const int* channels, const Mat& mask,
00645                           SparseMat& hist, int dims,
00646                           const int* histSize, const float** ranges,
00647                           bool uniform=true, bool accumulate=false );
00648 
00650 CV_EXPORTS void calcBackProject( const Mat* images, int nimages,
00651                                  const int* channels, const Mat& hist,
00652                                  Mat& backProject, const float** ranges,
00653                                  double scale=1, bool uniform=true );
00654 
00656 CV_EXPORTS void calcBackProject( const Mat* images, int nimages,
00657                                  const int* channels, const SparseMat& hist, 
00658                                  Mat& backProject, const float** ranges,
00659                                  double scale=1, bool uniform=true );
00660 
00662 CV_EXPORTS_W double compareHist( const Mat& H1, const Mat& H2, int method );
00663 
00665 CV_EXPORTS double compareHist( const SparseMat& H1, const SparseMat& H2, int method );
00666 
00668 CV_EXPORTS_W void equalizeHist( const Mat& src, CV_OUT Mat& dst );
00669 
00671 CV_EXPORTS_W void watershed( const Mat& image, Mat& markers );
00672 
00674 CV_EXPORTS_W void pyrMeanShiftFiltering( const Mat& src, CV_OUT Mat& dst,
00675                     double sp, double sr, int maxLevel=1,
00676                     TermCriteria termcrit=TermCriteria(TermCriteria::MAX_ITER+TermCriteria::EPS,5,1) );
00677 
00679 enum
00680 {
00681     GC_BGD    = 0,  
00682     GC_FGD    = 1,  
00683     GC_PR_BGD = 2,  
00684     GC_PR_FGD = 3   
00685 };
00686 
00688 enum
00689 {
00690     GC_INIT_WITH_RECT  = 0,
00691     GC_INIT_WITH_MASK  = 1,
00692     GC_EVAL            = 2
00693 };
00694 
00696 CV_EXPORTS_W void grabCut( const Mat& img, Mat& mask, Rect rect, 
00697                          Mat& bgdModel, Mat& fgdModel,
00698                          int iterCount, int mode = GC_EVAL );
00699 
00701 enum
00702 {
00703     INPAINT_NS=CV_INPAINT_NS, // Navier-Stokes algorithm
00704     INPAINT_TELEA=CV_INPAINT_TELEA // A. Telea algorithm
00705 };
00706 
00708 CV_EXPORTS_W void inpaint( const Mat& src, const Mat& inpaintMask,
00709                          CV_OUT Mat& dst, double inpaintRange, int flags );
00710 
00712 CV_EXPORTS_AS(distanceTransformWithLabels)
00713     void distanceTransform( const Mat& src, CV_OUT Mat& dst, Mat& labels,
00714                             int distanceType, int maskSize );
00715 
00717 CV_EXPORTS_W void distanceTransform( const Mat& src, CV_OUT Mat& dst,
00718                                    int distanceType, int maskSize );
00719 
00720 enum { FLOODFILL_FIXED_RANGE = 1 << 16,
00721        FLOODFILL_MASK_ONLY = 1 << 17 };
00722 
00724 CV_EXPORTS_W int floodFill( Mat& image,
00725                           Point seedPoint, Scalar newVal, CV_OUT Rect* rect=0,
00726                           Scalar loDiff=Scalar(), Scalar upDiff=Scalar(),
00727                           int flags=4 );
00728 
00730 CV_EXPORTS_AS(floodFillMask) int floodFill( Mat& image, Mat& mask,
00731                           Point seedPoint, Scalar newVal, CV_OUT Rect* rect=0,
00732                           Scalar loDiff=Scalar(), Scalar upDiff=Scalar(),
00733                           int flags=4 );
00734 
00736 CV_EXPORTS_W void cvtColor( const Mat& src, CV_OUT Mat& dst, int code, int dstCn=0 );
00737 
00739 class CV_EXPORTS_W_MAP Moments
00740 {
00741 public:
00743     Moments();
00745     Moments(double m00, double m10, double m01, double m20, double m11,
00746             double m02, double m30, double m21, double m12, double m03 );
00748     Moments( const CvMoments& moments );
00750     operator CvMoments() const;
00751     
00753     CV_PROP_RW double  m00, m10, m01, m20, m11, m02, m30, m21, m12, m03;
00755     CV_PROP_RW double  mu20, mu11, mu02, mu30, mu21, mu12, mu03;
00757     CV_PROP_RW double  nu20, nu11, nu02, nu30, nu21, nu12, nu03;
00758 };
00759 
00761 CV_EXPORTS_W Moments moments( const Mat& array, bool binaryImage=false );
00762 
00764 CV_EXPORTS void HuMoments( const Moments& moments, double hu[7] );
00765 
00767 enum { TM_SQDIFF=0, TM_SQDIFF_NORMED=1, TM_CCORR=2, TM_CCORR_NORMED=3, TM_CCOEFF=4, TM_CCOEFF_NORMED=5 };
00768 
00770 CV_EXPORTS_W void matchTemplate( const Mat& image, const Mat& templ, CV_OUT Mat& result, int method );
00771 
00773 enum
00774 {
00775     RETR_EXTERNAL=CV_RETR_EXTERNAL, 
00776     RETR_LIST=CV_RETR_LIST, 
00777     RETR_CCOMP=CV_RETR_CCOMP, 
00778     RETR_TREE=CV_RETR_TREE 
00779 };
00780 
00782 enum
00783 {
00784     CHAIN_APPROX_NONE=CV_CHAIN_APPROX_NONE,
00785         CHAIN_APPROX_SIMPLE=CV_CHAIN_APPROX_SIMPLE,
00786         CHAIN_APPROX_TC89_L1=CV_CHAIN_APPROX_TC89_L1,
00787         CHAIN_APPROX_TC89_KCOS=CV_CHAIN_APPROX_TC89_KCOS
00788 };
00789 
00791 CV_EXPORTS void findContours( Mat& image, CV_OUT vector<vector<Point> >& contours,
00792                               vector<Vec4i>& hierarchy, int mode,
00793                               int method, Point offset=Point());
00794 
00796 CV_EXPORTS void findContours( Mat& image, CV_OUT vector<vector<Point> >& contours,
00797                               int mode, int method, Point offset=Point());
00798 
00800 CV_EXPORTS void drawContours( Mat& image, const vector<vector<Point> >& contours,
00801                               int contourIdx, const Scalar& color,
00802                               int thickness=1, int lineType=8,
00803                               const vector<Vec4i>& hierarchy=vector<Vec4i>(),
00804                               int maxLevel=INT_MAX, Point offset=Point() );
00805 
00807 CV_EXPORTS void approxPolyDP( const Mat& curve,
00808                               CV_OUT vector<Point>& approxCurve,
00809                               double epsilon, bool closed );
00811 CV_EXPORTS void approxPolyDP( const Mat& curve,
00812                               CV_OUT vector<Point2f>& approxCurve,
00813                               double epsilon, bool closed );
00815 CV_EXPORTS_W double arcLength( const Mat& curve, bool closed );
00817 CV_EXPORTS_W Rect boundingRect( const Mat& points );
00819 CV_EXPORTS_W double contourArea( const Mat& contour, bool oriented=false );
00821 CV_EXPORTS_W RotatedRect minAreaRect( const Mat& points );
00823 CV_EXPORTS_W void minEnclosingCircle( const Mat& points,
00824                                     Point2f& center, float& radius );    
00826 CV_EXPORTS_W double matchShapes( const Mat& contour1,
00827                                const Mat& contour2,
00828                                int method, double parameter );
00830 CV_EXPORTS void convexHull( const Mat& points, CV_OUT vector<int>& hull, bool clockwise=false );
00832 CV_EXPORTS void convexHull( const Mat& points, CV_OUT vector<Point>& hull, bool clockwise=false );
00834 CV_EXPORTS void convexHull( const Mat& points, CV_OUT vector<Point2f>& hull, bool clockwise=false );
00835 
00837 CV_EXPORTS_W bool isContourConvex( const Mat& contour );
00838 
00840 CV_EXPORTS_W RotatedRect fitEllipse( const Mat& points );
00841 
00843 CV_EXPORTS void fitLine( const Mat& points, CV_OUT Vec4f& line, int distType,
00844                            double param, double reps, double aeps );
00846 CV_EXPORTS void fitLine( const Mat& points, CV_OUT Vec6f& line, int distType,
00847                            double param, double reps, double aeps );
00849 CV_EXPORTS_W double pointPolygonTest( const Mat& contour,
00850                                     Point2f pt, bool measureDist );
00851     
00853 CV_EXPORTS_W Mat estimateRigidTransform( const Mat& A, const Mat& B,
00854                                        bool fullAffine );
00855     
00856 }
00857 
00858 
00859 // 2009-01-12, Xavier Delacour <xavier.delacour@gmail.com>
00860 
00861 struct lsh_hash {
00862   int h1, h2;
00863 };
00864 
00865 struct CvLSHOperations
00866 {
00867   virtual ~CvLSHOperations() {}
00868 
00869   virtual int vector_add(const void* data) = 0;
00870   virtual void vector_remove(int i) = 0;
00871   virtual const void* vector_lookup(int i) = 0;
00872   virtual void vector_reserve(int n) = 0;
00873   virtual unsigned int vector_count() = 0;
00874 
00875   virtual void hash_insert(lsh_hash h, int l, int i) = 0;
00876   virtual void hash_remove(lsh_hash h, int l, int i) = 0;
00877   virtual int hash_lookup(lsh_hash h, int l, int* ret_i, int ret_i_max) = 0;
00878 };
00879 
00880 #endif /* __cplusplus */
00881 
00882 #endif
00883 
00884 /* End of file. */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines