//
//M*/
-#ifndef _CV_HPP_
-#define _CV_HPP_
+#ifndef __OPENCV_CV_HPP__
+#define __OPENCV_CV_HPP__
#ifdef __cplusplus
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() );
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 );
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 );
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,
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 Mat& prevPts, const Mat& nextPts,
+ const vector<Point2f>& prevPts, vector<Point2f>& nextPts,
vector<uchar>& status, vector<float>& err,
Size winSize=Size(15,15), int maxLevel=3,
TermCriteria criteria=TermCriteria(
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,
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] );
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,
- 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 Mat& curve,
vector<Point>& approxCurve,
CV_EXPORTS double contourArea( const Mat& contour );
CV_EXPORTS RotatedRect minAreaRect( const Mat& points );
CV_EXPORTS void minEnclosingCircle( const Mat& points,
- Point2f center, float& radius );
-CV_EXPORTS Moments moments( const Mat& points );
+ Point2f& center, float& radius );
CV_EXPORTS double matchShapes( const Mat& contour1,
const Mat& contour2,
int method, double parameter );
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,
///////////////////////////// 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
{
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 int setWindow(Point);
-
- /*virtual double calcOrd(int featureIdx, int pOffset) const;
- virtual int calcCat(int featureIdx, int pOffset) const;*/
-
- enum { HAAR = 0, LBP = 1 };
+ virtual bool setWindow(Point p);
+
+ virtual double calcOrd(int featureIdx) const;
+ virtual int calcCat(int featureIdx) const;
+
static Ptr<FeatureEvaluator> create(int type);
};
DO_ROUGH_SEARCH = CV_HAAR_DO_ROUGH_SEARCH };
CascadeClassifier();
- CascadeClassifier(const String& filename);
+ CascadeClassifier(const string& filename);
~CascadeClassifier();
bool empty() const;
- bool load(const String& filename);
+ bool load(const string& filename);
bool read(const FileNode& node);
void detectMultiScale( const Mat& image,
vector<Rect>& objects,
int minNeighbors=3, int flags=0,
Size minSize=Size());
- bool setImage( const Mat& image );
- int runAt( Point pt );
+ bool setImage( Ptr<FeatureEvaluator>&, const Mat& );
+ int runAt( Ptr<FeatureEvaluator>&, Point );
+
+ bool is_stump_based;
int stageType;
int featureType;
int ncategories;
-
Size origWinSize;
vector<Stage> stages;
vector<DTreeNode> nodes;
vector<float> leaves;
vector<int> subsets;
-
+
Ptr<FeatureEvaluator> feval;
Ptr<CvHaarClassifierCascade> oldCascade;
};
CALIB_ZERO_DISPARITY = CV_CALIB_ZERO_DISPARITY
};
-CV_EXPORTS void calibrateCamera( const vector<vector<Point3f> >& objectPoints,
+CV_EXPORTS double calibrateCamera( const vector<vector<Point3f> >& objectPoints,
const vector<vector<Point2f> >& imagePoints,
Size imageSize,
Mat& cameraMatrix, Mat& distCoeffs,
Point2d& principalPoint,
double& aspectRatio );
-CV_EXPORTS void stereoCalibrate( const vector<vector<Point3f> >& objectPoints,
+CV_EXPORTS double stereoCalibrate( const vector<vector<Point3f> >& objectPoints,
const vector<vector<Point2f> >& imagePoints1,
const vector<vector<Point2f> >& imagePoints2,
Mat& cameraMatrix1, 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,
// 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 };
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 );
int class_id;
};
-CV_EXPORTS void write(FileStorage& fs, const String& name, const vector<KeyPoint>& keypoints);
+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,
};
-class CV_EXPORTS StarDetector : CvStarDetectorParams
+class CV_EXPORTS StarDetector : public CvStarDetectorParams
{
public:
StarDetector();
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;
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. */