]> rtime.felk.cvut.cz Git - opencv.git/blobdiff - opencv/include/opencv/cv.hpp
added const in MSER::operator()
[opencv.git] / opencv / include / opencv / cv.hpp
index 2b4863e114a1b47b062f25fb2fe2f53ffdff7226..d2826fce40e42b3cc6ae752966646613c4becad1 100644 (file)
@@ -40,8 +40,8 @@
 //
 //M*/
 
-#ifndef _CV_HPP_
-#define _CV_HPP_
+#ifndef __OPENCV_CV_HPP__
+#define __OPENCV_CV_HPP__
 
 #ifdef __cplusplus
 
@@ -130,14 +130,14 @@ public:
     Rect roi;
     int dx1, dx2;
     int rowBorderType, columnBorderType;
-    Vector<int> borderTab;
+    vector<int> borderTab;
     int borderElemSize;
-    Vector<uchar> ringBuf;
-    Vector<uchar> srcRow;
-    Vector<uchar> constBorderValue;
-    Vector<uchar> constBorderRow;
+    vector<uchar> ringBuf;
+    vector<uchar> srcRow;
+    vector<uchar> constBorderValue;
+    vector<uchar> constBorderRow;
     int bufStep, startY, startY0, endY, rowCount, dstY;
-    Vector<uchar*> rows;
+    vector<uchar*> rows;
     
     Ptr<BaseFilter> filter2D;
     Ptr<BaseRowFilter> rowFilter;
@@ -216,9 +216,13 @@ CV_EXPORTS Ptr<FilterEngine> createMorphologyFilter(int op, int type, const Mat&
 enum { MORPH_RECT=0, MORPH_CROSS=1, MORPH_ELLIPSE=2 };
 CV_EXPORTS Mat getStructuringElement(int shape, Size ksize, Point anchor=Point(-1,-1));
 
+template<> inline void Ptr<IplConvKernel>::delete_obj()
+{ cvReleaseStructuringElement(&obj); }
+
+    
 CV_EXPORTS void copyMakeBorder( const Mat& src, Mat& dst,
                                 int top, int bottom, int left, int right,
-                                int borderType );
+                                int borderType, const Scalar& value=Scalar() );
 
 CV_EXPORTS void medianBlur( const Mat& src, Mat& dst, int ksize );
 CV_EXPORTS void GaussianBlur( const Mat& src, Mat& dst, Size ksize,
@@ -279,24 +283,24 @@ CV_EXPORTS void cornerEigenValsAndVecs( const Mat& src, Mat& dst,
 CV_EXPORTS void preCornerDetect( const Mat& src, Mat& dst, int ksize,
                                  int borderType=BORDER_DEFAULT );
 
-CV_EXPORTS void cornerSubPix( const Mat& image, Vector<Point2f>& corners,
+CV_EXPORTS void cornerSubPix( const Mat& image, vector<Point2f>& corners,
                               Size winSize, Size zeroZone,
                               TermCriteria criteria );
 
-CV_EXPORTS void goodFeaturesToTrack( const Mat& image, Vector<Point2f>& corners,
+CV_EXPORTS void goodFeaturesToTrack( const Mat& image, vector<Point2f>& corners,
                                      int maxCorners, double qualityLevel, double minDistance,
                                      const Mat& mask=Mat(), int blockSize=3,
                                      bool useHarrisDetector=false, double k=0.04 );
 
-CV_EXPORTS void HoughLines( Mat& image, Vector<Vec2f>& lines,
+CV_EXPORTS void HoughLines( const Mat& image, vector<Vec2f>& lines,
                             double rho, double theta, int threshold,
                             double srn=0, double stn=0 );
 
-CV_EXPORTS void HoughLinesP( Mat& image, Vector<Vec4i>& lines,
+CV_EXPORTS void HoughLinesP( Mat& image, vector<Vec4i>& lines,
                              double rho, double theta, int threshold,
                              double minLineLength=0, double maxLineGap=0 );
 
-CV_EXPORTS void HoughCircles( Mat& image, Vector<Vec3f>& circles,
+CV_EXPORTS void HoughCircles( const Mat& image, vector<Vec3f>& circles,
                               int method, double dp, double minDist,
                               double param1=100, double param2=100,
                               int minRadius=0, int maxRadius=0 );
@@ -318,7 +322,7 @@ enum { INTER_NEAREST=0, INTER_LINEAR=1, INTER_CUBIC=2, INTER_AREA=3,
        INTER_LANCZOS4=4, INTER_MAX=7, WARP_INVERSE_MAP=16 };
 
 CV_EXPORTS void resize( const Mat& src, Mat& dst,
-                        Size dsize=Size(), double fx=0, double fy=0,
+                        Size dsize, double fx=0, double fy=0,
                         int interpolation=INTER_LINEAR );
 
 CV_EXPORTS void warpAffine( const Mat& src, Mat& dst,
@@ -371,7 +375,7 @@ CV_EXPORTS void adaptiveThreshold( const Mat& src, Mat& dst, double maxValue,
 
 CV_EXPORTS void pyrDown( const Mat& src, Mat& dst, const Size& dstsize=Size());
 CV_EXPORTS void pyrUp( const Mat& src, Mat& dst, const Size& dstsize=Size());
-CV_EXPORTS void buildPyramid( const Mat& src, Vector<Mat>& dst, int maxlevel );
+CV_EXPORTS void buildPyramid( const Mat& src, vector<Mat>& dst, int maxlevel );
 
 
 CV_EXPORTS void undistort( const Mat& src, Mat& dst, const Mat& cameraMatrix,
@@ -379,15 +383,17 @@ CV_EXPORTS void undistort( const Mat& src, Mat& dst, const Mat& cameraMatrix,
 CV_EXPORTS void initUndistortRectifyMap( const Mat& cameraMatrix, const Mat& distCoeffs,
                            const Mat& R, const Mat& newCameraMatrix,
                            Size size, int m1type, Mat& map1, Mat& map2 );
+CV_EXPORTS Mat getOptimalNewCameraMatrix( const Mat& cameraMatrix, const Mat& distCoeffs,
+                                          Size imageSize, double alpha, Size newImgSize=Size(),
+                                          Rect* validPixROI=0);
 CV_EXPORTS Mat getDefaultNewCameraMatrix( const Mat& cameraMatrix, Size imgsize=Size(),
                                           bool centerPrincipalPoint=false );
 
 enum { OPTFLOW_USE_INITIAL_FLOW=4, OPTFLOW_FARNEBACK_GAUSSIAN=256 };
 
 CV_EXPORTS void calcOpticalFlowPyrLK( const Mat& prevImg, const Mat& nextImg,
-                           const Vector<Point2f>& prevPts,
-                           Vector<Point2f>& nextPts,
-                           Vector<bool>& status, Vector<float>& err,
+                           const vector<Point2f>& prevPts, vector<Point2f>& nextPts,
+                           vector<uchar>& status, vector<float>& err,
                            Size winSize=Size(15,15), int maxLevel=3,
                            TermCriteria criteria=TermCriteria(
                             TermCriteria::COUNT+TermCriteria::EPS,
@@ -399,25 +405,30 @@ CV_EXPORTS void calcOpticalFlowFarneback( const Mat& prev0, const Mat& next0,
                                Mat& flow0, double pyr_scale, int levels, int winsize,
                                int iterations, int poly_n, double poly_sigma, int flags );
     
+
+template<> inline void Ptr<CvHistogram>::delete_obj()
+{ cvReleaseHist(&obj); }
     
-CV_EXPORTS void calcHist( const Vector<Mat>& images, const Vector<int>& channels,
-                          const Mat& mask, MatND& hist, const Vector<int>& histSize,
-                          const Vector<Vector<float> >& ranges,
-                          bool uniform=true, bool accumulate=false );
-
-CV_EXPORTS void calcHist( const Vector<Mat>& images, const Vector<int>& channels,
-                          const Mat& mask, SparseMat& hist, const Vector<int>& histSize,
-                          const Vector<Vector<float> >& ranges,
-                          bool uniform=true, bool accumulate=false );
+CV_EXPORTS void calcHist( const Mat* images, int nimages,
+                          const int* channels, const Mat& mask,
+                          MatND& hist, int dims, const int* histSize,
+                          const float** ranges, bool uniform=true,
+                          bool accumulate=false );
+
+CV_EXPORTS void calcHist( const Mat* images, int nimages,
+                          const int* channels, const Mat& mask,
+                          SparseMat& hist, int dims, const int* histSize,
+                          const float** ranges, bool uniform=true,
+                          bool accumulate=false );
     
-CV_EXPORTS void calcBackProject( const Vector<Mat>& images, const Vector<int>& channels,
-                                 const MatND& hist, Mat& backProject,
-                                 const Vector<Vector<float> >& ranges,
+CV_EXPORTS void calcBackProject( const Mat* images, int nimages,
+                                 const int* channels, const MatND& hist,
+                                 Mat& backProject, const float** ranges,
                                  double scale=1, bool uniform=true );
     
-CV_EXPORTS void calcBackProject( const Vector<Mat>& images, const Vector<int>& channels,
-                                 const SparseMat& hist, Mat& backProject,
-                                 const Vector<Vector<float> >& ranges,
+CV_EXPORTS void calcBackProject( const Mat* images, int nimages,
+                                 const int* channels, const SparseMat& hist,
+                                 Mat& backProject, const float** ranges,
                                  double scale=1, bool uniform=true );
 
 CV_EXPORTS double compareHist( const MatND& H1, const MatND& H2, int method );
@@ -428,6 +439,21 @@ CV_EXPORTS void equalizeHist( const Mat& src, Mat& dst );
 
 CV_EXPORTS void watershed( const Mat& image, Mat& markers );
 
+enum { GC_BGD    = 0,  // background
+       GC_FGD    = 1,  // foreground
+       GC_PR_BGD = 2,  // most probably background
+       GC_PR_FGD = 3   // most probably foreground 
+     };
+
+enum { GC_INIT_WITH_RECT  = 0,
+       GC_INIT_WITH_MASK  = 1,
+       GC_EVAL            = 2
+     };
+
+CV_EXPORTS void grabCut( const Mat& img, Mat& mask, Rect rect, 
+                         Mat& bgdModel, Mat& fgdModel,
+                         int iterCount, int mode = GC_EVAL );
+
 enum { INPAINT_NS=CV_INPAINT_NS, INPAINT_TELEA=CV_INPAINT_TELEA };
 
 CV_EXPORTS void inpaint( const Mat& src, const Mat& inpaintMask,
@@ -468,7 +494,7 @@ public:
     double  nu20, nu11, nu02, nu30, nu21, nu12, nu03; // central normalized moments
 };
 
-CV_EXPORTS Moments moments( const Mat& image, bool binaryImage=false );
+CV_EXPORTS Moments moments( const Mat& array, bool binaryImage=false );
 
 CV_EXPORTS void HuMoments( const Moments& moments, double hu[7] );
 
@@ -486,82 +512,53 @@ enum { CHAIN_APPROX_NONE=CV_CHAIN_APPROX_NONE,
        CHAIN_APPROX_TC89_L1=CV_CHAIN_APPROX_TC89_L1,
        CHAIN_APPROX_TC89_KCOS=CV_CHAIN_APPROX_TC89_KCOS };
 
-CV_EXPORTS Vector<Vector<Point> >
-    findContours( const Mat& image, Vector<Vec4i>& hierarchy,
-                  int mode, int method, Point offset=Point());
+CV_EXPORTS void findContours( Mat& image, vector<vector<Point> >& contours,
+                              vector<Vec4i>& hierarchy, int mode,
+                              int method, Point offset=Point());
 
-CV_EXPORTS Vector<Vector<Point> >
-    findContours( const Mat& image, int mode, int method, Point offset=Point());
+CV_EXPORTS void findContours( Mat& image, vector<vector<Point> >& contours,
+                              int mode, int method, Point offset=Point());
 
-CV_EXPORTS void
-    drawContours( Mat& image, const Vector<Vector<Point> >& contours,
-                  const Scalar& color, int thickness=1,
-                  int lineType=8, const Vector<Vec4i>& hierarchy=Vector<Vec4i>(),
-                  int maxLevel=1, Point offset=Point() );
+CV_EXPORTS void drawContours( Mat& image, const vector<vector<Point> >& contours,
+                              int contourIdx, const Scalar& color,
+                              int thickness=1, int lineType=8,
+                              const vector<Vec4i>& hierarchy=vector<Vec4i>(),
+                              int maxLevel=INT_MAX, Point offset=Point() );
 
-CV_EXPORTS void approxPolyDP( const Vector<Point>& curve,
-                              Vector<Point>& approxCurve,
+CV_EXPORTS void approxPolyDP( const Mat& curve,
+                              vector<Point>& approxCurve,
                               double epsilon, bool closed );
-CV_EXPORTS void approxPolyDP( const Vector<Point2f>& curve,
-                              Vector<Point2f>& approxCurve,
+CV_EXPORTS void approxPolyDP( const Mat& curve,
+                              vector<Point2f>& approxCurve,
                               double epsilon, bool closed );
+    
+CV_EXPORTS double arcLength( const Mat& curve, bool closed );
+CV_EXPORTS Rect boundingRect( const Mat& points );
+CV_EXPORTS double contourArea( const Mat& contour, bool oriented=false );    
+CV_EXPORTS RotatedRect minAreaRect( const Mat& points );
+CV_EXPORTS void minEnclosingCircle( const Mat& points,
+                                    Point2f& center, float& radius );    
+CV_EXPORTS double matchShapes( const Mat& contour1,
+                               const Mat& contour2,
+                               int method, double parameter );
+    
+CV_EXPORTS void convexHull( const Mat& points, vector<int>& hull, bool clockwise=false );
+CV_EXPORTS void convexHull( const Mat& points, vector<Point>& hull, bool clockwise=false );
+CV_EXPORTS void convexHull( const Mat& points, vector<Point2f>& hull, bool clockwise=false );
 
-CV_EXPORTS double arcLength( const Vector<Point>& curve, bool closed );
-CV_EXPORTS double arcLength( const Vector<Point2f>& curve, bool closed );
-
-CV_EXPORTS Rect boundingRect( const Vector<Point>& points );
-CV_EXPORTS Rect boundingRect( const Vector<Point2f>& points );
-
-CV_EXPORTS double contourArea( const Vector<Point>& contour );
-CV_EXPORTS double contourArea( const Vector<Point2f>& contour );
-
-CV_EXPORTS RotatedRect minAreaRect( const Vector<Point>& points );
-CV_EXPORTS RotatedRect minAreaRect( const Vector<Point2f>& points );
-
-CV_EXPORTS void minEnclosingCircle( const Vector<Point>& points,
-                                    Point2f center, float& radius );
-CV_EXPORTS void minEnclosingCircle( const Vector<Point2f>& points,
-                                    Point2f center, float& radius );
+CV_EXPORTS bool isContourConvex( const Mat& contour );
 
-CV_EXPORTS Moments moments( const Vector<Point>& points );
-CV_EXPORTS Moments moments( const Vector<Point2f>& points );
+CV_EXPORTS RotatedRect fitEllipse( const Mat& points );
 
-CV_EXPORTS double matchShapes( const Vector<Point2f>& contour1,
-                               const Vector<Point2f>& contour2,
-                               int method, double parameter );
-CV_EXPORTS double matchShapes( const Vector<Point>& contour1,
-                               const Vector<Point>& contour2,
-                               int method, double parameter );
+CV_EXPORTS void fitLine( const Mat& points, Vec4f& line, int distType,
+                         double param, double reps, double aeps );
+CV_EXPORTS void fitLine( const Mat& points, Vec6f& line, int distType,
+                         double param, double reps, double aeps );
 
-CV_EXPORTS void convexHull( const Vector<Point>& points,
-                            Vector<int>& hull, bool clockwise=false );
-CV_EXPORTS void convexHull( const Vector<Point>& points,
-                            Vector<Point>& hull, bool clockwise=false );
-CV_EXPORTS void convexHull( const Vector<Point2f>& points,
-                            Vector<int>& hull, bool clockwise=false );
-CV_EXPORTS void convexHull( const Vector<Point2f>& points,
-                            Vector<Point2f>& hull, bool clockwise=false );
-
-CV_EXPORTS bool isContourConvex( const Vector<Point>& contour );
-CV_EXPORTS bool isContourConvex( const Vector<Point2f>& contour );
-
-CV_EXPORTS RotatedRect fitEllipse( const Vector<Point>& points );
-CV_EXPORTS RotatedRect fitEllipse( const Vector<Point2f>& points );
-
-CV_EXPORTS Vec4f fitLine( const Vector<Point> points, int distType,
-                          double param, double reps, double aeps );
-CV_EXPORTS Vec4f fitLine( const Vector<Point2f> points, int distType,
-                          double param, double reps, double aeps );
-CV_EXPORTS Vec6f fitLine( const Vector<Point3f> points, int distType,
-                          double param, double reps, double aeps );
-
-CV_EXPORTS double pointPolygonTest( const Vector<Point>& contour,
-                                    Point2f pt, bool measureDist );
-CV_EXPORTS double pointPolygonTest( const Vector<Point2f>& contour,
+CV_EXPORTS double pointPolygonTest( const Mat& contour,
                                     Point2f pt, bool measureDist );
 
-CV_EXPORTS Mat estimateRigidTransform( const Vector<Point2f>& A,
-                                       const Vector<Point2f>& B,
+CV_EXPORTS Mat estimateRigidTransform( const Mat& A, const Mat& B,
                                        bool fullAffine );
 
 CV_EXPORTS void updateMotionHistory( const Mat& silhouette, Mat& mhi,
@@ -577,12 +574,16 @@ CV_EXPORTS double calcGlobalOrientation( const Mat& orientation, const Mat& mask
                                          double duration );
 // TODO: need good API for cvSegmentMotion
 
-CV_EXPORTS RotatedRect CAMShift( const Mat& probImage, Rect& window,
+CV_EXPORTS RotatedRect CamShift( const Mat& probImage, Rect& window,
                                  TermCriteria criteria );
 
 CV_EXPORTS int meanShift( const Mat& probImage, Rect& window,
                           TermCriteria criteria );
 
+CV_EXPORTS int estimateAffine3D(const Mat& from, const Mat& to, Mat& out,
+                                vector<uchar>& outliers,
+                                double param1 = 3.0, double param2 = 0.99);
+
 class CV_EXPORTS KalmanFilter
 {
 public:
@@ -619,51 +620,117 @@ public:
 
 ///////////////////////////// Object Detection ////////////////////////////
 
-template<> inline void Ptr<CvHaarClassifierCascade>::delete_obj()
-{ cvReleaseHaarClassifierCascade(&obj); }
+CV_EXPORTS void groupRectangles(vector<Rect>& rectList, int groupThreshold, double eps=0.2);
+CV_EXPORTS void groupRectangles(vector<Rect>& rectList, vector<int>& weights, int groupThreshold, double eps=0.2);
+        
+class CV_EXPORTS FeatureEvaluator
+{
+public:    
+    enum { HAAR = 0, LBP = 1 };
+    virtual ~FeatureEvaluator();
+    virtual bool read(const FileNode& node);
+    virtual Ptr<FeatureEvaluator> clone() const;
+    virtual int getFeatureType() const;
+    
+    virtual bool setImage(const Mat&, Size origWinSize);
+    virtual bool setWindow(Point p);
 
-class CV_EXPORTS HaarClassifierCascade
+    virtual double calcOrd(int featureIdx) const;
+    virtual int calcCat(int featureIdx) const;
+
+    static Ptr<FeatureEvaluator> create(int type);
+};
+    
+template<> inline void Ptr<CvHaarClassifierCascade>::delete_obj()
+{ cvReleaseHaarClassifierCascade(&obj); }    
+   
+class CV_EXPORTS CascadeClassifier
 {
 public:
+    struct CV_EXPORTS DTreeNode
+    {
+        int featureIdx;
+        float threshold; // for ordered features only
+        int left;
+        int right;
+    };
+    
+    struct CV_EXPORTS DTree
+    {
+        int nodeCount;
+    };
+    
+    struct CV_EXPORTS Stage
+    {
+        int first;
+        int ntrees;
+        float threshold;
+    };
+    
+    enum { BOOST = 0 };
     enum { DO_CANNY_PRUNING = CV_HAAR_DO_CANNY_PRUNING,
            SCALE_IMAGE = CV_HAAR_SCALE_IMAGE,
            FIND_BIGGEST_OBJECT = CV_HAAR_FIND_BIGGEST_OBJECT,
            DO_ROUGH_SEARCH = CV_HAAR_DO_ROUGH_SEARCH };
-    
-    HaarClassifierCascade();
-    HaarClassifierCascade(const String& filename);
-    bool load(const String& filename);
 
+    CascadeClassifier();
+    CascadeClassifier(const string& filename);
+    ~CascadeClassifier();
+    
+    bool empty() const;
+    bool load(const string& filename);
+    bool read(const FileNode& node);
     void detectMultiScale( const Mat& image,
-                           Vector<Rect>& objects,
+                           vector<Rect>& objects,
                            double scaleFactor=1.1,
                            int minNeighbors=3, int flags=0,
                            Size minSize=Size());
+    bool setImage( Ptr<FeatureEvaluator>&, const Mat& );
+    int runAt( Ptr<FeatureEvaluator>&, Point );
 
-    int runAt(Point pt, int startStage=0, int nstages=0) const;
+    bool is_stump_based;
 
-    void setImages( const Mat& sum, const Mat& sqsum,
-                    const Mat& tiltedSum, double scale );
+    int stageType;
+    int featureType;
+    int ncategories;
+    Size origWinSize;
     
-    Ptr<CvHaarClassifierCascade> cascade;
+    vector<Stage> stages;
+    vector<DTree> classifiers;
+    vector<DTreeNode> nodes;
+    vector<float> leaves;
+    vector<int> subsets;
+
+    Ptr<FeatureEvaluator> feval;
+    Ptr<CvHaarClassifierCascade> oldCascade;
 };
 
-CV_EXPORTS void undistortPoints( const Vector<Point2f>& src, Vector<Point2f>& dst,
+    
+CV_EXPORTS void undistortPoints( const Mat& src, vector<Point2f>& dst,
+                                 const Mat& cameraMatrix, const Mat& distCoeffs,
+                                 const Mat& R=Mat(), const Mat& P=Mat());
+CV_EXPORTS void undistortPoints( const Mat& src, Mat& dst,
                                  const Mat& cameraMatrix, const Mat& distCoeffs,
                                  const Mat& R=Mat(), const Mat& P=Mat());
 
-CV_EXPORTS Mat Rodrigues(const Mat& src);
-CV_EXPORTS Mat Rodrigues(const Mat& src, Mat& jacobian);
+CV_EXPORTS void Rodrigues(const Mat& src, Mat& dst);
+CV_EXPORTS void Rodrigues(const Mat& src, Mat& dst, Mat& jacobian);
 
 enum { LMEDS=4, RANSAC=8 };
 
-CV_EXPORTS Mat findHomography( const Vector<Point2f>& srcPoints,
-                               const Vector<Point2f>& dstPoints,
-                               Vector<bool>& mask, int method=0,
+CV_EXPORTS Mat findHomography( const Mat& srcPoints,
+                               const Mat& dstPoints,
+                               Mat& mask, int method=0,
+                               double ransacReprojThreshold=0 );
+    
+CV_EXPORTS Mat findHomography( const Mat& srcPoints,
+                               const Mat& dstPoints,
+                               vector<uchar>& mask, int method=0,
                                double ransacReprojThreshold=0 );
 
-CV_EXPORTS Mat findHomography( const Vector<Point2f>& srcPoints,
-                               const Vector<Point2f>& dstPoints,
+CV_EXPORTS Mat findHomography( const Mat& srcPoints,
+                               const Mat& dstPoints,
                                int method=0, double ransacReprojThreshold=0 );
 
 /* Computes RQ decomposition for 3x3 matrices */
@@ -692,30 +759,30 @@ CV_EXPORTS void composeRT( const Mat& rvec1, const Mat& tvec1,
                            Mat& dt3dr1, Mat& dt3dt1,
                            Mat& dt3dr2, Mat& dt3dt2 );
 
-CV_EXPORTS void projectPoints( const Vector<Point3f>& objectPoints,
+CV_EXPORTS void projectPoints( const Mat& objectPoints,
                                const Mat& rvec, const Mat& tvec,
                                const Mat& cameraMatrix,
                                const Mat& distCoeffs,
-                               Vector<Point2f>& imagePoints );
+                               vector<Point2f>& imagePoints );
 
-CV_EXPORTS void projectPoints( const Vector<Point3f>& objectPoints,
+CV_EXPORTS void projectPoints( const Mat& objectPoints,
                                const Mat& rvec, const Mat& tvec,
                                const Mat& cameraMatrix,
                                const Mat& distCoeffs,
-                               Vector<Point2f>& imagePoints,
+                               vector<Point2f>& imagePoints,
                                Mat& dpdrot, Mat& dpdt, Mat& dpdf,
                                Mat& dpdc, Mat& dpddist,
                                double aspectRatio=0 );
 
-CV_EXPORTS void solvePnP( const Vector<Point3f>& objectPoints,
-                          const Vector<Point2f>& imagePoints,
+CV_EXPORTS void solvePnP( const Mat& objectPoints,
+                          const Mat& imagePoints,
                           const Mat& cameraMatrix,
                           const Mat& distCoeffs,
                           Mat& rvec, Mat& tvec,
                           bool useExtrinsicGuess=false );
 
-CV_EXPORTS Mat initCameraMatrix2D( const Vector<Vector<Point3f> >& objectPoints,
-                                   const Vector<Vector<Point2f> >& imagePoints,
+CV_EXPORTS Mat initCameraMatrix2D( const vector<vector<Point3f> >& objectPoints,
+                                   const vector<vector<Point2f> >& imagePoints,
                                    Size imageSize, double aspectRatio=1. );
 
 enum { CALIB_CB_ADAPTIVE_THRESH = CV_CALIB_CB_ADAPTIVE_THRESH,
@@ -723,12 +790,12 @@ enum { CALIB_CB_ADAPTIVE_THRESH = CV_CALIB_CB_ADAPTIVE_THRESH,
        CALIB_CB_FILTER_QUADS = CV_CALIB_CB_FILTER_QUADS };
 
 CV_EXPORTS bool findChessboardCorners( const Mat& image, Size patternSize,
-                                       Vector<Point2f>& corners,
+                                       vector<Point2f>& corners,
                                        int flags=CV_CALIB_CB_ADAPTIVE_THRESH+
                                             CV_CALIB_CB_NORMALIZE_IMAGE );
 
 CV_EXPORTS void drawChessboardCorners( Mat& image, Size patternSize,
-                                       const Vector<Point2f>& corners,
+                                       const Mat& corners,
                                        bool patternWasFound );
 
 enum
@@ -748,11 +815,11 @@ enum
     CALIB_ZERO_DISPARITY = CV_CALIB_ZERO_DISPARITY
 };
 
-CV_EXPORTS void calibrateCamera( const Vector<Vector<Point3f> >& objectPoints,
-                                 const Vector<Vector<Point2f> >& imagePoints,
+CV_EXPORTS double calibrateCamera( const vector<vector<Point3f> >& objectPoints,
+                                 const vector<vector<Point2f> >& imagePoints,
                                  Size imageSize,
                                  Mat& cameraMatrix, Mat& distCoeffs,
-                                 Vector<Mat>& rvecs, Vector<Mat>& tvecs,
+                                 vector<Mat>& rvecs, vector<Mat>& tvecs,
                                  int flags=0 );
 
 CV_EXPORTS void calibrationMatrixValues( const Mat& cameraMatrix,
@@ -765,9 +832,9 @@ CV_EXPORTS void calibrationMatrixValues( const Mat& cameraMatrix,
                                 Point2d& principalPoint,
                                 double& aspectRatio );
 
-CV_EXPORTS void stereoCalibrate( const Vector<Vector<Point3f> >& objectPoints,
-                                 const Vector<Vector<Point2f> >& imagePoints1,
-                                 const Vector<Vector<Point2f> >& imagePoints2,
+CV_EXPORTS double stereoCalibrate( const vector<vector<Point3f> >& objectPoints,
+                                 const vector<vector<Point2f> >& imagePoints1,
+                                 const vector<vector<Point2f> >& imagePoints2,
                                  Mat& cameraMatrix1, Mat& distCoeffs1,
                                  Mat& cameraMatrix2, Mat& distCoeffs2,
                                  Size imageSize, Mat& R, Mat& T,
@@ -781,17 +848,23 @@ CV_EXPORTS void stereoRectify( const Mat& cameraMatrix1, const Mat& distCoeffs1,
                                Size imageSize, const Mat& R, const Mat& T,
                                Mat& R1, Mat& R2, Mat& P1, Mat& P2, Mat& Q,
                                int flags=CALIB_ZERO_DISPARITY );
-
-CV_EXPORTS bool stereoRectifyUncalibrated( const Vector<Point2f>& points1,
-                                           const Vector<Point2f>& points2,
+    
+CV_EXPORTS void stereoRectify( const Mat& cameraMatrix1, const Mat& distCoeffs1,
+                              const Mat& cameraMatrix2, const Mat& distCoeffs2,
+                              Size imageSize, const Mat& R, const Mat& T,
+                              Mat& R1, Mat& R2, Mat& P1, Mat& P2, Mat& Q,
+                              double alpha, Size newImageSize=Size(),
+                              Rect* validPixROI1=0, Rect* validPixROI2=0,
+                              int flags=CALIB_ZERO_DISPARITY );
+
+CV_EXPORTS bool stereoRectifyUncalibrated( const Mat& points1,
+                                           const Mat& points2,
                                            const Mat& F, Size imgSize,
                                            Mat& H1, Mat& H2,
                                            double threshold=5 );
 
-CV_EXPORTS void convertPointsHomogeneous( const Vector<Point2f>& src,
-                                          Vector<Point3f>& dst );
-CV_EXPORTS void convertPointsHomogeneous( const Vector<Point3f>& src,
-                                          Vector<Point2f>& dst );
+CV_EXPORTS void convertPointsHomogeneous( const Mat& src, vector<Point3f>& dst );
+CV_EXPORTS void convertPointsHomogeneous( const Mat& src, vector<Point2f>& dst );
 
 enum
 { 
@@ -801,20 +874,17 @@ enum
     FM_RANSAC = CV_FM_RANSAC
 };
 
-CV_EXPORTS Mat findFundamentalMat( const Vector<Point2f>& points1,
-                                   const Vector<Point2f>& points2,
-                                   Vector<bool>& mask,
-                                   int method=FM_RANSAC,
+CV_EXPORTS Mat findFundamentalMat( const Mat& points1, const Mat& points2,
+                                   vector<uchar>& mask, int method=FM_RANSAC,
                                    double param1=3., double param2=0.99 );
 
-CV_EXPORTS Mat findFundamentalMat( const Vector<Point2f>& points1,
-                                   const Vector<Point2f>& points2,
+CV_EXPORTS Mat findFundamentalMat( const Mat& points1, const Mat& points2,
                                    int method=FM_RANSAC,
                                    double param1=3., double param2=0.99 );
 
-CV_EXPORTS void computeCorrespondEpilines( const Vector<Point2f>& points1,
+CV_EXPORTS void computeCorrespondEpilines( const Mat& points1,
                                            int whichImage, const Mat& F,
-                                           Vector<Vec3f>& lines );
+                                           vector<Vec3f>& lines );
 
 template<> inline void Ptr<CvStereoBMState>::delete_obj()
 { cvReleaseStereoBMState(&obj); }
@@ -822,7 +892,9 @@ template<> inline void Ptr<CvStereoBMState>::delete_obj()
 // Block matching stereo correspondence algorithm
 class CV_EXPORTS StereoBM
 {
-    enum { NORMALIZED_RESPONSE = CV_STEREO_BM_NORMALIZED_RESPONSE,
+public:
+    enum { PREFILTER_NORMALIZED_RESPONSE = CV_STEREO_BM_NORMALIZED_RESPONSE,
+        PREFILTER_XSOBEL = CV_STEREO_BM_XSOBEL,
         BASIC_PRESET=CV_STEREO_BM_BASIC,
         FISH_EYE_PRESET=CV_STEREO_BM_FISH_EYE,
         NARROW_PRESET=CV_STEREO_BM_NARROW };
@@ -830,35 +902,94 @@ class CV_EXPORTS StereoBM
     StereoBM();
     StereoBM(int preset, int ndisparities=0, int SADWindowSize=21);
     void init(int preset, int ndisparities=0, int SADWindowSize=21);
-    void operator()( const Mat& left, const Mat& right, Mat& disparity );
+    void operator()( const Mat& left, const Mat& right, Mat& disparity, int disptype=CV_16S );
 
     Ptr<CvStereoBMState> state;
 };
 
+    
+class CV_EXPORTS StereoSGBM
+{
+public:
+    enum { DISP_SHIFT=4, DISP_SCALE = (1<<DISP_SHIFT) };
+    
+    StereoSGBM();
+    StereoSGBM(int minDisparity, int numDisparities, int SADWindowSize,
+               int P1=0, int P2=0, int disp12MaxDiff=0,
+               int preFilterCap=0, int uniquenessRatio=0,
+               int speckleWindowSize=0, int speckleRange=0,
+               bool fullDP=false);
+    virtual ~StereoSGBM();
+    
+    virtual void operator()(const Mat& left, const Mat& right, Mat& disp);
+    
+    int minDisparity;
+    int numberOfDisparities;
+    int SADWindowSize;
+    int preFilterCap;
+    int uniquenessRatio;
+    int P1, P2;
+    int speckleWindowSize;
+    int speckleRange;
+    int disp12MaxDiff;
+    bool fullDP;
+    
+protected:
+    Mat buffer;
+};
+
+    
+CV_EXPORTS void filterSpeckles( Mat& img, double newVal, int maxSpeckleSize, double maxDiff, Mat& buf );
+    
+CV_EXPORTS Rect getValidDisparityROI( Rect roi1, Rect roi2,
+                                int minDisparity, int numberOfDisparities,
+                                int SADWindowSize );
+    
+CV_EXPORTS void validateDisparity( Mat& disparity, const Mat& cost,
+                                   int minDisparity, int numberOfDisparities,
+                                   int disp12MaxDisp=1 );
+
 CV_EXPORTS void reprojectImageTo3D( const Mat& disparity,
                                     Mat& _3dImage, const Mat& Q,
                                     bool handleMissingValues=false );
 
-class CV_EXPORTS SURFKeypoint : public CvSURFPoint
+class CV_EXPORTS KeyPoint
 {
-public:
-    SURFKeypoint() { pt=Point2f(); laplacian=size=0; dir=hessian=0; }
-    SURFKeypoint(Point2f _pt, int _laplacian, int _size, float _dir=0.f, float _hessian=0.f)
-    { pt = _pt; laplacian = _laplacian; size = _size; dir = _dir; hessian = _hessian; }
+public:    
+    KeyPoint() : pt(0,0), size(0), angle(-1), response(0), octave(0), class_id(-1) {}
+    KeyPoint(Point2f _pt, float _size, float _angle=-1,
+            float _response=0, int _octave=0, int _class_id=-1)
+            : pt(_pt), size(_size), angle(_angle),
+            response(_response), octave(_octave), class_id(_class_id) {}
+    KeyPoint(float x, float y, float _size, float _angle=-1,
+            float _response=0, int _octave=0, int _class_id=-1)
+            : pt(x, y), size(_size), angle(_angle),
+            response(_response), octave(_octave), class_id(_class_id) {}
+    
+    Point2f pt;
+    float size;
+    float angle;
+    float response;
+    int octave;
+    int class_id;
 };
 
+CV_EXPORTS void write(FileStorage& fs, const string& name, const vector<KeyPoint>& keypoints);
+CV_EXPORTS void read(const FileNode& node, vector<KeyPoint>& keypoints);    
+
 class CV_EXPORTS SURF : public CvSURFParams
 {
 public:
     SURF();
-    SURF(double _hessianThreshold, bool _extended=false);
+    SURF(double _hessianThreshold, int _nOctaves=4,
+         int _nOctaveLayers=2, bool _extended=false);
 
     int descriptorSize() const;
     void operator()(const Mat& img, const Mat& mask,
-                    Vector<SURFKeypoint>& keypoints) const;
+                    vector<KeyPoint>& keypoints) const;
     void operator()(const Mat& img, const Mat& mask,
-                    Vector<SURFKeypoint>& keypoints,
-                    Vector<float>& descriptors,
+                    vector<KeyPoint>& keypoints,
+                    vector<float>& descriptors,
                     bool useProvidedKeypoints=false) const;
 };
 
@@ -871,20 +1002,11 @@ public:
           float _max_variation, float _min_diversity,
           int _max_evolution, double _area_threshold,
           double _min_margin, int _edge_blur_size );
-    Vector<Vector<Point> > operator()(Mat& image, const Mat& mask) const;
+    void operator()( const Mat& image, vector<vector<Point> >& msers, const Mat& mask ) const;
 };
 
-class CV_EXPORTS StarKeypoint : public CvStarKeypoint
-{
-public:
-    StarKeypoint() { pt = Point(); size = 0; response = 0.f; }
-    StarKeypoint(Point _pt, int _size, float _response)
-    {
-        pt = _pt; size = _size; response = _response;
-    }
-};
 
-class CV_EXPORTS StarDetector : CvStarDetectorParams
+class CV_EXPORTS StarDetector : public CvStarDetectorParams
 {
 public:
     StarDetector();
@@ -893,29 +1015,9 @@ public:
                  int _lineThresholdBinarized,
                  int _suppressNonmaxSize);
 
-    void operator()(const Mat& image, Vector<StarKeypoint>& keypoints) const;
+    void operator()(const Mat& image, vector<KeyPoint>& keypoints) const;
 };
     
-    
-class CV_EXPORTS Keypoint
-{
-public:    
-    Keypoint() : pt(0,0), size(0), angle(-1), response(0), octave(0) {}
-    Keypoint(Point2f _pt, float _size, float _angle=-1, float _response=0, int _octave=0)
-    : pt(_pt), size(_size), angle(_angle), response(_response), octave(_octave) {}
-    Keypoint(float x, float y, float _size, float _angle=-1, float _response=0, int _octave=0)
-    : pt(x, y), size(_size), angle(_angle), response(_response), octave(_octave) {}
-    
-    Point2f pt;
-    float size;
-    float angle;
-    float response;
-    int octave;
-};
-
-void write(FileStorage& fs, const String& name, const Vector<Keypoint>& keypoints);
-void read(const FileNode& node, Vector<Keypoint>& keypoints);    
-
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
@@ -938,16 +1040,16 @@ public:
     void step();
     enum { DONE=0, STARTED=1, CALC_J=2, CHECK_ERR=3 };
 
-    CvMat* mask;
-    CvMat* prevParam;
-    CvMat* param;
-    CvMat* J;
-    CvMat* err;
-    CvMat* JtJ;
-    CvMat* JtJN;
-    CvMat* JtErr;
-    CvMat* JtJV;
-    CvMat* JtJW;
+    cv::Ptr<CvMat> mask;
+    cv::Ptr<CvMat> prevParam;
+    cv::Ptr<CvMat> param;
+    cv::Ptr<CvMat> J;
+    cv::Ptr<CvMat> err;
+    cv::Ptr<CvMat> JtJ;
+    cv::Ptr<CvMat> JtJN;
+    cv::Ptr<CvMat> JtErr;
+    cv::Ptr<CvMat> JtJV;
+    cv::Ptr<CvMat> JtJW;
     double prevErrNorm, errNorm;
     int lambdaLg10;
     CvTermCriteria criteria;
@@ -978,9 +1080,8 @@ struct CvLSHOperations
   virtual int hash_lookup(lsh_hash h, int l, int* ret_i, int ret_i_max) = 0;
 };
 
-
 #endif /* __cplusplus */
 
-#endif /* _CV_HPP_ */
+#endif
 
 /* End of file. */