]> rtime.felk.cvut.cz Git - opencv.git/blobdiff - opencv/include/opencv/cv.hpp
removed misleading "const" image qualifier in findContours (ticket #93)
[opencv.git] / opencv / include / opencv / cv.hpp
index f251223bf146ca4284d132b6290d279202fd0808..6aaba501bb456b3d5221fbad888d43c65dc00a45 100644 (file)
@@ -40,8 +40,8 @@
 //
 //M*/
 
-#ifndef _CV_HPP_
-#define _CV_HPP_
+#ifndef __OPENCV_CV_HPP__
+#define __OPENCV_CV_HPP__
 
 #ifdef __cplusplus
 
@@ -216,6 +216,10 @@ 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, const Scalar& value=Scalar() );
@@ -379,6 +383,9 @@ 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 );
 
@@ -445,7 +452,7 @@ enum { GC_INIT_WITH_RECT  = 0,
 
 CV_EXPORTS void grabCut( const Mat& img, Mat& mask, Rect rect, 
                          Mat& bgdModel, Mat& fgdModel,
-                         int iterCount, int flag = GC_EVAL );
+                         int iterCount, int mode = GC_EVAL );
 
 enum { INPAINT_NS=CV_INPAINT_NS, INPAINT_TELEA=CV_INPAINT_TELEA };
 
@@ -505,11 +512,11 @@ 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 void findContours( const Mat& image, vector<vector<Point> >& contours,
+CV_EXPORTS void findContours( Mat& image, vector<vector<Point> >& contours,
                               vector<Vec4i>& hierarchy, int mode,
                               int method, Point offset=Point());
 
-CV_EXPORTS void findContours( const Mat& image, vector<vector<Point> >& contours,
+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,
@@ -614,6 +621,7 @@ public:
 ///////////////////////////// Object Detection ////////////////////////////
 
 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
 {
@@ -840,6 +848,14 @@ 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 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,
@@ -877,7 +893,8 @@ template<> inline void Ptr<CvStereoBMState>::delete_obj()
 class CV_EXPORTS StereoBM
 {
 public:
-    enum { NORMALIZED_RESPONSE = CV_STEREO_BM_NORMALIZED_RESPONSE,
+    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 };
@@ -885,11 +902,53 @@ public:
     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 );
@@ -947,7 +1006,7 @@ public:
 };
 
 
-class CV_EXPORTS StarDetector : CvStarDetectorParams
+class CV_EXPORTS StarDetector : public CvStarDetectorParams
 {
 public:
     StarDetector();
@@ -981,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;
@@ -1023,6 +1082,6 @@ struct CvLSHOperations
 
 #endif /* __cplusplus */
 
-#endif /* _CV_HPP_ */
+#endif
 
 /* End of file. */