Cinder

  • Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

include/OpenCV/cv.hpp

Go to the documentation of this file.
00001 /*M///////////////////////////////////////////////////////////////////////////////////////
00002 //
00003 //  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
00004 //
00005 //  By downloading, copying, installing or using the software you agree to this license.
00006 //  If you do not agree to this license, do not download, install,
00007 //  copy or use the software.
00008 //
00009 //
00010 //                           License Agreement
00011 //                For Open Source Computer Vision Library
00012 //
00013 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
00014 // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
00015 // Third party copyrights are property of their respective owners.
00016 //
00017 // Redistribution and use in source and binary forms, with or without modification,
00018 // are permitted provided that the following conditions are met:
00019 //
00020 //   * Redistribution's of source code must retain the above copyright notice,
00021 //     this list of conditions and the following disclaimer.
00022 //
00023 //   * Redistribution's in binary form must reproduce the above copyright notice,
00024 //     this list of conditions and the following disclaimer in the documentation
00025 //     and/or other materials provided with the distribution.
00026 //
00027 //   * The name of the copyright holders may not be used to endorse or promote products
00028 //     derived from this software without specific prior written permission.
00029 //
00030 // This software is provided by the copyright holders and contributors "as is" and
00031 // any express or implied warranties, including, but not limited to, the implied
00032 // warranties of merchantability and fitness for a particular purpose are disclaimed.
00033 // In no event shall the Intel Corporation or contributors be liable for any direct,
00034 // indirect, incidental, special, exemplary, or consequential damages
00035 // (including, but not limited to, procurement of substitute goods or services;
00036 // loss of use, data, or profits; or business interruption) however caused
00037 // and on any theory of liability, whether in contract, strict liability,
00038 // or tort (including negligence or otherwise) arising in any way out of
00039 // the use of this software, even if advised of the possibility of such damage.
00040 //
00041 //M*/
00042 
00043 #ifndef __OPENCV_CV_HPP__
00044 #define __OPENCV_CV_HPP__
00045 
00046 #ifdef __cplusplus
00047 
00048 namespace cv
00049 {
00050 
00051 enum { BORDER_REPLICATE=IPL_BORDER_REPLICATE, BORDER_CONSTANT=IPL_BORDER_CONSTANT,
00052        BORDER_REFLECT=IPL_BORDER_REFLECT, BORDER_REFLECT_101=IPL_BORDER_REFLECT_101,
00053        BORDER_REFLECT101=BORDER_REFLECT_101, BORDER_WRAP=IPL_BORDER_WRAP,
00054        BORDER_TRANSPARENT, BORDER_DEFAULT=BORDER_REFLECT_101, BORDER_ISOLATED=16 };
00055 
00056 CV_EXPORTS int borderInterpolate( int p, int len, int borderType );
00057 
00058 class CV_EXPORTS BaseRowFilter
00059 {
00060 public:
00061     BaseRowFilter();
00062     virtual ~BaseRowFilter();
00063     virtual void operator()(const uchar* src, uchar* dst,
00064                             int width, int cn) = 0;
00065     int ksize, anchor;
00066 };
00067 
00068 
00069 class CV_EXPORTS BaseColumnFilter
00070 {
00071 public:
00072     BaseColumnFilter();
00073     virtual ~BaseColumnFilter();
00074     virtual void operator()(const uchar** src, uchar* dst, int dststep,
00075                             int dstcount, int width) = 0;
00076     virtual void reset();
00077     int ksize, anchor;
00078 };
00079 
00080 
00081 class CV_EXPORTS BaseFilter
00082 {
00083 public:
00084     BaseFilter();
00085     virtual ~BaseFilter();
00086     virtual void operator()(const uchar** src, uchar* dst, int dststep,
00087                             int dstcount, int width, int cn) = 0;
00088     virtual void reset();
00089     Size ksize;
00090     Point anchor;
00091 };
00092 
00093 
00094 class CV_EXPORTS FilterEngine
00095 {
00096 public:
00097     FilterEngine();
00098     FilterEngine(const Ptr<BaseFilter>& _filter2D,
00099                  const Ptr<BaseRowFilter>& _rowFilter,
00100                  const Ptr<BaseColumnFilter>& _columnFilter,
00101                  int srcType, int dstType, int bufType,
00102                  int _rowBorderType=BORDER_REPLICATE,
00103                  int _columnBorderType=-1,
00104                  const Scalar& _borderValue=Scalar());
00105     virtual ~FilterEngine();
00106     void init(const Ptr<BaseFilter>& _filter2D,
00107               const Ptr<BaseRowFilter>& _rowFilter,
00108               const Ptr<BaseColumnFilter>& _columnFilter,
00109               int srcType, int dstType, int bufType,
00110               int _rowBorderType=BORDER_REPLICATE, int _columnBorderType=-1,
00111               const Scalar& _borderValue=Scalar());
00112     virtual int start(Size wholeSize, Rect roi, int maxBufRows=-1);
00113     virtual int start(const Mat& src, const Rect& srcRoi=Rect(0,0,-1,-1),
00114                       bool isolated=false, int maxBufRows=-1);
00115     virtual int proceed(const uchar* src, int srcStep, int srcCount,
00116                         uchar* dst, int dstStep);
00117     virtual void apply( const Mat& src, Mat& dst,
00118                         const Rect& srcRoi=Rect(0,0,-1,-1),
00119                         Point dstOfs=Point(0,0),
00120                         bool isolated=false);
00121     bool isSeparable() const { return (const BaseFilter*)filter2D == 0; }
00122     int remainingInputRows() const;
00123     int remainingOutputRows() const;
00124     
00125     int srcType, dstType, bufType;
00126     Size ksize;
00127     Point anchor;
00128     int maxWidth;
00129     Size wholeSize;
00130     Rect roi;
00131     int dx1, dx2;
00132     int rowBorderType, columnBorderType;
00133     vector<int> borderTab;
00134     int borderElemSize;
00135     vector<uchar> ringBuf;
00136     vector<uchar> srcRow;
00137     vector<uchar> constBorderValue;
00138     vector<uchar> constBorderRow;
00139     int bufStep, startY, startY0, endY, rowCount, dstY;
00140     vector<uchar*> rows;
00141     
00142     Ptr<BaseFilter> filter2D;
00143     Ptr<BaseRowFilter> rowFilter;
00144     Ptr<BaseColumnFilter> columnFilter;
00145 };
00146 
00147 enum { KERNEL_GENERAL=0, KERNEL_SYMMETRICAL=1, KERNEL_ASYMMETRICAL=2,
00148        KERNEL_SMOOTH=4, KERNEL_INTEGER=8 };
00149 
00150 CV_EXPORTS int getKernelType(const Mat& kernel, Point anchor);
00151 
00152 CV_EXPORTS Ptr<BaseRowFilter> getLinearRowFilter(int srcType, int bufType,
00153                                             const Mat& kernel, int anchor,
00154                                             int symmetryType);
00155 
00156 CV_EXPORTS Ptr<BaseColumnFilter> getLinearColumnFilter(int bufType, int dstType,
00157                                             const Mat& kernel, int anchor,
00158                                             int symmetryType, double delta=0,
00159                                             int bits=0);
00160 
00161 CV_EXPORTS Ptr<BaseFilter> getLinearFilter(int srcType, int dstType,
00162                                            const Mat& kernel,
00163                                            Point anchor=Point(-1,-1),
00164                                            double delta=0, int bits=0);
00165 
00166 CV_EXPORTS Ptr<FilterEngine> createSeparableLinearFilter(int srcType, int dstType,
00167                           const Mat& rowKernel, const Mat& columnKernel,
00168                           Point _anchor=Point(-1,-1), double delta=0,
00169                           int _rowBorderType=BORDER_DEFAULT,
00170                           int _columnBorderType=-1,
00171                           const Scalar& _borderValue=Scalar());
00172 
00173 CV_EXPORTS Ptr<FilterEngine> createLinearFilter(int srcType, int dstType,
00174                  const Mat& kernel, Point _anchor=Point(-1,-1),
00175                  double delta=0, int _rowBorderType=BORDER_DEFAULT,
00176                  int _columnBorderType=-1, const Scalar& _borderValue=Scalar());
00177 
00178 CV_EXPORTS Mat getGaussianKernel( int ksize, double sigma, int ktype=CV_64F );
00179 
00180 CV_EXPORTS Ptr<FilterEngine> createGaussianFilter( int type, Size ksize,
00181                                     double sigma1, double sigma2=0,
00182                                     int borderType=BORDER_DEFAULT);
00183 
00184 CV_EXPORTS void getDerivKernels( Mat& kx, Mat& ky, int dx, int dy, int ksize,
00185                                  bool normalize=false, int ktype=CV_32F );
00186 
00187 CV_EXPORTS Ptr<FilterEngine> createDerivFilter( int srcType, int dstType,
00188                                         int dx, int dy, int ksize,
00189                                         int borderType=BORDER_DEFAULT );
00190 
00191 CV_EXPORTS Ptr<BaseRowFilter> getRowSumFilter(int srcType, int sumType,
00192                                                  int ksize, int anchor=-1);
00193 CV_EXPORTS Ptr<BaseColumnFilter> getColumnSumFilter(int sumType, int dstType,
00194                                                        int ksize, int anchor=-1,
00195                                                        double scale=1);
00196 CV_EXPORTS Ptr<FilterEngine> createBoxFilter( int srcType, int dstType, Size ksize,
00197                                                  Point anchor=Point(-1,-1),
00198                                                  bool normalize=true,
00199                                                  int borderType=BORDER_DEFAULT);
00200 
00201 enum { MORPH_ERODE=0, MORPH_DILATE=1, MORPH_OPEN=2, MORPH_CLOSE=3,
00202        MORPH_GRADIENT=4, MORPH_TOPHAT=5, MORPH_BLACKHAT=6 };
00203 
00204 CV_EXPORTS Ptr<BaseRowFilter> getMorphologyRowFilter(int op, int type, int ksize, int anchor=-1);
00205 CV_EXPORTS Ptr<BaseColumnFilter> getMorphologyColumnFilter(int op, int type, int ksize, int anchor=-1);
00206 CV_EXPORTS Ptr<BaseFilter> getMorphologyFilter(int op, int type, const Mat& kernel,
00207                                                Point anchor=Point(-1,-1));
00208 
00209 static inline Scalar morphologyDefaultBorderValue() { return Scalar::all(DBL_MAX); }
00210 
00211 CV_EXPORTS Ptr<FilterEngine> createMorphologyFilter(int op, int type, const Mat& kernel,
00212                     Point anchor=Point(-1,-1), int _rowBorderType=BORDER_CONSTANT,
00213                     int _columnBorderType=-1,
00214                     const Scalar& _borderValue=morphologyDefaultBorderValue());
00215 
00216 enum { MORPH_RECT=0, MORPH_CROSS=1, MORPH_ELLIPSE=2 };
00217 CV_EXPORTS Mat getStructuringElement(int shape, Size ksize, Point anchor=Point(-1,-1));
00218 
00219 template<> inline void Ptr<IplConvKernel>::delete_obj()
00220 { cvReleaseStructuringElement(&obj); }
00221 
00222     
00223 CV_EXPORTS void copyMakeBorder( const Mat& src, Mat& dst,
00224                                 int top, int bottom, int left, int right,
00225                                 int borderType, const Scalar& value=Scalar() );
00226 
00227 CV_EXPORTS void medianBlur( const Mat& src, Mat& dst, int ksize );
00228 CV_EXPORTS void GaussianBlur( const Mat& src, Mat& dst, Size ksize,
00229                               double sigma1, double sigma2=0,
00230                               int borderType=BORDER_DEFAULT );
00231 CV_EXPORTS void bilateralFilter( const Mat& src, Mat& dst, int d,
00232                                  double sigmaColor, double sigmaSpace,
00233                                  int borderType=BORDER_DEFAULT );
00234 CV_EXPORTS void boxFilter( const Mat& src, Mat& dst, int ddepth,
00235                            Size ksize, Point anchor=Point(-1,-1),
00236                            bool normalize=true,
00237                            int borderType=BORDER_DEFAULT );
00238 static inline void blur( const Mat& src, Mat& dst,
00239                          Size ksize, Point anchor=Point(-1,-1),
00240                          int borderType=BORDER_DEFAULT )
00241 {
00242     boxFilter( src, dst, -1, ksize, anchor, true, borderType );
00243 }
00244 
00245 CV_EXPORTS void filter2D( const Mat& src, Mat& dst, int ddepth,
00246                           const Mat& kernel, Point anchor=Point(-1,-1),
00247                           double delta=0, int borderType=BORDER_DEFAULT );
00248 
00249 CV_EXPORTS void sepFilter2D( const Mat& src, Mat& dst, int ddepth,
00250                              const Mat& kernelX, const Mat& kernelY,
00251                              Point anchor=Point(-1,-1),
00252                              double delta=0, int borderType=BORDER_DEFAULT );
00253 
00254 CV_EXPORTS void Sobel( const Mat& src, Mat& dst, int ddepth,
00255                        int dx, int dy, int ksize=3,
00256                        double scale=1, double delta=0,
00257                        int borderType=BORDER_DEFAULT );
00258 
00259 CV_EXPORTS void Scharr( const Mat& src, Mat& dst, int ddepth,
00260                         int dx, int dy, double scale=1, double delta=0,
00261                         int borderType=BORDER_DEFAULT );
00262 
00263 CV_EXPORTS void Laplacian( const Mat& src, Mat& dst, int ddepth,
00264                            int ksize=1, double scale=1, double delta=0,
00265                            int borderType=BORDER_DEFAULT );
00266 
00267 CV_EXPORTS void Canny( const Mat& image, Mat& edges,
00268                        double threshold1, double threshold2,
00269                        int apertureSize=3, bool L2gradient=false );
00270 
00271 CV_EXPORTS void cornerMinEigenVal( const Mat& src, Mat& dst,
00272                                    int blockSize, int ksize=3,
00273                                    int borderType=BORDER_DEFAULT );
00274 
00275 CV_EXPORTS void cornerHarris( const Mat& src, Mat& dst, int blockSize,
00276                               int ksize, double k,
00277                               int borderType=BORDER_DEFAULT );
00278 
00279 CV_EXPORTS void cornerEigenValsAndVecs( const Mat& src, Mat& dst,
00280                                         int blockSize, int ksize,
00281                                         int borderType=BORDER_DEFAULT );
00282 
00283 CV_EXPORTS void preCornerDetect( const Mat& src, Mat& dst, int ksize,
00284                                  int borderType=BORDER_DEFAULT );
00285 
00286 CV_EXPORTS void cornerSubPix( const Mat& image, vector<Point2f>& corners,
00287                               Size winSize, Size zeroZone,
00288                               TermCriteria criteria );
00289 
00290 CV_EXPORTS void goodFeaturesToTrack( const Mat& image, vector<Point2f>& corners,
00291                                      int maxCorners, double qualityLevel, double minDistance,
00292                                      const Mat& mask=Mat(), int blockSize=3,
00293                                      bool useHarrisDetector=false, double k=0.04 );
00294 
00295 CV_EXPORTS void HoughLines( const Mat& image, vector<Vec2f>& lines,
00296                             double rho, double theta, int threshold,
00297                             double srn=0, double stn=0 );
00298 
00299 CV_EXPORTS void HoughLinesP( Mat& image, vector<Vec4i>& lines,
00300                              double rho, double theta, int threshold,
00301                              double minLineLength=0, double maxLineGap=0 );
00302 
00303 CV_EXPORTS void HoughCircles( const Mat& image, vector<Vec3f>& circles,
00304                               int method, double dp, double minDist,
00305                               double param1=100, double param2=100,
00306                               int minRadius=0, int maxRadius=0 );
00307 
00308 CV_EXPORTS void erode( const Mat& src, Mat& dst, const Mat& kernel,
00309                        Point anchor=Point(-1,-1), int iterations=1,
00310                        int borderType=BORDER_CONSTANT,
00311                        const Scalar& borderValue=morphologyDefaultBorderValue() );
00312 CV_EXPORTS void dilate( const Mat& src, Mat& dst, const Mat& kernel,
00313                         Point anchor=Point(-1,-1), int iterations=1,
00314                         int borderType=BORDER_CONSTANT,
00315                         const Scalar& borderValue=morphologyDefaultBorderValue() );
00316 CV_EXPORTS void morphologyEx( const Mat& src, Mat& dst, int op, const Mat& kernel,
00317                               Point anchor=Point(-1,-1), int iterations=1,
00318                               int borderType=BORDER_CONSTANT,
00319                               const Scalar& borderValue=morphologyDefaultBorderValue() );
00320 
00321 enum { INTER_NEAREST=0, INTER_LINEAR=1, INTER_CUBIC=2, INTER_AREA=3,
00322        INTER_LANCZOS4=4, INTER_MAX=7, WARP_INVERSE_MAP=16 };
00323 
00324 CV_EXPORTS void resize( const Mat& src, Mat& dst,
00325                         Size dsize, double fx=0, double fy=0,
00326                         int interpolation=INTER_LINEAR );
00327 
00328 CV_EXPORTS void warpAffine( const Mat& src, Mat& dst,
00329                             const Mat& M, Size dsize,
00330                             int flags=INTER_LINEAR,
00331                             int borderMode=BORDER_CONSTANT,
00332                             const Scalar& borderValue=Scalar());
00333 CV_EXPORTS void warpPerspective( const Mat& src, Mat& dst,
00334                                  const Mat& M, Size dsize,
00335                                  int flags=INTER_LINEAR,
00336                                  int borderMode=BORDER_CONSTANT,
00337                                  const Scalar& borderValue=Scalar());
00338 
00339 CV_EXPORTS void remap( const Mat& src, Mat& dst, const Mat& map1, const Mat& map2,
00340                        int interpolation, int borderMode=BORDER_CONSTANT,
00341                        const Scalar& borderValue=Scalar());
00342 
00343 CV_EXPORTS void convertMaps( const Mat& map1, const Mat& map2, Mat& dstmap1, Mat& dstmap2,
00344                              int dstmap1type, bool nninterpolation=false );
00345 
00346 CV_EXPORTS Mat getRotationMatrix2D( Point2f center, double angle, double scale );
00347 CV_EXPORTS Mat getPerspectiveTransform( const Point2f src[], const Point2f dst[] );
00348 CV_EXPORTS Mat getAffineTransform( const Point2f src[], const Point2f dst[] );
00349 CV_EXPORTS void invertAffineTransform(const Mat& M, Mat& iM);
00350 
00351 CV_EXPORTS void getRectSubPix( const Mat& image, Size patchSize,
00352                                Point2f center, Mat& patch, int patchType=-1 );
00353 
00354 CV_EXPORTS void integral( const Mat& src, Mat& sum, int sdepth=-1 );
00355 CV_EXPORTS void integral( const Mat& src, Mat& sum, Mat& sqsum, int sdepth=-1 );
00356 CV_EXPORTS void integral( const Mat& src, Mat& sum, Mat& sqsum, Mat& tilted, int sdepth=-1 );
00357 
00358 CV_EXPORTS void accumulate( const Mat& src, Mat& dst, const Mat& mask=Mat() );
00359 CV_EXPORTS void accumulateSquare( const Mat& src, Mat& dst, const Mat& mask=Mat() );
00360 CV_EXPORTS void accumulateProduct( const Mat& src1, const Mat& src2,
00361                                    Mat& dst, const Mat& mask=Mat() );
00362 CV_EXPORTS void accumulateWeighted( const Mat& src, Mat& dst,
00363                                     double alpha, const Mat& mask=Mat() );
00364 
00365 enum { THRESH_BINARY=0, THRESH_BINARY_INV=1, THRESH_TRUNC=2, THRESH_TOZERO=3,
00366        THRESH_TOZERO_INV=4, THRESH_MASK=7, THRESH_OTSU=8 };
00367 
00368 CV_EXPORTS double threshold( const Mat& src, Mat& dst, double thresh, double maxval, int type );
00369 
00370 enum { ADAPTIVE_THRESH_MEAN_C=0, ADAPTIVE_THRESH_GAUSSIAN_C=1 };
00371 
00372 CV_EXPORTS void adaptiveThreshold( const Mat& src, Mat& dst, double maxValue,
00373                                    int adaptiveMethod, int thresholdType,
00374                                    int blockSize, double C );
00375 
00376 CV_EXPORTS void pyrDown( const Mat& src, Mat& dst, const Size& dstsize=Size());
00377 CV_EXPORTS void pyrUp( const Mat& src, Mat& dst, const Size& dstsize=Size());
00378 CV_EXPORTS void buildPyramid( const Mat& src, vector<Mat>& dst, int maxlevel );
00379 
00380 
00381 CV_EXPORTS void undistort( const Mat& src, Mat& dst, const Mat& cameraMatrix,
00382                            const Mat& distCoeffs, const Mat& newCameraMatrix=Mat() );
00383 CV_EXPORTS void initUndistortRectifyMap( const Mat& cameraMatrix, const Mat& distCoeffs,
00384                            const Mat& R, const Mat& newCameraMatrix,
00385                            Size size, int m1type, Mat& map1, Mat& map2 );
00386 CV_EXPORTS Mat getOptimalNewCameraMatrix( const Mat& cameraMatrix, const Mat& distCoeffs,
00387                                           Size imageSize, double alpha, Size newImgSize=Size(),
00388                                           Rect* validPixROI=0);
00389 CV_EXPORTS Mat getDefaultNewCameraMatrix( const Mat& cameraMatrix, Size imgsize=Size(),
00390                                           bool centerPrincipalPoint=false );
00391 
00392 enum { OPTFLOW_USE_INITIAL_FLOW=4, OPTFLOW_FARNEBACK_GAUSSIAN=256 };
00393 
00394 CV_EXPORTS void calcOpticalFlowPyrLK( const Mat& prevImg, const Mat& nextImg,
00395                            const vector<Point2f>& prevPts, vector<Point2f>& nextPts,
00396                            vector<uchar>& status, vector<float>& err,
00397                            Size winSize=Size(15,15), int maxLevel=3,
00398                            TermCriteria criteria=TermCriteria(
00399                             TermCriteria::COUNT+TermCriteria::EPS,
00400                             30, 0.01),
00401                            double derivLambda=0.5,
00402                            int flags=0 );
00403 
00404 CV_EXPORTS void calcOpticalFlowFarneback( const Mat& prev0, const Mat& next0,
00405                                Mat& flow0, double pyr_scale, int levels, int winsize,
00406                                int iterations, int poly_n, double poly_sigma, int flags );
00407     
00408 
00409 template<> inline void Ptr<CvHistogram>::delete_obj()
00410 { cvReleaseHist(&obj); }
00411     
00412 CV_EXPORTS void calcHist( const Mat* images, int nimages,
00413                           const int* channels, const Mat& mask,
00414                           MatND& hist, int dims, const int* histSize,
00415                           const float** ranges, bool uniform=true,
00416                           bool accumulate=false );
00417 
00418 CV_EXPORTS void calcHist( const Mat* images, int nimages,
00419                           const int* channels, const Mat& mask,
00420                           SparseMat& hist, int dims, const int* histSize,
00421                           const float** ranges, bool uniform=true,
00422                           bool accumulate=false );
00423     
00424 CV_EXPORTS void calcBackProject( const Mat* images, int nimages,
00425                                  const int* channels, const MatND& hist,
00426                                  Mat& backProject, const float** ranges,
00427                                  double scale=1, bool uniform=true );
00428     
00429 CV_EXPORTS void calcBackProject( const Mat* images, int nimages,
00430                                  const int* channels, const SparseMat& hist,
00431                                  Mat& backProject, const float** ranges,
00432                                  double scale=1, bool uniform=true );
00433 
00434 CV_EXPORTS double compareHist( const MatND& H1, const MatND& H2, int method );
00435 
00436 CV_EXPORTS double compareHist( const SparseMat& H1, const SparseMat& H2, int method );
00437 
00438 CV_EXPORTS void equalizeHist( const Mat& src, Mat& dst );
00439 
00440 CV_EXPORTS void watershed( const Mat& image, Mat& markers );
00441 
00442 enum { GC_BGD    = 0,  // background
00443        GC_FGD    = 1,  // foreground
00444        GC_PR_BGD = 2,  // most probably background
00445        GC_PR_FGD = 3   // most probably foreground 
00446      };
00447 
00448 enum { GC_INIT_WITH_RECT  = 0,
00449        GC_INIT_WITH_MASK  = 1,
00450        GC_EVAL            = 2
00451      };
00452 
00453 CV_EXPORTS void grabCut( const Mat& img, Mat& mask, Rect rect, 
00454                          Mat& bgdModel, Mat& fgdModel,
00455                          int iterCount, int mode = GC_EVAL );
00456 
00457 enum { INPAINT_NS=CV_INPAINT_NS, INPAINT_TELEA=CV_INPAINT_TELEA };
00458 
00459 CV_EXPORTS void inpaint( const Mat& src, const Mat& inpaintMask,
00460                          Mat& dst, double inpaintRange, int flags );
00461 
00462 CV_EXPORTS void distanceTransform( const Mat& src, Mat& dst, Mat& labels,
00463                                    int distanceType, int maskSize );
00464 
00465 CV_EXPORTS void distanceTransform( const Mat& src, Mat& dst,
00466                                    int distanceType, int maskSize );
00467 
00468 enum { FLOODFILL_FIXED_RANGE = 1 << 16,
00469        FLOODFILL_MASK_ONLY = 1 << 17 };
00470 
00471 CV_EXPORTS int floodFill( Mat& image,
00472                           Point seedPoint, Scalar newVal, Rect* rect=0,
00473                           Scalar loDiff=Scalar(), Scalar upDiff=Scalar(),
00474                           int flags=4 );
00475 
00476 CV_EXPORTS int floodFill( Mat& image, Mat& mask,
00477                           Point seedPoint, Scalar newVal, Rect* rect=0,
00478                           Scalar loDiff=Scalar(), Scalar upDiff=Scalar(),
00479                           int flags=4 );
00480 
00481 CV_EXPORTS void cvtColor( const Mat& src, Mat& dst, int code, int dstCn=0 );
00482 
00483 class CV_EXPORTS Moments
00484 {
00485 public:
00486     Moments();
00487     Moments(double m00, double m10, double m01, double m20, double m11,
00488             double m02, double m30, double m21, double m12, double m03 );
00489     Moments( const CvMoments& moments );
00490     operator CvMoments() const;
00491     
00492     double  m00, m10, m01, m20, m11, m02, m30, m21, m12, m03; // spatial moments
00493     double  mu20, mu11, mu02, mu30, mu21, mu12, mu03; // central moments
00494     double  nu20, nu11, nu02, nu30, nu21, nu12, nu03; // central normalized moments
00495 };
00496 
00497 CV_EXPORTS Moments moments( const Mat& array, bool binaryImage=false );
00498 
00499 CV_EXPORTS void HuMoments( const Moments& moments, double hu[7] );
00500 
00501 enum { TM_SQDIFF=CV_TM_SQDIFF, TM_SQDIFF_NORMED=CV_TM_SQDIFF_NORMED,
00502        TM_CCORR=CV_TM_CCORR, TM_CCORR_NORMED=CV_TM_CCORR_NORMED,
00503        TM_CCOEFF=CV_TM_CCOEFF, TM_CCOEFF_NORMED=CV_TM_CCOEFF_NORMED };
00504 
00505 CV_EXPORTS void matchTemplate( const Mat& image, const Mat& templ, Mat& result, int method );
00506 
00507 enum { RETR_EXTERNAL=CV_RETR_EXTERNAL, RETR_LIST=CV_RETR_LIST,
00508        RETR_CCOMP=CV_RETR_CCOMP, RETR_TREE=CV_RETR_TREE };
00509 
00510 enum { CHAIN_APPROX_NONE=CV_CHAIN_APPROX_NONE,
00511        CHAIN_APPROX_SIMPLE=CV_CHAIN_APPROX_SIMPLE,
00512        CHAIN_APPROX_TC89_L1=CV_CHAIN_APPROX_TC89_L1,
00513        CHAIN_APPROX_TC89_KCOS=CV_CHAIN_APPROX_TC89_KCOS };
00514 
00515 CV_EXPORTS void findContours( Mat& image, vector<vector<Point> >& contours,
00516                               vector<Vec4i>& hierarchy, int mode,
00517                               int method, Point offset=Point());
00518 
00519 CV_EXPORTS void findContours( Mat& image, vector<vector<Point> >& contours,
00520                               int mode, int method, Point offset=Point());
00521 
00522 CV_EXPORTS void drawContours( Mat& image, const vector<vector<Point> >& contours,
00523                               int contourIdx, const Scalar& color,
00524                               int thickness=1, int lineType=8,
00525                               const vector<Vec4i>& hierarchy=vector<Vec4i>(),
00526                               int maxLevel=INT_MAX, Point offset=Point() );
00527 
00528 CV_EXPORTS void approxPolyDP( const Mat& curve,
00529                               vector<Point>& approxCurve,
00530                               double epsilon, bool closed );
00531 CV_EXPORTS void approxPolyDP( const Mat& curve,
00532                               vector<Point2f>& approxCurve,
00533                               double epsilon, bool closed );
00534     
00535 CV_EXPORTS double arcLength( const Mat& curve, bool closed );
00536 CV_EXPORTS Rect boundingRect( const Mat& points );
00537 CV_EXPORTS double contourArea( const Mat& contour, bool oriented=false );    
00538 CV_EXPORTS RotatedRect minAreaRect( const Mat& points );
00539 CV_EXPORTS void minEnclosingCircle( const Mat& points,
00540                                     Point2f& center, float& radius );    
00541 CV_EXPORTS double matchShapes( const Mat& contour1,
00542                                const Mat& contour2,
00543                                int method, double parameter );
00544     
00545 CV_EXPORTS void convexHull( const Mat& points, vector<int>& hull, bool clockwise=false );
00546 CV_EXPORTS void convexHull( const Mat& points, vector<Point>& hull, bool clockwise=false );
00547 CV_EXPORTS void convexHull( const Mat& points, vector<Point2f>& hull, bool clockwise=false );
00548 
00549 CV_EXPORTS bool isContourConvex( const Mat& contour );
00550 
00551 CV_EXPORTS RotatedRect fitEllipse( const Mat& points );
00552 
00553 CV_EXPORTS void fitLine( const Mat& points, Vec4f& line, int distType,
00554                          double param, double reps, double aeps );
00555 CV_EXPORTS void fitLine( const Mat& points, Vec6f& line, int distType,
00556                          double param, double reps, double aeps );
00557 
00558 CV_EXPORTS double pointPolygonTest( const Mat& contour,
00559                                     Point2f pt, bool measureDist );
00560 
00561 CV_EXPORTS Mat estimateRigidTransform( const Mat& A, const Mat& B,
00562                                        bool fullAffine );
00563 
00564 CV_EXPORTS void updateMotionHistory( const Mat& silhouette, Mat& mhi,
00565                                      double timestamp, double duration );
00566 
00567 CV_EXPORTS void calcMotionGradient( const Mat& mhi, Mat& mask,
00568                                     Mat& orientation,
00569                                     double delta1, double delta2,
00570                                     int apertureSize=3 );
00571 
00572 CV_EXPORTS double calcGlobalOrientation( const Mat& orientation, const Mat& mask,
00573                                          const Mat& mhi, double timestamp,
00574                                          double duration );
00575 // TODO: need good API for cvSegmentMotion
00576 
00577 CV_EXPORTS RotatedRect CamShift( const Mat& probImage, Rect& window,
00578                                  TermCriteria criteria );
00579 
00580 CV_EXPORTS int meanShift( const Mat& probImage, Rect& window,
00581                           TermCriteria criteria );
00582 
00583 CV_EXPORTS int estimateAffine3D(const Mat& from, const Mat& to, Mat& out,
00584                                 vector<uchar>& outliers,
00585                                 double param1 = 3.0, double param2 = 0.99);
00586 
00587 class CV_EXPORTS KalmanFilter
00588 {
00589 public:
00590     KalmanFilter();
00591     KalmanFilter(int dynamParams, int measureParams, int controlParams=0);
00592     void init(int dynamParams, int measureParams, int controlParams=0);
00593 
00594     const Mat& predict(const Mat& control=Mat());
00595     const Mat& correct(const Mat& measurement);
00596 
00597     Mat statePre;           // predicted state (x'(k)):
00598                             //    x(k)=A*x(k-1)+B*u(k)
00599     Mat statePost;          // corrected state (x(k)):
00600                             //    x(k)=x'(k)+K(k)*(z(k)-H*x'(k))
00601     Mat transitionMatrix;   // state transition matrix (A)
00602     Mat controlMatrix;      // control matrix (B)
00603                             //   (it is not used if there is no control)
00604     Mat measurementMatrix;  // measurement matrix (H)
00605     Mat processNoiseCov;    // process noise covariance matrix (Q)
00606     Mat measurementNoiseCov;// measurement noise covariance matrix (R)
00607     Mat errorCovPre;        // priori error estimate covariance matrix (P'(k)):
00608                             //    P'(k)=A*P(k-1)*At + Q)*/
00609     Mat gain;               // Kalman gain matrix (K(k)):
00610                             //    K(k)=P'(k)*Ht*inv(H*P'(k)*Ht+R)
00611     Mat errorCovPost;       // posteriori error estimate covariance matrix (P(k)):
00612                             //    P(k)=(I-K(k)*H)*P'(k)
00613     Mat temp1;              // temporary matrices
00614     Mat temp2;
00615     Mat temp3;
00616     Mat temp4;
00617     Mat temp5;
00618 };
00619 
00620 
00622 
00623 CV_EXPORTS void groupRectangles(vector<Rect>& rectList, int groupThreshold, double eps=0.2);
00624 CV_EXPORTS void groupRectangles(vector<Rect>& rectList, vector<int>& weights, int groupThreshold, double eps=0.2);
00625         
00626 class CV_EXPORTS FeatureEvaluator
00627 {
00628 public:    
00629     enum { HAAR = 0, LBP = 1 };
00630     virtual ~FeatureEvaluator();
00631     virtual bool read(const FileNode& node);
00632     virtual Ptr<FeatureEvaluator> clone() const;
00633     virtual int getFeatureType() const;
00634     
00635     virtual bool setImage(const Mat&, Size origWinSize);
00636     virtual bool setWindow(Point p);
00637 
00638     virtual double calcOrd(int featureIdx) const;
00639     virtual int calcCat(int featureIdx) const;
00640 
00641     static Ptr<FeatureEvaluator> create(int type);
00642 };
00643     
00644 template<> inline void Ptr<CvHaarClassifierCascade>::delete_obj()
00645 { cvReleaseHaarClassifierCascade(&obj); }    
00646    
00647 class CV_EXPORTS CascadeClassifier
00648 {
00649 public:
00650     struct CV_EXPORTS DTreeNode
00651     {
00652         int featureIdx;
00653         float threshold; // for ordered features only
00654         int left;
00655         int right;
00656     };
00657     
00658     struct CV_EXPORTS DTree
00659     {
00660         int nodeCount;
00661     };
00662     
00663     struct CV_EXPORTS Stage
00664     {
00665         int first;
00666         int ntrees;
00667         float threshold;
00668     };
00669     
00670     enum { BOOST = 0 };
00671     enum { DO_CANNY_PRUNING = CV_HAAR_DO_CANNY_PRUNING,
00672            SCALE_IMAGE = CV_HAAR_SCALE_IMAGE,
00673            FIND_BIGGEST_OBJECT = CV_HAAR_FIND_BIGGEST_OBJECT,
00674            DO_ROUGH_SEARCH = CV_HAAR_DO_ROUGH_SEARCH };
00675 
00676     CascadeClassifier();
00677     CascadeClassifier(const string& filename);
00678     ~CascadeClassifier();
00679     
00680     bool empty() const;
00681     bool load(const string& filename);
00682     bool read(const FileNode& node);
00683     void detectMultiScale( const Mat& image,
00684                            vector<Rect>& objects,
00685                            double scaleFactor=1.1,
00686                            int minNeighbors=3, int flags=0,
00687                            Size minSize=Size());
00688  
00689     bool setImage( Ptr<FeatureEvaluator>&, const Mat& );
00690     int runAt( Ptr<FeatureEvaluator>&, Point );
00691 
00692     bool is_stump_based;
00693 
00694     int stageType;
00695     int featureType;
00696     int ncategories;
00697     Size origWinSize;
00698     
00699     vector<Stage> stages;
00700     vector<DTree> classifiers;
00701     vector<DTreeNode> nodes;
00702     vector<float> leaves;
00703     vector<int> subsets;
00704 
00705     Ptr<FeatureEvaluator> feval;
00706     Ptr<CvHaarClassifierCascade> oldCascade;
00707 };
00708 
00709     
00710 CV_EXPORTS void undistortPoints( const Mat& src, vector<Point2f>& dst,
00711                                  const Mat& cameraMatrix, const Mat& distCoeffs,
00712                                  const Mat& R=Mat(), const Mat& P=Mat());
00713 CV_EXPORTS void undistortPoints( const Mat& src, Mat& dst,
00714                                  const Mat& cameraMatrix, const Mat& distCoeffs,
00715                                  const Mat& R=Mat(), const Mat& P=Mat());
00716 
00717 CV_EXPORTS void Rodrigues(const Mat& src, Mat& dst);
00718 CV_EXPORTS void Rodrigues(const Mat& src, Mat& dst, Mat& jacobian);
00719 
00720 enum { LMEDS=4, RANSAC=8 };
00721 
00722 CV_EXPORTS Mat findHomography( const Mat& srcPoints,
00723                                const Mat& dstPoints,
00724                                Mat& mask, int method=0,
00725                                double ransacReprojThreshold=0 );
00726     
00727 CV_EXPORTS Mat findHomography( const Mat& srcPoints,
00728                                const Mat& dstPoints,
00729                                vector<uchar>& mask, int method=0,
00730                                double ransacReprojThreshold=0 );
00731 
00732 CV_EXPORTS Mat findHomography( const Mat& srcPoints,
00733                                const Mat& dstPoints,
00734                                int method=0, double ransacReprojThreshold=0 );
00735 
00736 /* Computes RQ decomposition for 3x3 matrices */
00737 CV_EXPORTS void RQDecomp3x3( const Mat& M, Mat& R, Mat& Q );
00738 CV_EXPORTS Vec3d RQDecomp3x3( const Mat& M, Mat& R, Mat& Q,
00739                               Mat& Qx, Mat& Qy, Mat& Qz );
00740 
00741 CV_EXPORTS void decomposeProjectionMatrix( const Mat& projMatrix, Mat& cameraMatrix,
00742                                            Mat& rotMatrix, Mat& transVect );
00743 CV_EXPORTS void decomposeProjectionMatrix( const Mat& projMatrix, Mat& cameraMatrix,
00744                                            Mat& rotMatrix, Mat& transVect,
00745                                            Mat& rotMatrixX, Mat& rotMatrixY,
00746                                            Mat& rotMatrixZ, Vec3d& eulerAngles );
00747 
00748 CV_EXPORTS void matMulDeriv( const Mat& A, const Mat& B, Mat& dABdA, Mat& dABdB );
00749 
00750 CV_EXPORTS void composeRT( const Mat& rvec1, const Mat& tvec1,
00751                            const Mat& rvec2, const Mat& tvec2,
00752                            Mat& rvec3, Mat& tvec3 );
00753 
00754 CV_EXPORTS void composeRT( const Mat& rvec1, const Mat& tvec1,
00755                            const Mat& rvec2, const Mat& tvec2,
00756                            Mat& rvec3, Mat& tvec3,
00757                            Mat& dr3dr1, Mat& dr3dt1,
00758                            Mat& dr3dr2, Mat& dr3dt2,
00759                            Mat& dt3dr1, Mat& dt3dt1,
00760                            Mat& dt3dr2, Mat& dt3dt2 );
00761 
00762 CV_EXPORTS void projectPoints( const Mat& objectPoints,
00763                                const Mat& rvec, const Mat& tvec,
00764                                const Mat& cameraMatrix,
00765                                const Mat& distCoeffs,
00766                                vector<Point2f>& imagePoints );
00767 
00768 CV_EXPORTS void projectPoints( const Mat& objectPoints,
00769                                const Mat& rvec, const Mat& tvec,
00770                                const Mat& cameraMatrix,
00771                                const Mat& distCoeffs,
00772                                vector<Point2f>& imagePoints,
00773                                Mat& dpdrot, Mat& dpdt, Mat& dpdf,
00774                                Mat& dpdc, Mat& dpddist,
00775                                double aspectRatio=0 );
00776 
00777 CV_EXPORTS void solvePnP( const Mat& objectPoints,
00778                           const Mat& imagePoints,
00779                           const Mat& cameraMatrix,
00780                           const Mat& distCoeffs,
00781                           Mat& rvec, Mat& tvec,
00782                           bool useExtrinsicGuess=false );
00783 
00784 CV_EXPORTS Mat initCameraMatrix2D( const vector<vector<Point3f> >& objectPoints,
00785                                    const vector<vector<Point2f> >& imagePoints,
00786                                    Size imageSize, double aspectRatio=1. );
00787 
00788 enum { CALIB_CB_ADAPTIVE_THRESH = CV_CALIB_CB_ADAPTIVE_THRESH,
00789        CALIB_CB_NORMALIZE_IMAGE = CV_CALIB_CB_NORMALIZE_IMAGE,
00790        CALIB_CB_FILTER_QUADS = CV_CALIB_CB_FILTER_QUADS };
00791 
00792 CV_EXPORTS bool findChessboardCorners( const Mat& image, Size patternSize,
00793                                        vector<Point2f>& corners,
00794                                        int flags=CV_CALIB_CB_ADAPTIVE_THRESH+
00795                                             CV_CALIB_CB_NORMALIZE_IMAGE );
00796 
00797 CV_EXPORTS void drawChessboardCorners( Mat& image, Size patternSize,
00798                                        const Mat& corners,
00799                                        bool patternWasFound );
00800 
00801 enum
00802 {
00803     CALIB_USE_INTRINSIC_GUESS = CV_CALIB_USE_INTRINSIC_GUESS,
00804     CALIB_FIX_ASPECT_RATIO = CV_CALIB_FIX_ASPECT_RATIO,
00805     CALIB_FIX_PRINCIPAL_POINT = CV_CALIB_FIX_PRINCIPAL_POINT,
00806     CALIB_ZERO_TANGENT_DIST = CV_CALIB_ZERO_TANGENT_DIST,
00807     CALIB_FIX_FOCAL_LENGTH = CV_CALIB_FIX_FOCAL_LENGTH,
00808     CALIB_FIX_K1 = CV_CALIB_FIX_K1,
00809     CALIB_FIX_K2 = CV_CALIB_FIX_K2,
00810     CALIB_FIX_K3 = CV_CALIB_FIX_K3,
00811     // only for stereo
00812     CALIB_FIX_INTRINSIC = CV_CALIB_FIX_INTRINSIC,
00813     CALIB_SAME_FOCAL_LENGTH = CV_CALIB_SAME_FOCAL_LENGTH,
00814     // for stereo rectification
00815     CALIB_ZERO_DISPARITY = CV_CALIB_ZERO_DISPARITY
00816 };
00817 
00818 CV_EXPORTS double calibrateCamera( const vector<vector<Point3f> >& objectPoints,
00819                                  const vector<vector<Point2f> >& imagePoints,
00820                                  Size imageSize,
00821                                  Mat& cameraMatrix, Mat& distCoeffs,
00822                                  vector<Mat>& rvecs, vector<Mat>& tvecs,
00823                                  int flags=0 );
00824 
00825 CV_EXPORTS void calibrationMatrixValues( const Mat& cameraMatrix,
00826                                 Size imageSize,
00827                                 double apertureWidth,
00828                                 double apertureHeight,
00829                                 double& fovx,
00830                                 double& fovy,
00831                                 double& focalLength,
00832                                 Point2d& principalPoint,
00833                                 double& aspectRatio );
00834 
00835 CV_EXPORTS double stereoCalibrate( const vector<vector<Point3f> >& objectPoints,
00836                                  const vector<vector<Point2f> >& imagePoints1,
00837                                  const vector<vector<Point2f> >& imagePoints2,
00838                                  Mat& cameraMatrix1, Mat& distCoeffs1,
00839                                  Mat& cameraMatrix2, Mat& distCoeffs2,
00840                                  Size imageSize, Mat& R, Mat& T,
00841                                  Mat& E, Mat& F,
00842                                  TermCriteria criteria = TermCriteria(TermCriteria::COUNT+
00843                                     TermCriteria::EPS, 30, 1e-6),
00844                                  int flags=CALIB_FIX_INTRINSIC );
00845 
00846 CV_EXPORTS void stereoRectify( const Mat& cameraMatrix1, const Mat& distCoeffs1,
00847                                const Mat& cameraMatrix2, const Mat& distCoeffs2,
00848                                Size imageSize, const Mat& R, const Mat& T,
00849                                Mat& R1, Mat& R2, Mat& P1, Mat& P2, Mat& Q,
00850                                int flags=CALIB_ZERO_DISPARITY );
00851     
00852 CV_EXPORTS void stereoRectify( const Mat& cameraMatrix1, const Mat& distCoeffs1,
00853                               const Mat& cameraMatrix2, const Mat& distCoeffs2,
00854                               Size imageSize, const Mat& R, const Mat& T,
00855                               Mat& R1, Mat& R2, Mat& P1, Mat& P2, Mat& Q,
00856                               double alpha, Size newImageSize=Size(),
00857                               Rect* validPixROI1=0, Rect* validPixROI2=0,
00858                               int flags=CALIB_ZERO_DISPARITY );
00859 
00860 CV_EXPORTS bool stereoRectifyUncalibrated( const Mat& points1,
00861                                            const Mat& points2,
00862                                            const Mat& F, Size imgSize,
00863                                            Mat& H1, Mat& H2,
00864                                            double threshold=5 );
00865 
00866 CV_EXPORTS void convertPointsHomogeneous( const Mat& src, vector<Point3f>& dst );
00867 CV_EXPORTS void convertPointsHomogeneous( const Mat& src, vector<Point2f>& dst );
00868 
00869 enum
00870 { 
00871     FM_7POINT = CV_FM_7POINT,
00872     FM_8POINT = CV_FM_8POINT,
00873     FM_LMEDS = CV_FM_LMEDS,
00874     FM_RANSAC = CV_FM_RANSAC
00875 };
00876 
00877 CV_EXPORTS Mat findFundamentalMat( const Mat& points1, const Mat& points2,
00878                                    vector<uchar>& mask, int method=FM_RANSAC,
00879                                    double param1=3., double param2=0.99 );
00880 
00881 CV_EXPORTS Mat findFundamentalMat( const Mat& points1, const Mat& points2,
00882                                    int method=FM_RANSAC,
00883                                    double param1=3., double param2=0.99 );
00884 
00885 CV_EXPORTS void computeCorrespondEpilines( const Mat& points1,
00886                                            int whichImage, const Mat& F,
00887                                            vector<Vec3f>& lines );
00888 
00889 template<> inline void Ptr<CvStereoBMState>::delete_obj()
00890 { cvReleaseStereoBMState(&obj); }
00891 
00892 // Block matching stereo correspondence algorithm
00893 class CV_EXPORTS StereoBM
00894 {
00895 public:
00896     enum { PREFILTER_NORMALIZED_RESPONSE = CV_STEREO_BM_NORMALIZED_RESPONSE,
00897         PREFILTER_XSOBEL = CV_STEREO_BM_XSOBEL,
00898         BASIC_PRESET=CV_STEREO_BM_BASIC,
00899         FISH_EYE_PRESET=CV_STEREO_BM_FISH_EYE,
00900         NARROW_PRESET=CV_STEREO_BM_NARROW };
00901     
00902     StereoBM();
00903     StereoBM(int preset, int ndisparities=0, int SADWindowSize=21);
00904     void init(int preset, int ndisparities=0, int SADWindowSize=21);
00905     void operator()( const Mat& left, const Mat& right, Mat& disparity, int disptype=CV_16S );
00906 
00907     Ptr<CvStereoBMState> state;
00908 };
00909 
00910     
00911 class CV_EXPORTS StereoSGBM
00912 {
00913 public:
00914     enum { DISP_SHIFT=4, DISP_SCALE = (1<<DISP_SHIFT) };
00915     
00916     StereoSGBM();
00917     StereoSGBM(int minDisparity, int numDisparities, int SADWindowSize,
00918                int P1=0, int P2=0, int disp12MaxDiff=0,
00919                int preFilterCap=0, int uniquenessRatio=0,
00920                int speckleWindowSize=0, int speckleRange=0,
00921                bool fullDP=false);
00922     virtual ~StereoSGBM();
00923     
00924     virtual void operator()(const Mat& left, const Mat& right, Mat& disp);
00925     
00926     int minDisparity;
00927     int numberOfDisparities;
00928     int SADWindowSize;
00929     int preFilterCap;
00930     int uniquenessRatio;
00931     int P1, P2;
00932     int speckleWindowSize;
00933     int speckleRange;
00934     int disp12MaxDiff;
00935     bool fullDP;
00936     
00937 protected:
00938     Mat buffer;
00939 };
00940 
00941     
00942 CV_EXPORTS void filterSpeckles( Mat& img, double newVal, int maxSpeckleSize, double maxDiff, Mat& buf );
00943     
00944 CV_EXPORTS Rect getValidDisparityROI( Rect roi1, Rect roi2,
00945                                 int minDisparity, int numberOfDisparities,
00946                                 int SADWindowSize );
00947     
00948 CV_EXPORTS void validateDisparity( Mat& disparity, const Mat& cost,
00949                                    int minDisparity, int numberOfDisparities,
00950                                    int disp12MaxDisp=1 );
00951 
00952 CV_EXPORTS void reprojectImageTo3D( const Mat& disparity,
00953                                     Mat& _3dImage, const Mat& Q,
00954                                     bool handleMissingValues=false );
00955 
00956 class CV_EXPORTS KeyPoint
00957 {
00958 public:    
00959     KeyPoint() : pt(0,0), size(0), angle(-1), response(0), octave(0), class_id(-1) {}
00960     KeyPoint(Point2f _pt, float _size, float _angle=-1,
00961             float _response=0, int _octave=0, int _class_id=-1)
00962             : pt(_pt), size(_size), angle(_angle),
00963             response(_response), octave(_octave), class_id(_class_id) {}
00964     KeyPoint(float x, float y, float _size, float _angle=-1,
00965             float _response=0, int _octave=0, int _class_id=-1)
00966             : pt(x, y), size(_size), angle(_angle),
00967             response(_response), octave(_octave), class_id(_class_id) {}
00968     
00969     Point2f pt;
00970     float size;
00971     float angle;
00972     float response;
00973     int octave;
00974     int class_id;
00975 };
00976 
00977 CV_EXPORTS void write(FileStorage& fs, const string& name, const vector<KeyPoint>& keypoints);
00978 CV_EXPORTS void read(const FileNode& node, vector<KeyPoint>& keypoints);    
00979 
00980 class CV_EXPORTS SURF : public CvSURFParams
00981 {
00982 public:
00983     SURF();
00984     SURF(double _hessianThreshold, int _nOctaves=4,
00985          int _nOctaveLayers=2, bool _extended=false);
00986 
00987     int descriptorSize() const;
00988     void operator()(const Mat& img, const Mat& mask,
00989                     vector<KeyPoint>& keypoints) const;
00990     void operator()(const Mat& img, const Mat& mask,
00991                     vector<KeyPoint>& keypoints,
00992                     vector<float>& descriptors,
00993                     bool useProvidedKeypoints=false) const;
00994 };
00995 
00996 
00997 class CV_EXPORTS MSER : public CvMSERParams
00998 {
00999 public:
01000     MSER();
01001     MSER( int _delta, int _min_area, int _max_area,
01002           float _max_variation, float _min_diversity,
01003           int _max_evolution, double _area_threshold,
01004           double _min_margin, int _edge_blur_size );
01005     void operator()( const Mat& image, vector<vector<Point> >& msers, const Mat& mask ) const;
01006 };
01007 
01008 
01009 class CV_EXPORTS StarDetector : public CvStarDetectorParams
01010 {
01011 public:
01012     StarDetector();
01013     StarDetector(int _maxSize, int _responseThreshold,
01014                  int _lineThresholdProjected,
01015                  int _lineThresholdBinarized,
01016                  int _suppressNonmaxSize);
01017 
01018     void operator()(const Mat& image, vector<KeyPoint>& keypoints) const;
01019 };
01020     
01021 }
01022 
01024 
01025 class CV_EXPORTS CvLevMarq
01026 {
01027 public:
01028     CvLevMarq();
01029     CvLevMarq( int nparams, int nerrs, CvTermCriteria criteria=
01030         cvTermCriteria(CV_TERMCRIT_EPS+CV_TERMCRIT_ITER,30,DBL_EPSILON),
01031         bool completeSymmFlag=false );
01032     ~CvLevMarq();
01033     void init( int nparams, int nerrs, CvTermCriteria criteria=
01034         cvTermCriteria(CV_TERMCRIT_EPS+CV_TERMCRIT_ITER,30,DBL_EPSILON),
01035         bool completeSymmFlag=false );
01036     bool update( const CvMat*& param, CvMat*& J, CvMat*& err );
01037     bool updateAlt( const CvMat*& param, CvMat*& JtJ, CvMat*& JtErr, double*& errNorm );
01038 
01039     void clear();
01040     void step();
01041     enum { DONE=0, STARTED=1, CALC_J=2, CHECK_ERR=3 };
01042 
01043     cv::Ptr<CvMat> mask;
01044     cv::Ptr<CvMat> prevParam;
01045     cv::Ptr<CvMat> param;
01046     cv::Ptr<CvMat> J;
01047     cv::Ptr<CvMat> err;
01048     cv::Ptr<CvMat> JtJ;
01049     cv::Ptr<CvMat> JtJN;
01050     cv::Ptr<CvMat> JtErr;
01051     cv::Ptr<CvMat> JtJV;
01052     cv::Ptr<CvMat> JtJW;
01053     double prevErrNorm, errNorm;
01054     int lambdaLg10;
01055     CvTermCriteria criteria;
01056     int state;
01057     int iters;
01058     bool completeSymmFlag;
01059 };
01060 
01061 
01062 // 2009-01-12, Xavier Delacour <xavier.delacour@gmail.com>
01063 
01064 struct lsh_hash {
01065   int h1, h2;
01066 };
01067 
01068 struct CvLSHOperations
01069 {
01070   virtual ~CvLSHOperations() {}
01071 
01072   virtual int vector_add(const void* data) = 0;
01073   virtual void vector_remove(int i) = 0;
01074   virtual const void* vector_lookup(int i) = 0;
01075   virtual void vector_reserve(int n) = 0;
01076   virtual unsigned int vector_count() = 0;
01077 
01078   virtual void hash_insert(lsh_hash h, int l, int i) = 0;
01079   virtual void hash_remove(lsh_hash h, int l, int i) = 0;
01080   virtual int hash_lookup(lsh_hash h, int l, int* ret_i, int ret_i_max) = 0;
01081 };
01082 
01083 #endif /* __cplusplus */
01084 
01085 #endif
01086 
01087 /* End of file. */