added more helper macros to the function declarations, to assist the Python wrapper generator. Fixed memleak in Mat::operator()(Range,Range) and the related functions (Mat::row, Mat::col etc.)
This commit is contained in:
parent
4c29ffecc0
commit
83f6085773
@ -429,10 +429,10 @@ namespace cv
|
||||
{
|
||||
|
||||
//! converts rotation vector to rotation matrix or vice versa using Rodrigues transformation
|
||||
CV_EXPORTS void Rodrigues(const Mat& src, Mat& dst);
|
||||
CV_EXPORTS_W void Rodrigues(const Mat& src, CV_OUT Mat& dst);
|
||||
|
||||
//! converts rotation vector to rotation matrix or vice versa using Rodrigues transformation. Also computes the Jacobian matrix
|
||||
CV_EXPORTS void Rodrigues(const Mat& src, Mat& dst, Mat& jacobian);
|
||||
CV_EXPORTS_AS(RodriguesJ) void Rodrigues(const Mat& src, CV_OUT Mat& dst, CV_OUT Mat& jacobian);
|
||||
|
||||
//! type of the robust estimation algorithm
|
||||
enum
|
||||
@ -442,9 +442,9 @@ enum
|
||||
};
|
||||
|
||||
//! computes the best-fit perspective transformation mapping srcPoints to dstPoints.
|
||||
CV_EXPORTS Mat findHomography( const Mat& srcPoints,
|
||||
CV_EXPORTS_AS(findHomographyAndOutliers) Mat findHomography( const Mat& srcPoints,
|
||||
const Mat& dstPoints,
|
||||
Mat& mask, int method=0,
|
||||
CV_OUT Mat& mask, int method=0,
|
||||
double ransacReprojThreshold=3 );
|
||||
|
||||
//! computes the best-fit perspective transformation mapping srcPoints to dstPoints.
|
||||
@ -454,7 +454,7 @@ CV_EXPORTS Mat findHomography( const Mat& srcPoints,
|
||||
double ransacReprojThreshold=3 );
|
||||
|
||||
//! computes the best-fit perspective transformation mapping srcPoints to dstPoints.
|
||||
CV_EXPORTS Mat findHomography( const Mat& srcPoints,
|
||||
CV_EXPORTS_W Mat findHomography( const Mat& srcPoints,
|
||||
const Mat& dstPoints,
|
||||
int method=0, double ransacReprojThreshold=3 );
|
||||
|
||||
@ -462,60 +462,60 @@ CV_EXPORTS Mat findHomography( const Mat& srcPoints,
|
||||
CV_EXPORTS void RQDecomp3x3( const Mat& M, Mat& R, Mat& Q );
|
||||
|
||||
//! Computes RQ decomposition of 3x3 matrix. Also, decomposes the output orthogonal matrix into the 3 primitive rotation matrices
|
||||
CV_EXPORTS Vec3d RQDecomp3x3( const Mat& M, Mat& R, Mat& Q,
|
||||
Mat& Qx, Mat& Qy, Mat& Qz );
|
||||
CV_EXPORTS_W Vec3d RQDecomp3x3( const Mat& M, Mat& R, Mat& Q,
|
||||
CV_OUT Mat& Qx, CV_OUT Mat& Qy, CV_OUT Mat& Qz );
|
||||
|
||||
//! Decomposes the projection matrix into camera matrix and the rotation martix and the translation vector
|
||||
CV_EXPORTS void decomposeProjectionMatrix( const Mat& projMatrix, Mat& cameraMatrix,
|
||||
Mat& rotMatrix, Mat& transVect );
|
||||
|
||||
//! Decomposes the projection matrix into camera matrix and the rotation martix and the translation vector. The rotation matrix is further decomposed
|
||||
CV_EXPORTS void decomposeProjectionMatrix( const Mat& projMatrix, Mat& cameraMatrix,
|
||||
Mat& rotMatrix, Mat& transVect,
|
||||
Mat& rotMatrixX, Mat& rotMatrixY,
|
||||
Mat& rotMatrixZ, Vec3d& eulerAngles );
|
||||
CV_EXPORTS_W void decomposeProjectionMatrix( const Mat& projMatrix, CV_OUT Mat& cameraMatrix,
|
||||
CV_OUT Mat& rotMatrix, CV_OUT Mat& transVect,
|
||||
CV_OUT Mat& rotMatrixX, CV_OUT Mat& rotMatrixY,
|
||||
CV_OUT Mat& rotMatrixZ, CV_OUT Vec3d& eulerAngles );
|
||||
|
||||
//! computes derivatives of the matrix product w.r.t each of the multiplied matrix coefficients
|
||||
CV_EXPORTS void matMulDeriv( const Mat& A, const Mat& B, Mat& dABdA, Mat& dABdB );
|
||||
CV_EXPORTS_W void matMulDeriv( const Mat& A, const Mat& B, CV_OUT Mat& dABdA, CV_OUT Mat& dABdB );
|
||||
|
||||
//! composes 2 [R|t] transformations together
|
||||
CV_EXPORTS void composeRT( const Mat& rvec1, const Mat& tvec1,
|
||||
CV_EXPORTS_W void composeRT( const Mat& rvec1, const Mat& tvec1,
|
||||
const Mat& rvec2, const Mat& tvec2,
|
||||
Mat& rvec3, Mat& tvec3 );
|
||||
CV_OUT Mat& rvec3, CV_OUT Mat& tvec3 );
|
||||
|
||||
//! composes 2 [R|t] transformations together. Also computes the derivatives of the result w.r.t the arguments
|
||||
CV_EXPORTS void composeRT( const Mat& rvec1, const Mat& tvec1,
|
||||
CV_EXPORTS_AS(composeRT_J) void composeRT( const Mat& rvec1, const Mat& tvec1,
|
||||
const Mat& rvec2, const Mat& tvec2,
|
||||
Mat& rvec3, Mat& tvec3,
|
||||
Mat& dr3dr1, Mat& dr3dt1,
|
||||
Mat& dr3dr2, Mat& dr3dt2,
|
||||
Mat& dt3dr1, Mat& dt3dt1,
|
||||
Mat& dt3dr2, Mat& dt3dt2 );
|
||||
CV_OUT Mat& rvec3, CV_OUT Mat& tvec3,
|
||||
CV_OUT Mat& dr3dr1, CV_OUT Mat& dr3dt1,
|
||||
CV_OUT Mat& dr3dr2, CV_OUT Mat& dr3dt2,
|
||||
CV_OUT Mat& dt3dr1, CV_OUT Mat& dt3dt1,
|
||||
CV_OUT Mat& dt3dr2, CV_OUT Mat& dt3dt2 );
|
||||
|
||||
//! projects points from the model coordinate space to the image coordinates. Takes the intrinsic and extrinsic camera parameters into account
|
||||
CV_EXPORTS void projectPoints( const Mat& objectPoints,
|
||||
const Mat& rvec, const Mat& tvec,
|
||||
const Mat& cameraMatrix,
|
||||
const Mat& distCoeffs,
|
||||
vector<Point2f>& imagePoints );
|
||||
CV_OUT vector<Point2f>& imagePoints );
|
||||
|
||||
//! projects points from the model coordinate space to the image coordinates. Also computes derivatives of the image coordinates w.r.t the intrinsic and extrinsic camera parameters
|
||||
CV_EXPORTS void projectPoints( const Mat& objectPoints,
|
||||
const Mat& rvec, const Mat& tvec,
|
||||
const Mat& cameraMatrix,
|
||||
const Mat& distCoeffs,
|
||||
vector<Point2f>& imagePoints,
|
||||
Mat& dpdrot, Mat& dpdt, Mat& dpdf,
|
||||
Mat& dpdc, Mat& dpddist,
|
||||
CV_OUT vector<Point2f>& imagePoints,
|
||||
CV_OUT Mat& dpdrot, CV_OUT Mat& dpdt, CV_OUT Mat& dpdf,
|
||||
CV_OUT Mat& dpdc, CV_OUT Mat& dpddist,
|
||||
double aspectRatio=0 );
|
||||
|
||||
//! computes the camera pose from a few 3D points and the corresponding projections. The outliers are not handled.
|
||||
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_W void solvePnP( const Mat& objectPoints,
|
||||
const Mat& imagePoints,
|
||||
const Mat& cameraMatrix,
|
||||
const Mat& distCoeffs,
|
||||
CV_OUT Mat& rvec, CV_OUT Mat& tvec,
|
||||
bool useExtrinsicGuess=false );
|
||||
|
||||
//! initializes camera matrix from a few 3D points and the corresponding projections.
|
||||
CV_EXPORTS Mat initCameraMatrix2D( const vector<vector<Point3f> >& objectPoints,
|
||||
@ -528,14 +528,14 @@ enum { CALIB_CB_ADAPTIVE_THRESH = 1, CALIB_CB_NORMALIZE_IMAGE = 2,
|
||||
|
||||
//! finds checkerboard pattern of the specified size in the image
|
||||
CV_EXPORTS bool findChessboardCorners( const Mat& image, Size patternSize,
|
||||
vector<Point2f>& corners,
|
||||
CV_OUT vector<Point2f>& corners,
|
||||
int flags=CALIB_CB_ADAPTIVE_THRESH+
|
||||
CALIB_CB_NORMALIZE_IMAGE );
|
||||
CALIB_CB_NORMALIZE_IMAGE );
|
||||
|
||||
//! draws the checkerboard pattern (found or partly found) in the image
|
||||
CV_EXPORTS void drawChessboardCorners( Mat& image, Size patternSize,
|
||||
const Mat& corners,
|
||||
bool patternWasFound );
|
||||
CV_EXPORTS_W void drawChessboardCorners( Mat& image, Size patternSize,
|
||||
const Mat& corners,
|
||||
bool patternWasFound );
|
||||
|
||||
enum
|
||||
{
|
||||
@ -559,78 +559,83 @@ enum
|
||||
|
||||
//! finds intrinsic and extrinsic camera parameters from several fews of a known calibration pattern.
|
||||
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,
|
||||
int flags=0 );
|
||||
const vector<vector<Point2f> >& imagePoints,
|
||||
Size imageSize,
|
||||
CV_IN_OUT Mat& cameraMatrix,
|
||||
CV_IN_OUT Mat& distCoeffs,
|
||||
CV_OUT vector<Mat>& rvecs, CV_OUT vector<Mat>& tvecs,
|
||||
int flags=0 );
|
||||
|
||||
//! computes several useful camera characteristics from the camera matrix, camera frame resolution and the physical sensor size.
|
||||
CV_EXPORTS void calibrationMatrixValues( const Mat& cameraMatrix,
|
||||
CV_EXPORTS_W void calibrationMatrixValues( const Mat& cameraMatrix,
|
||||
Size imageSize,
|
||||
double apertureWidth,
|
||||
double apertureHeight,
|
||||
double& fovx,
|
||||
double& fovy,
|
||||
double& focalLength,
|
||||
Point2d& principalPoint,
|
||||
double& aspectRatio );
|
||||
CV_OUT double& fovx,
|
||||
CV_OUT double& fovy,
|
||||
CV_OUT double& focalLength,
|
||||
CV_OUT Point2d& principalPoint,
|
||||
CV_OUT double& aspectRatio );
|
||||
|
||||
//! finds intrinsic and extrinsic parameters of a stereo camera
|
||||
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,
|
||||
Mat& E, Mat& F,
|
||||
TermCriteria criteria = TermCriteria(TermCriteria::COUNT+
|
||||
TermCriteria::EPS, 30, 1e-6),
|
||||
int flags=CALIB_FIX_INTRINSIC );
|
||||
const vector<vector<Point2f> >& imagePoints1,
|
||||
const vector<vector<Point2f> >& imagePoints2,
|
||||
CV_IN_OUT Mat& cameraMatrix1, CV_IN_OUT Mat& distCoeffs1,
|
||||
CV_IN_OUT Mat& cameraMatrix2, CV_IN_OUT Mat& distCoeffs2,
|
||||
Size imageSize, CV_OUT Mat& R, CV_OUT Mat& T,
|
||||
CV_OUT Mat& E, CV_OUT Mat& F,
|
||||
TermCriteria criteria = TermCriteria(TermCriteria::COUNT+
|
||||
TermCriteria::EPS, 30, 1e-6),
|
||||
int flags=CALIB_FIX_INTRINSIC );
|
||||
|
||||
|
||||
//! computes the rectification transformation for a stereo camera from its intrinsic and extrinsic parameters
|
||||
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,
|
||||
CV_OUT Mat& R1, CV_OUT Mat& R2,
|
||||
CV_OUT Mat& P1, CV_OUT Mat& P2, CV_OUT Mat& Q,
|
||||
int flags=CALIB_ZERO_DISPARITY );
|
||||
|
||||
//! computes the rectification transformation for a stereo camera from its intrinsic and extrinsic parameters
|
||||
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_W void stereoRectify( const Mat& cameraMatrix1, const Mat& distCoeffs1,
|
||||
const Mat& cameraMatrix2, const Mat& distCoeffs2,
|
||||
Size imageSize, const Mat& R, const Mat& T,
|
||||
CV_OUT Mat& R1, CV_OUT Mat& R2,
|
||||
CV_OUT Mat& P1, CV_OUT Mat& P2, CV_OUT Mat& Q,
|
||||
double alpha, Size newImageSize=Size(),
|
||||
CV_OUT Rect* validPixROI1=0, CV_OUT Rect* validPixROI2=0,
|
||||
int flags=CALIB_ZERO_DISPARITY );
|
||||
|
||||
//! computes the rectification transformation for an uncalibrated stereo camera (zero distortion is assumed)
|
||||
CV_EXPORTS bool stereoRectifyUncalibrated( const Mat& points1,
|
||||
const Mat& points2,
|
||||
const Mat& F, Size imgSize,
|
||||
Mat& H1, Mat& H2,
|
||||
double threshold=5 );
|
||||
CV_EXPORTS_W bool stereoRectifyUncalibrated( const Mat& points1, const Mat& points2,
|
||||
const Mat& F, Size imgSize,
|
||||
CV_OUT Mat& H1, CV_OUT Mat& H2,
|
||||
double threshold=5 );
|
||||
|
||||
//! computes the rectification transformations for 3-head camera, where the heads are on the same line.
|
||||
CV_EXPORTS float rectify3( const Mat& cameraMatrix1, const Mat& distCoeffs1,
|
||||
const Mat& cameraMatrix2, const Mat& distCoeffs2,
|
||||
const Mat& cameraMatrix3, const Mat& distCoeffs3,
|
||||
const vector<vector<Point2f> >& imgpt1,
|
||||
const vector<vector<Point2f> >& imgpt3,
|
||||
Size imageSize, const Mat& R12, const Mat& T12, const Mat& R13, const Mat& T13,
|
||||
Mat& R1, Mat& R2, Mat& R3, Mat& P1, Mat& P2, Mat& P3, Mat& Q,
|
||||
double alpha, Size newImgSize,
|
||||
Rect* roi1, Rect* roi2, int flags );
|
||||
//! computes the rectification transformations for 3-head camera, where all the heads are on the same line.
|
||||
CV_EXPORTS float rectify3Collinear( const Mat& cameraMatrix1, const Mat& distCoeffs1,
|
||||
const Mat& cameraMatrix2, const Mat& distCoeffs2,
|
||||
const Mat& cameraMatrix3, const Mat& distCoeffs3,
|
||||
const vector<vector<Point2f> >& imgpt1,
|
||||
const vector<vector<Point2f> >& imgpt3,
|
||||
Size imageSize, const Mat& R12, const Mat& T12,
|
||||
const Mat& R13, const Mat& T13,
|
||||
CV_OUT Mat& R1, CV_OUT Mat& R2, CV_OUT Mat& R3,
|
||||
CV_OUT Mat& P1, CV_OUT Mat& P2, CV_OUT Mat& P3, CV_OUT Mat& Q,
|
||||
double alpha, Size newImgSize,
|
||||
CV_OUT Rect* roi1, CV_OUT Rect* roi2, int flags );
|
||||
|
||||
//! returns the optimal new camera matrix
|
||||
CV_EXPORTS Mat getOptimalNewCameraMatrix( const Mat& cameraMatrix, const Mat& distCoeffs,
|
||||
Size imageSize, double alpha, Size newImgSize=Size(),
|
||||
Rect* validPixROI=0);
|
||||
CV_EXPORTS_W Mat getOptimalNewCameraMatrix( const Mat& cameraMatrix, const Mat& distCoeffs,
|
||||
Size imageSize, double alpha, Size newImgSize=Size(),
|
||||
CV_OUT Rect* validPixROI=0);
|
||||
|
||||
//! converts point coordinates from normal pixel coordinates to homogeneous coordinates ((x,y)->(x,y,1))
|
||||
CV_EXPORTS void convertPointsHomogeneous( const Mat& src, vector<Point3f>& dst );
|
||||
CV_EXPORTS void convertPointsHomogeneous( const Mat& src, CV_OUT vector<Point3f>& dst );
|
||||
//! converts point coordinates from homogeneous to normal pixel coordinates ((x,y,z)->(x/z, y/z))
|
||||
CV_EXPORTS void convertPointsHomogeneous( const Mat& src, vector<Point2f>& dst );
|
||||
CV_EXPORTS void convertPointsHomogeneous( const Mat& src, CV_OUT vector<Point2f>& dst );
|
||||
|
||||
//! the algorithm for finding fundamental matrix
|
||||
enum
|
||||
@ -643,18 +648,18 @@ enum
|
||||
|
||||
//! finds fundamental matrix from a set of corresponding 2D points
|
||||
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_OUT vector<uchar>& mask, int method=FM_RANSAC,
|
||||
double param1=3., double param2=0.99 );
|
||||
|
||||
//! finds fundamental matrix from a set of corresponding 2D points
|
||||
CV_EXPORTS Mat findFundamentalMat( const Mat& points1, const Mat& points2,
|
||||
int method=FM_RANSAC,
|
||||
double param1=3., double param2=0.99 );
|
||||
CV_EXPORTS_W Mat findFundamentalMat( const Mat& points1, const Mat& points2,
|
||||
int method=FM_RANSAC,
|
||||
double param1=3., double param2=0.99 );
|
||||
|
||||
//! finds coordinates of epipolar lines corresponding the specified points
|
||||
CV_EXPORTS void computeCorrespondEpilines( const Mat& points1,
|
||||
int whichImage, const Mat& F,
|
||||
vector<Vec3f>& lines );
|
||||
int whichImage, const Mat& F,
|
||||
CV_OUT vector<Vec3f>& lines );
|
||||
|
||||
template<> CV_EXPORTS void Ptr<CvStereoBMState>::delete_obj();
|
||||
|
||||
@ -663,20 +668,20 @@ template<> CV_EXPORTS void Ptr<CvStereoBMState>::delete_obj();
|
||||
|
||||
The class implements BM stereo correspondence algorithm by K. Konolige.
|
||||
*/
|
||||
class CV_EXPORTS StereoBM
|
||||
class CV_EXPORTS_W StereoBM
|
||||
{
|
||||
public:
|
||||
enum { PREFILTER_NORMALIZED_RESPONSE = 0, PREFILTER_XSOBEL = 1,
|
||||
BASIC_PRESET=0, FISH_EYE_PRESET=1, NARROW_PRESET=2 };
|
||||
|
||||
//! the default constructor
|
||||
StereoBM();
|
||||
CV_WRAP StereoBM();
|
||||
//! the full constructor taking the camera-specific preset, number of disparities and the SAD window size
|
||||
StereoBM(int preset, int ndisparities=0, int SADWindowSize=21);
|
||||
CV_WRAP StereoBM(int preset, int ndisparities=0, int SADWindowSize=21);
|
||||
//! the method that reinitializes the state. The previous content is destroyed
|
||||
void init(int preset, int ndisparities=0, int SADWindowSize=21);
|
||||
//! the stereo correspondence operator. Finds the disparity for the specified rectified stereo pair
|
||||
void operator()( const Mat& left, const Mat& right, Mat& disparity, int disptype=CV_16S );
|
||||
CV_WRAP_AS(compute) void operator()( const Mat& left, const Mat& right, Mat& disparity, int disptype=CV_16S );
|
||||
|
||||
//! pointer to the underlying CvStereoBMState
|
||||
Ptr<CvStereoBMState> state;
|
||||
@ -688,16 +693,16 @@ public:
|
||||
|
||||
The class implements the original SGBM stereo correspondence algorithm by H. Hirschmuller and some its modification.
|
||||
*/
|
||||
class CV_EXPORTS StereoSGBM
|
||||
class CV_EXPORTS_W StereoSGBM
|
||||
{
|
||||
public:
|
||||
enum { DISP_SHIFT=4, DISP_SCALE = (1<<DISP_SHIFT) };
|
||||
|
||||
//! the default constructor
|
||||
StereoSGBM();
|
||||
CV_WRAP StereoSGBM();
|
||||
|
||||
//! the full constructor taking all the necessary algorithm parameters
|
||||
StereoSGBM(int minDisparity, int numDisparities, int SADWindowSize,
|
||||
CV_WRAP 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,
|
||||
@ -706,40 +711,41 @@ public:
|
||||
virtual ~StereoSGBM();
|
||||
|
||||
//! the stereo correspondence operator that computes disparity map for the specified rectified stereo pair
|
||||
virtual void operator()(const Mat& left, const Mat& right, Mat& disp);
|
||||
CV_WRAP_AS(compute) 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;
|
||||
CV_PROP_RW int minDisparity;
|
||||
CV_PROP_RW int numberOfDisparities;
|
||||
CV_PROP_RW int SADWindowSize;
|
||||
CV_PROP_RW int preFilterCap;
|
||||
CV_PROP_RW int uniquenessRatio;
|
||||
CV_PROP_RW int P1;
|
||||
CV_PROP_RW int P2;
|
||||
CV_PROP_RW int speckleWindowSize;
|
||||
CV_PROP_RW int speckleRange;
|
||||
CV_PROP_RW int disp12MaxDiff;
|
||||
CV_PROP_RW bool fullDP;
|
||||
|
||||
protected:
|
||||
Mat buffer;
|
||||
};
|
||||
|
||||
//! filters off speckles (small regions of incorrectly computed disparity)
|
||||
CV_EXPORTS void filterSpeckles( Mat& img, double newVal, int maxSpeckleSize, double maxDiff, Mat& buf );
|
||||
CV_EXPORTS_W void filterSpeckles( Mat& img, double newVal, int maxSpeckleSize, double maxDiff, Mat& buf );
|
||||
|
||||
//! computes valid disparity ROI from the valid ROIs of the rectified images (that are returned by cv::stereoRectify())
|
||||
CV_EXPORTS Rect getValidDisparityROI( Rect roi1, Rect roi2,
|
||||
int minDisparity, int numberOfDisparities,
|
||||
int SADWindowSize );
|
||||
CV_EXPORTS_W Rect getValidDisparityROI( Rect roi1, Rect roi2,
|
||||
int minDisparity, int numberOfDisparities,
|
||||
int SADWindowSize );
|
||||
|
||||
//! validates disparity using the left-right check. The matrix "cost" should be computed by the stereo correspondence algorithm
|
||||
CV_EXPORTS void validateDisparity( Mat& disparity, const Mat& cost,
|
||||
int minDisparity, int numberOfDisparities,
|
||||
int disp12MaxDisp=1 );
|
||||
CV_EXPORTS_W void validateDisparity( Mat& disparity, const Mat& cost,
|
||||
int minDisparity, int numberOfDisparities,
|
||||
int disp12MaxDisp=1 );
|
||||
|
||||
//! reprojects disparity image to 3D: (x,y,d)->(X,Y,Z) using the matrix Q returned by cv::stereoRectify
|
||||
CV_EXPORTS void reprojectImageTo3D( const Mat& disparity,
|
||||
Mat& _3dImage, const Mat& Q,
|
||||
bool handleMissingValues=false );
|
||||
CV_EXPORTS_W void reprojectImageTo3D( const Mat& disparity,
|
||||
CV_OUT Mat& _3dImage, const Mat& Q,
|
||||
bool handleMissingValues=false );
|
||||
|
||||
}
|
||||
|
||||
|
@ -3097,6 +3097,7 @@ static void collectCalibrationData( const vector<vector<Point3f> >& objectPoints
|
||||
std::copy(imagePoints2[i].begin(), imagePoints2[i].end(), imgPtData2 + j);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static Mat prepareCameraMatrix(Mat& cameraMatrix0, int rtype)
|
||||
{
|
||||
@ -3293,9 +3294,9 @@ double cv::calibrateCamera( const vector<vector<Point3f> >& objectPoints,
|
||||
CvMat _cameraMatrix = cameraMatrix, _distCoeffs = distCoeffs;
|
||||
CvMat _rvecM = rvecM, _tvecM = tvecM;
|
||||
|
||||
double reprojErr = cvCalibrateCamera2(
|
||||
&_objPt, &_imgPt, &_npoints, imageSize, &_cameraMatrix,
|
||||
&_distCoeffs, &_rvecM, &_tvecM, flags );
|
||||
double reprojErr = cvCalibrateCamera2(&_objPt, &_imgPt, &_npoints, imageSize,
|
||||
&_cameraMatrix, &_distCoeffs, &_rvecM,
|
||||
&_tvecM, flags );
|
||||
rvecs.resize(nimages);
|
||||
tvecs.resize(nimages);
|
||||
for( i = 0; i < nimages; i++ )
|
||||
@ -3306,6 +3307,7 @@ double cv::calibrateCamera( const vector<vector<Point3f> >& objectPoints,
|
||||
return reprojErr;
|
||||
}
|
||||
|
||||
|
||||
void cv::calibrationMatrixValues( const Mat& cameraMatrix, Size imageSize,
|
||||
double apertureWidth, double apertureHeight,
|
||||
double& fovx, double& fovy, double& focalLength,
|
||||
@ -3349,6 +3351,7 @@ double cv::stereoCalibrate( const vector<vector<Point3f> >& objectPoints,
|
||||
&matR, &matT, &matE, &matF, criteria, flags );
|
||||
}
|
||||
|
||||
|
||||
void cv::stereoRectify( const Mat& cameraMatrix1, const Mat& distCoeffs1,
|
||||
const Mat& cameraMatrix2, const Mat& distCoeffs2,
|
||||
Size imageSize, const Mat& R, const Mat& T,
|
||||
@ -3539,7 +3542,7 @@ static void adjust3rdMatrix(const vector<vector<Point2f> >& imgpt1_0,
|
||||
|
||||
}
|
||||
|
||||
float cv::rectify3( const Mat& cameraMatrix1, const Mat& distCoeffs1,
|
||||
float cv::rectify3Collinear( const Mat& cameraMatrix1, const Mat& distCoeffs1,
|
||||
const Mat& cameraMatrix2, const Mat& distCoeffs2,
|
||||
const Mat& cameraMatrix3, const Mat& distCoeffs3,
|
||||
const vector<vector<Point2f> >& imgpt1,
|
||||
|
@ -1074,12 +1074,9 @@ static Mat _findFundamentalMat( const Mat& points1, const Mat& points2,
|
||||
int method, double param1, double param2,
|
||||
vector<uchar>* mask )
|
||||
{
|
||||
CV_Assert(points1.isContinuous() && points2.isContinuous() &&
|
||||
points1.type() == points2.type() &&
|
||||
((points1.rows == 1 && points1.channels() == 2) ||
|
||||
points1.cols*points1.channels() == 2) &&
|
||||
((points2.rows == 1 && points2.channels() == 2) ||
|
||||
points2.cols*points2.channels() == 2));
|
||||
CV_Assert(points1.checkVector(2) >= 0 && points2.checkVector(2) >= 0 &&
|
||||
(points1.depth() == CV_32F || points1.depth() == CV_32S) &&
|
||||
points1.depth() == points2.depth());
|
||||
|
||||
Mat F(3, 3, CV_64F);
|
||||
CvMat _pt1 = Mat(points1), _pt2 = Mat(points2);
|
||||
@ -1127,10 +1124,8 @@ cv::Mat cv::findFundamentalMat( const Mat& points1, const Mat& points2,
|
||||
void cv::computeCorrespondEpilines( const Mat& points, int whichImage,
|
||||
const Mat& F, vector<Vec3f>& lines )
|
||||
{
|
||||
CV_Assert(points.isContinuous() &&
|
||||
(points.depth() == CV_32S || points.depth() == CV_32F) &&
|
||||
((points.rows == 1 && points.channels() == 2) ||
|
||||
points.cols*points.channels() == 2));
|
||||
CV_Assert(points.checkVector(2) >= 0 &&
|
||||
(points.depth() == CV_32F || points.depth() == CV_32S));
|
||||
|
||||
lines.resize(points.cols*points.rows*points.channels()/2);
|
||||
CvMat _points = points, _lines = Mat(lines), matF = F;
|
||||
@ -1139,10 +1134,8 @@ void cv::computeCorrespondEpilines( const Mat& points, int whichImage,
|
||||
|
||||
void cv::convertPointsHomogeneous( const Mat& src, vector<Point3f>& dst )
|
||||
{
|
||||
CV_Assert(src.isContinuous() &&
|
||||
(src.depth() == CV_32S || src.depth() == CV_32F) &&
|
||||
((src.rows == 1 && src.channels() == 2) ||
|
||||
src.cols*src.channels() == 2));
|
||||
CV_Assert(src.checkVector(2) >= 0 &&
|
||||
(src.depth() == CV_32F || src.depth() == CV_32S));
|
||||
|
||||
dst.resize(src.cols*src.rows*src.channels()/2);
|
||||
CvMat _src = src, _dst = Mat(dst);
|
||||
@ -1151,10 +1144,8 @@ void cv::convertPointsHomogeneous( const Mat& src, vector<Point3f>& dst )
|
||||
|
||||
void cv::convertPointsHomogeneous( const Mat& src, vector<Point2f>& dst )
|
||||
{
|
||||
CV_Assert(src.isContinuous() &&
|
||||
(src.depth() == CV_32S || src.depth() == CV_32F) &&
|
||||
((src.rows == 1 && src.channels() == 3) ||
|
||||
src.cols*src.channels() == 3));
|
||||
CV_Assert(src.checkVector(3) >= 0 &&
|
||||
(src.depth() == CV_32F || src.depth() == CV_32S));
|
||||
|
||||
dst.resize(src.cols*src.rows*src.channels()/3);
|
||||
CvMat _src = Mat(src), _dst = Mat(dst);
|
||||
|
@ -238,7 +238,7 @@ CV_EXPORTS int64 getTickCount();
|
||||
exec_time = ((double)getTickCount() - exec_time)*1000./getTickFrequency();
|
||||
\endcode
|
||||
*/
|
||||
CV_EXPORTS double getTickFrequency();
|
||||
CV_EXPORTS_W double getTickFrequency();
|
||||
|
||||
/*!
|
||||
Returns the number of CPU ticks.
|
||||
@ -268,7 +268,7 @@ CV_EXPORTS int64 getCPUTickCount();
|
||||
most of the hardware acceleration is disabled and thus the function will returns false,
|
||||
until you call cv::useOptimized(true)}
|
||||
*/
|
||||
CV_EXPORTS bool checkHardwareSupport(int feature);
|
||||
CV_EXPORTS_W bool checkHardwareSupport(int feature);
|
||||
|
||||
/*!
|
||||
Allocates memory buffer
|
||||
@ -330,14 +330,14 @@ static inline size_t alignSize(size_t sz, int n)
|
||||
\note{Since optimization may imply using special data structures, it may be unsafe
|
||||
to call this function anywhere in the code. Instead, call it somewhere at the top level.}
|
||||
*/
|
||||
CV_EXPORTS void setUseOptimized(bool onoff);
|
||||
CV_EXPORTS_W void setUseOptimized(bool onoff);
|
||||
|
||||
/*!
|
||||
Returns the current optimization status
|
||||
|
||||
The function returns the current optimization status, which is controlled by cv::setUseOptimized().
|
||||
*/
|
||||
CV_EXPORTS bool useOptimized();
|
||||
CV_EXPORTS_W bool useOptimized();
|
||||
|
||||
/*!
|
||||
The STL-compilant memory Allocator based on cv::fastMalloc() and cv::fastFree()
|
||||
@ -1561,6 +1561,7 @@ public:
|
||||
//! copies the matrix content to "m".
|
||||
// It calls m.create(this->size(), this->type()).
|
||||
void copyTo( Mat& m ) const;
|
||||
template<typename _Tp> void copyTo( vector<_Tp>& v ) const;
|
||||
//! copies those matrix elements to "m" that are marked with non-zero mask elements.
|
||||
void copyTo( Mat& m, const Mat& mask ) const;
|
||||
//! converts matrix to another datatype with optional scalng. See cvConvertScale.
|
||||
@ -1678,6 +1679,9 @@ public:
|
||||
bool empty() const;
|
||||
//! returns the total number of matrix elements
|
||||
size_t total() const;
|
||||
|
||||
//! returns N if the matrix is 1-channel (N x ptdim) or ptdim-channel (1 x N) or (N x 1); negative number otherwise
|
||||
int checkVector(int elemChannels, int depth=-1, bool requireContinuous=true) const;
|
||||
|
||||
//! returns pointer to i0-th submatrix along the dimension #0
|
||||
uchar* ptr(int i0=0);
|
||||
@ -1884,86 +1888,101 @@ CV_EXPORTS void extractImageCOI(const CvArr* arr, CV_OUT Mat& coiimg, int coi=-1
|
||||
CV_EXPORTS void insertImageCOI(const Mat& coiimg, CvArr* arr, int coi=-1);
|
||||
|
||||
//! adds one matrix to another (dst = src1 + src2)
|
||||
CV_EXPORTS void add(const Mat& src1, const Mat& src2, CV_OUT Mat& dst, const Mat& mask);
|
||||
CV_EXPORTS_W void add(const Mat& src1, const Mat& src2, CV_OUT Mat& dst, const Mat& mask CV_WRAP_DEFAULT(Mat()));
|
||||
//! subtracts one matrix from another (dst = src1 - src2)
|
||||
CV_EXPORTS void subtract(const Mat& src1, const Mat& src2, CV_OUT Mat& dst, const Mat& mask);
|
||||
CV_EXPORTS_W void subtract(const Mat& src1, const Mat& src2, CV_OUT Mat& dst, const Mat& mask CV_WRAP_DEFAULT(Mat()));
|
||||
//! adds one matrix to another (dst = src1 + src2)
|
||||
CV_EXPORTS void add(const Mat& src1, const Mat& src2, CV_OUT Mat& dst);
|
||||
//! subtracts one matrix from another (dst = src1 - src2)
|
||||
CV_EXPORTS void subtract(const Mat& src1, const Mat& src2, CV_OUT Mat& dst);
|
||||
//! adds scalar to a matrix (dst = src1 + src2)
|
||||
CV_EXPORTS void add(const Mat& src1, const Scalar& src2, CV_OUT Mat& dst, const Mat& mask=Mat());
|
||||
CV_EXPORTS_W void add(const Mat& src1, const Scalar& src2, CV_OUT Mat& dst, const Mat& mask=Mat());
|
||||
//! subtracts scalar from a matrix (dst = src1 - src2)
|
||||
CV_EXPORTS void subtract(const Mat& src1, const Scalar& src2, CV_OUT Mat& dst, const Mat& mask=Mat());
|
||||
CV_EXPORTS_W void subtract(const Mat& src1, const Scalar& src2, CV_OUT Mat& dst, const Mat& mask=Mat());
|
||||
//! subtracts matrix from scalar (dst = src1 - src2)
|
||||
CV_EXPORTS void subtract(const Scalar& src1, const Mat& src2, CV_OUT Mat& dst, const Mat& mask=Mat());
|
||||
CV_EXPORTS_W void subtract(const Scalar& src1, const Mat& src2, CV_OUT Mat& dst, const Mat& mask=Mat());
|
||||
|
||||
//! computes element-wise weighted product of the two arrays (dst = scale*src1*src2)
|
||||
CV_EXPORTS void multiply(const Mat& src1, const Mat& src2, CV_OUT Mat& dst, double scale=1);
|
||||
CV_EXPORTS_W void multiply(const Mat& src1, const Mat& src2, CV_OUT Mat& dst, double scale=1);
|
||||
//! computes element-wise weighted quotient of the two arrays (dst = scale*src1/src2)
|
||||
CV_EXPORTS void divide(const Mat& src1, const Mat& src2, CV_OUT Mat& dst, double scale=1);
|
||||
CV_EXPORTS_W void divide(const Mat& src1, const Mat& src2, CV_OUT Mat& dst, double scale=1);
|
||||
//! computes element-wise weighted reciprocal of an array (dst = scale/src2)
|
||||
CV_EXPORTS void divide(double scale, const Mat& src2, CV_OUT Mat& dst);
|
||||
CV_EXPORTS_W void divide(double scale, const Mat& src2, CV_OUT Mat& dst);
|
||||
|
||||
//! adds scaled array to another one (dst = alpha*src1 + src2)
|
||||
CV_EXPORTS void scaleAdd(const Mat& src1, double alpha, const Mat& src2, CV_OUT Mat& dst);
|
||||
CV_EXPORTS_W void scaleAdd(const Mat& src1, double alpha, const Mat& src2, CV_OUT Mat& dst);
|
||||
//! computes weighted sum of two arrays (dst = alpha*src1 + beta*src2 + gamma)
|
||||
CV_EXPORTS void addWeighted(const Mat& src1, double alpha, const Mat& src2,
|
||||
CV_EXPORTS_W void addWeighted(const Mat& src1, double alpha, const Mat& src2,
|
||||
double beta, double gamma, CV_OUT Mat& dst);
|
||||
//! scales array elements, computes absolute values and converts the results to 8-bit unsigned integers: dst(i)=saturate_cast<uchar>abs(src(i)*alpha+beta)
|
||||
CV_EXPORTS void convertScaleAbs(const Mat& src, CV_OUT Mat& dst, double alpha=1, double beta=0);
|
||||
CV_EXPORTS_W void convertScaleAbs(const Mat& src, CV_OUT Mat& dst, double alpha=1, double beta=0);
|
||||
//! transforms 8-bit unsigned integers using lookup table: dst(i)=lut(src(i))
|
||||
CV_EXPORTS void LUT(const Mat& src, const Mat& lut, CV_OUT Mat& dst);
|
||||
CV_EXPORTS_W void LUT(const Mat& src, const Mat& lut, CV_OUT Mat& dst);
|
||||
|
||||
//! computes sum of array elements
|
||||
CV_EXPORTS Scalar sum(const Mat& src);
|
||||
CV_EXPORTS_W Scalar sum(const Mat& src);
|
||||
//! computes the number of nonzero array elements
|
||||
CV_EXPORTS int countNonZero( const Mat& src );
|
||||
CV_EXPORTS_W int countNonZero( const Mat& src );
|
||||
|
||||
//! computes mean value of array elements
|
||||
CV_EXPORTS Scalar mean(const Mat& src);
|
||||
//! computes mean value of selected array elements
|
||||
CV_EXPORTS Scalar mean(const Mat& src, const Mat& mask);
|
||||
CV_EXPORTS_W Scalar mean(const Mat& src, const Mat& mask CV_WRAP_DEFAULT(Mat()));
|
||||
//! computes mean value and standard deviation of all or selected array elements
|
||||
CV_EXPORTS void meanStdDev(const Mat& src, CV_OUT Scalar& mean, CV_OUT Scalar& stddev, const Mat& mask=Mat());
|
||||
CV_EXPORTS_W void meanStdDev(const Mat& src, CV_OUT Scalar& mean, CV_OUT Scalar& stddev, const Mat& mask=Mat());
|
||||
//! computes norm of array
|
||||
CV_EXPORTS double norm(const Mat& src, int normType=NORM_L2);
|
||||
CV_EXPORTS double norm(const Mat& src1, int normType=NORM_L2);
|
||||
//! computes norm of the difference between two arrays
|
||||
CV_EXPORTS double norm(const Mat& src1, const Mat& src2, int normType=NORM_L2);
|
||||
//! computes norm of the selected array part
|
||||
CV_EXPORTS double norm(const Mat& src, int normType, const Mat& mask);
|
||||
CV_EXPORTS_W double norm(const Mat& src1, int normType, const Mat& mask CV_WRAP_DEFAULT(Mat()));
|
||||
//! computes norm of selected part of the difference between two arrays
|
||||
CV_EXPORTS double norm(const Mat& src1, const Mat& src2,
|
||||
int normType, const Mat& mask);
|
||||
CV_EXPORTS_W double norm(const Mat& src1, const Mat& src2,
|
||||
int normType, const Mat& mask CV_WRAP_DEFAULT(Mat()));
|
||||
//! scales and shifts array elements so that either the specified norm (alpha) or the minimum (alpha) and maximum (beta) array values get the specified values
|
||||
CV_EXPORTS void normalize( const Mat& src, CV_OUT Mat& dst, double alpha=1, double beta=0,
|
||||
CV_EXPORTS_W void normalize( const Mat& src, CV_OUT Mat& dst, double alpha=1, double beta=0,
|
||||
int norm_type=NORM_L2, int rtype=-1, const Mat& mask=Mat());
|
||||
|
||||
//! finds global minimum and maximum array elements and returns their values and their locations
|
||||
CV_EXPORTS void minMaxLoc(const Mat& src, CV_OUT double* minVal,
|
||||
CV_EXPORTS_W void minMaxLoc(const Mat& src, CV_OUT double* minVal,
|
||||
CV_OUT double* maxVal=0, CV_OUT Point* minLoc=0,
|
||||
CV_OUT Point* maxLoc=0, const Mat& mask=Mat());
|
||||
CV_EXPORTS void minMaxIdx(const Mat& src, double* minVal,
|
||||
double* maxVal,
|
||||
CV_OUT CV_CARRAY(src.dims) int* minIdx=0,
|
||||
CV_OUT CV_CARRAY(src.dims) int* maxIdx=0,
|
||||
const Mat& mask=Mat());
|
||||
CV_EXPORTS void minMaxIdx(const Mat& src, double* minVal, double* maxVal,
|
||||
int* minIdx=0, int* maxIdx=0, const Mat& mask=Mat());
|
||||
|
||||
//! transforms 2D matrix to 1D row or column vector by taking sum, minimum, maximum or mean value over all the rows
|
||||
CV_EXPORTS void reduce(const Mat& src, CV_OUT Mat& dst, int dim, int rtype, int dtype=-1);
|
||||
CV_EXPORTS_W void reduce(const Mat& src, CV_OUT Mat& dst, int dim, int rtype, int dtype=-1);
|
||||
//! makes multi-channel array out of several single-channel arrays
|
||||
CV_EXPORTS void merge(CV_CARRAY(count) const Mat* mv, size_t count, CV_OUT Mat& dst);
|
||||
CV_EXPORTS void merge(const Mat* mv, size_t count, CV_OUT Mat& dst);
|
||||
//! copies each plane of a multi-channel array to a dedicated array
|
||||
CV_EXPORTS void split(const Mat& src, CV_OUT CV_CARRAY(src.channels()) Mat* mvbegin);
|
||||
CV_EXPORTS void split(const Mat& src, Mat* mvbegin);
|
||||
|
||||
CV_WRAP static inline void merge(const vector<Mat>& mv, Mat& dst)
|
||||
{ merge(&mv[0], mv.size(), dst); }
|
||||
|
||||
CV_WRAP static inline void split(const Mat& m, vector<Mat>& mv)
|
||||
{
|
||||
mv.resize(m.channels());
|
||||
if(m.channels() > 0)
|
||||
split(m, &mv[0]);
|
||||
}
|
||||
|
||||
//! copies selected channels from the input arrays to the selected channels of the output arrays
|
||||
CV_EXPORTS void mixChannels(CV_CARRAY(nsrcs) const Mat* src, size_t nsrcs, CV_CARRAY(ndsts) Mat* dst, size_t ndsts,
|
||||
CV_CARRAY(npairs*2) const int* fromTo, size_t npairs);
|
||||
CV_EXPORTS void mixChannels(const Mat* src, size_t nsrcs, Mat* dst, size_t ndsts,
|
||||
const int* fromTo, size_t npairs);
|
||||
|
||||
static inline void mixChannels(const vector<Mat>& src, vector<Mat>& dst,
|
||||
const int* fromTo, int npairs)
|
||||
{
|
||||
mixChannels(&src[0], (int)src.size(), &dst[0], (int)dst.size(), fromTo, npairs);
|
||||
}
|
||||
|
||||
|
||||
//! reverses the order of the rows, columns or both in a matrix
|
||||
CV_EXPORTS void flip(const Mat& src, CV_OUT Mat& dst, int flipCode);
|
||||
CV_EXPORTS_W void flip(const Mat& src, CV_OUT Mat& dst, int flipCode);
|
||||
|
||||
//! replicates the input matrix the specified number of times in the horizontal and/or vertical direction
|
||||
CV_EXPORTS void repeat(const Mat& src, int ny, int nx, CV_OUT Mat& dst);
|
||||
CV_EXPORTS_W void repeat(const Mat& src, int ny, int nx, CV_OUT Mat& dst);
|
||||
static inline Mat repeat(const Mat& src, int ny, int nx)
|
||||
{
|
||||
if( nx == 1 && ny == 1 ) return src;
|
||||
@ -1971,103 +1990,103 @@ static inline Mat repeat(const Mat& src, int ny, int nx)
|
||||
}
|
||||
|
||||
//! computes bitwise conjunction of the two arrays (dst = src1 & src2)
|
||||
CV_EXPORTS void bitwise_and(const Mat& src1, const Mat& src2, CV_OUT Mat& dst, const Mat& mask=Mat());
|
||||
CV_EXPORTS_W void bitwise_and(const Mat& src1, const Mat& src2, CV_OUT Mat& dst, const Mat& mask=Mat());
|
||||
//! computes bitwise disjunction of the two arrays (dst = src1 | src2)
|
||||
CV_EXPORTS void bitwise_or(const Mat& src1, const Mat& src2, CV_OUT Mat& dst, const Mat& mask=Mat());
|
||||
CV_EXPORTS_W void bitwise_or(const Mat& src1, const Mat& src2, CV_OUT Mat& dst, const Mat& mask=Mat());
|
||||
//! computes bitwise exclusive-or of the two arrays (dst = src1 ^ src2)
|
||||
CV_EXPORTS void bitwise_xor(const Mat& src1, const Mat& src2, CV_OUT Mat& dst, const Mat& mask=Mat());
|
||||
CV_EXPORTS_W void bitwise_xor(const Mat& src1, const Mat& src2, CV_OUT Mat& dst, const Mat& mask=Mat());
|
||||
//! computes bitwise conjunction of an array and scalar (dst = src1 & src2)
|
||||
CV_EXPORTS void bitwise_and(const Mat& src1, const Scalar& src2, CV_OUT Mat& dst, const Mat& mask=Mat());
|
||||
CV_EXPORTS_W void bitwise_and(const Mat& src1, const Scalar& src2, CV_OUT Mat& dst, const Mat& mask=Mat());
|
||||
//! computes bitwise disjunction of an array and scalar (dst = src1 | src2)
|
||||
CV_EXPORTS void bitwise_or(const Mat& src1, const Scalar& src2, CV_OUT Mat& dst, const Mat& mask=Mat());
|
||||
CV_EXPORTS_W void bitwise_or(const Mat& src1, const Scalar& src2, CV_OUT Mat& dst, const Mat& mask=Mat());
|
||||
//! computes bitwise exclusive-or of an array and scalar (dst = src1 ^ src2)
|
||||
CV_EXPORTS void bitwise_xor(const Mat& src1, const Scalar& src2, CV_OUT Mat& dst, const Mat& mask=Mat());
|
||||
CV_EXPORTS_W void bitwise_xor(const Mat& src1, const Scalar& src2, CV_OUT Mat& dst, const Mat& mask=Mat());
|
||||
//! inverts each bit of array (dst = ~src)
|
||||
CV_EXPORTS void bitwise_not(const Mat& src, CV_OUT Mat& dst);
|
||||
CV_EXPORTS_W void bitwise_not(const Mat& src, CV_OUT Mat& dst);
|
||||
//! computes element-wise absolute difference of two arrays (dst = abs(src1 - src2))
|
||||
CV_EXPORTS void absdiff(const Mat& src1, const Mat& src2, CV_OUT Mat& dst);
|
||||
CV_EXPORTS_W void absdiff(const Mat& src1, const Mat& src2, CV_OUT Mat& dst);
|
||||
//! computes element-wise absolute difference of array and scalar (dst = abs(src1 - src2))
|
||||
CV_EXPORTS void absdiff(const Mat& src1, const Scalar& src2, CV_OUT Mat& dst);
|
||||
CV_EXPORTS_W void absdiff(const Mat& src1, const Scalar& src2, CV_OUT Mat& dst);
|
||||
//! set mask elements for those array elements which are within the element-specific bounding box (dst = lowerb <= src && src < upperb)
|
||||
CV_EXPORTS void inRange(const Mat& src, const Mat& lowerb,
|
||||
CV_EXPORTS_W void inRange(const Mat& src, const Mat& lowerb,
|
||||
const Mat& upperb, CV_OUT Mat& dst);
|
||||
//! set mask elements for those array elements which are within the fixed bounding box (dst = lowerb <= src && src < upperb)
|
||||
CV_EXPORTS void inRange(const Mat& src, const Scalar& lowerb,
|
||||
CV_EXPORTS_W void inRange(const Mat& src, const Scalar& lowerb,
|
||||
const Scalar& upperb, CV_OUT Mat& dst);
|
||||
//! compares elements of two arrays (dst = src1 <cmpop> src2)
|
||||
CV_EXPORTS void compare(const Mat& src1, const Mat& src2, CV_OUT Mat& dst, int cmpop);
|
||||
CV_EXPORTS_W void compare(const Mat& src1, const Mat& src2, CV_OUT Mat& dst, int cmpop);
|
||||
//! compares elements of array with scalar (dst = src1 <cmpop> src2)
|
||||
CV_EXPORTS void compare(const Mat& src1, double s, CV_OUT Mat& dst, int cmpop);
|
||||
CV_EXPORTS_W void compare(const Mat& src1, double s, CV_OUT Mat& dst, int cmpop);
|
||||
//! computes per-element minimum of two arrays (dst = min(src1, src2))
|
||||
CV_EXPORTS void min(const Mat& src1, const Mat& src2, CV_OUT Mat& dst);
|
||||
CV_EXPORTS_W void min(const Mat& src1, const Mat& src2, CV_OUT Mat& dst);
|
||||
//! computes per-element minimum of array and scalar (dst = min(src1, src2))
|
||||
CV_EXPORTS void min(const Mat& src1, double src2, CV_OUT Mat& dst);
|
||||
CV_EXPORTS_W void min(const Mat& src1, double src2, CV_OUT Mat& dst);
|
||||
//! computes per-element maximum of two arrays (dst = max(src1, src2))
|
||||
CV_EXPORTS void max(const Mat& src1, const Mat& src2, CV_OUT Mat& dst);
|
||||
CV_EXPORTS_W void max(const Mat& src1, const Mat& src2, CV_OUT Mat& dst);
|
||||
//! computes per-element maximum of array and scalar (dst = max(src1, src2))
|
||||
CV_EXPORTS void max(const Mat& src1, double src2, CV_OUT Mat& dst);
|
||||
CV_EXPORTS_W void max(const Mat& src1, double src2, CV_OUT Mat& dst);
|
||||
|
||||
//! computes square root of each matrix element (dst = src**0.5)
|
||||
CV_EXPORTS void sqrt(const Mat& src, CV_OUT Mat& dst);
|
||||
CV_EXPORTS_W void sqrt(const Mat& src, CV_OUT Mat& dst);
|
||||
//! raises the input matrix elements to the specified power (b = a**power)
|
||||
CV_EXPORTS void pow(const Mat& src, double power, CV_OUT Mat& dst);
|
||||
CV_EXPORTS_W void pow(const Mat& src, double power, CV_OUT Mat& dst);
|
||||
//! computes exponent of each matrix element (dst = e**src)
|
||||
CV_EXPORTS void exp(const Mat& src, CV_OUT Mat& dst);
|
||||
CV_EXPORTS_W void exp(const Mat& src, CV_OUT Mat& dst);
|
||||
//! computes natural logarithm of absolute value of each matrix element: dst = log(abs(src))
|
||||
CV_EXPORTS void log(const Mat& src, CV_OUT Mat& dst);
|
||||
CV_EXPORTS_W void log(const Mat& src, CV_OUT Mat& dst);
|
||||
//! computes cube root of the argument
|
||||
CV_EXPORTS float cubeRoot(float val);
|
||||
CV_EXPORTS_W float cubeRoot(float val);
|
||||
//! computes the angle in degrees (0..360) of the vector (x,y)
|
||||
CV_EXPORTS float fastAtan2(float y, float x);
|
||||
CV_EXPORTS_W float fastAtan2(float y, float x);
|
||||
//! converts polar coordinates to Cartesian
|
||||
CV_EXPORTS void polarToCart(const Mat& magnitude, const Mat& angle,
|
||||
CV_EXPORTS_W void polarToCart(const Mat& magnitude, const Mat& angle,
|
||||
CV_OUT Mat& x, CV_OUT Mat& y, bool angleInDegrees=false);
|
||||
//! converts Cartesian coordinates to polar
|
||||
CV_EXPORTS void cartToPolar(const Mat& x, const Mat& y,
|
||||
CV_EXPORTS_W void cartToPolar(const Mat& x, const Mat& y,
|
||||
CV_OUT Mat& magnitude, CV_OUT Mat& angle,
|
||||
bool angleInDegrees=false);
|
||||
//! computes angle (angle(i)) of each (x(i), y(i)) vector
|
||||
CV_EXPORTS void phase(const Mat& x, const Mat& y, CV_OUT Mat& angle,
|
||||
bool angleInDegrees=false);
|
||||
CV_EXPORTS_W void phase(const Mat& x, const Mat& y, CV_OUT Mat& angle,
|
||||
bool angleInDegrees=false);
|
||||
//! computes magnitude (magnitude(i)) of each (x(i), y(i)) vector
|
||||
CV_EXPORTS void magnitude(const Mat& x, const Mat& y, CV_OUT Mat& magnitude);
|
||||
CV_EXPORTS_W void magnitude(const Mat& x, const Mat& y, CV_OUT Mat& magnitude);
|
||||
//! checks that each matrix element is within the specified range.
|
||||
CV_EXPORTS bool checkRange(const Mat& a, bool quiet=true, CV_OUT Point* pt=0,
|
||||
double minVal=-DBL_MAX, double maxVal=DBL_MAX);
|
||||
CV_EXPORTS_W bool checkRange(const Mat& a, bool quiet=true, CV_OUT Point* pt=0,
|
||||
double minVal=-DBL_MAX, double maxVal=DBL_MAX);
|
||||
//! implements generalized matrix product algorithm GEMM from BLAS
|
||||
CV_EXPORTS void gemm(const Mat& src1, const Mat& src2, double alpha,
|
||||
const Mat& src3, double gamma, CV_OUT Mat& dst, int flags=0);
|
||||
CV_EXPORTS_W void gemm(const Mat& src1, const Mat& src2, double alpha,
|
||||
const Mat& src3, double gamma, CV_OUT Mat& dst, int flags=0);
|
||||
//! multiplies matrix by its transposition from the left or from the right
|
||||
CV_EXPORTS void mulTransposed( const Mat& src, CV_OUT Mat& dst, bool aTa,
|
||||
const Mat& delta=Mat(),
|
||||
double scale=1, int rtype=-1 );
|
||||
CV_EXPORTS_W void mulTransposed( const Mat& src, CV_OUT Mat& dst, bool aTa,
|
||||
const Mat& delta=Mat(),
|
||||
double scale=1, int rtype=-1 );
|
||||
//! transposes the matrix
|
||||
CV_EXPORTS void transpose(const Mat& src, CV_OUT Mat& dst);
|
||||
CV_EXPORTS_W void transpose(const Mat& src, CV_OUT Mat& dst);
|
||||
//! performs affine transformation of each element of multi-channel input matrix
|
||||
CV_EXPORTS void transform(const Mat& src, CV_OUT Mat& dst, const Mat& m );
|
||||
CV_EXPORTS_W void transform(const Mat& src, CV_OUT Mat& dst, const Mat& m );
|
||||
//! performs perspective transformation of each element of multi-channel input matrix
|
||||
CV_EXPORTS void perspectiveTransform(const Mat& src, CV_OUT Mat& dst, const Mat& m );
|
||||
CV_EXPORTS_W void perspectiveTransform(const Mat& src, CV_OUT Mat& dst, const Mat& m );
|
||||
|
||||
//! extends the symmetrical matrix from the lower half or from the upper half
|
||||
CV_EXPORTS void completeSymm(Mat& mtx, bool lowerToUpper=false);
|
||||
CV_EXPORTS_W void completeSymm(Mat& mtx, bool lowerToUpper=false);
|
||||
//! initializes scaled identity matrix
|
||||
CV_EXPORTS void setIdentity(Mat& mtx, const Scalar& s=Scalar(1));
|
||||
CV_EXPORTS_W void setIdentity(Mat& mtx, const Scalar& s=Scalar(1));
|
||||
//! computes determinant of a square matrix
|
||||
CV_EXPORTS double determinant(const Mat& mtx);
|
||||
CV_EXPORTS_W double determinant(const Mat& mtx);
|
||||
//! computes trace of a matrix
|
||||
CV_EXPORTS Scalar trace(const Mat& mtx);
|
||||
CV_EXPORTS_W Scalar trace(const Mat& mtx);
|
||||
//! computes inverse or pseudo-inverse matrix
|
||||
CV_EXPORTS double invert(const Mat& src, CV_OUT Mat& dst, int flags=DECOMP_LU);
|
||||
CV_EXPORTS_W double invert(const Mat& src, CV_OUT Mat& dst, int flags=DECOMP_LU);
|
||||
//! solves linear system or a least-square problem
|
||||
CV_EXPORTS bool solve(const Mat& src1, const Mat& src2, CV_OUT Mat& dst, int flags=DECOMP_LU);
|
||||
CV_EXPORTS_W bool solve(const Mat& src1, const Mat& src2, CV_OUT Mat& dst, int flags=DECOMP_LU);
|
||||
//! sorts independently each matrix row or each matrix column
|
||||
CV_EXPORTS void sort(const Mat& src, CV_OUT Mat& dst, int flags);
|
||||
CV_EXPORTS_W void sort(const Mat& src, CV_OUT Mat& dst, int flags);
|
||||
//! sorts independently each matrix row or each matrix column
|
||||
CV_EXPORTS void sortIdx(const Mat& src, CV_OUT Mat& dst, int flags);
|
||||
CV_EXPORTS_W void sortIdx(const Mat& src, CV_OUT Mat& dst, int flags);
|
||||
//! finds real roots of a cubic polynomial
|
||||
CV_EXPORTS int solveCubic(const Mat& coeffs, CV_OUT Mat& roots);
|
||||
CV_EXPORTS_W int solveCubic(const Mat& coeffs, CV_OUT Mat& roots);
|
||||
//! finds real and complex roots of a polynomial
|
||||
CV_EXPORTS double solvePoly(const Mat& coeffs, CV_OUT Mat& roots, int maxIters=300);
|
||||
CV_EXPORTS_W double solvePoly(const Mat& coeffs, CV_OUT Mat& roots, int maxIters=300);
|
||||
//! finds eigenvalues of a symmetric matrix
|
||||
CV_EXPORTS bool eigen(const Mat& src, CV_OUT Mat& eigenvalues, int lowindex=-1,
|
||||
int highindex=-1);
|
||||
@ -2075,11 +2094,10 @@ CV_EXPORTS bool eigen(const Mat& src, CV_OUT Mat& eigenvalues, int lowindex=-1,
|
||||
CV_EXPORTS bool eigen(const Mat& src, CV_OUT Mat& eigenvalues, CV_OUT Mat& eigenvectors,
|
||||
int lowindex=-1, int highindex=-1);
|
||||
//! computes covariation matrix of a set of samples
|
||||
CV_EXPORTS void calcCovarMatrix( CV_CARRAY(nsamples) const Mat* samples, int nsamples,
|
||||
CV_OUT Mat& covar, CV_OUT Mat& mean,
|
||||
CV_EXPORTS void calcCovarMatrix( const Mat* samples, int nsamples, Mat& covar, Mat& mean,
|
||||
int flags, int ctype=CV_64F);
|
||||
//! computes covariation matrix of a set of samples
|
||||
CV_EXPORTS void calcCovarMatrix( const Mat& samples, CV_OUT Mat& covar, CV_OUT Mat& mean,
|
||||
CV_EXPORTS_W void calcCovarMatrix( const Mat& samples, CV_OUT Mat& covar, CV_OUT Mat& mean,
|
||||
int flags, int ctype=CV_64F);
|
||||
|
||||
/*!
|
||||
@ -2136,27 +2154,27 @@ CV_EXPORTS void calcCovarMatrix( const Mat& samples, CV_OUT Mat& covar, CV_OUT M
|
||||
}
|
||||
\endcode
|
||||
*/
|
||||
class CV_EXPORTS PCA
|
||||
class CV_EXPORTS_W PCA
|
||||
{
|
||||
public:
|
||||
//! default constructor
|
||||
PCA();
|
||||
CV_WRAP PCA();
|
||||
//! the constructor that performs PCA
|
||||
PCA(const Mat& data, const Mat& mean, int flags, int maxComponents=0);
|
||||
CV_WRAP PCA(const Mat& data, const Mat& mean, int flags, int maxComponents=0);
|
||||
//! operator that performs PCA. The previously stored data, if any, is released
|
||||
PCA& operator()(const Mat& data, const Mat& mean, int flags, int maxComponents=0);
|
||||
CV_WRAP_AS(compute) PCA& operator()(const Mat& data, const Mat& mean, int flags, int maxComponents=0);
|
||||
//! projects vector from the original space to the principal components subspace
|
||||
Mat project(const Mat& vec) const;
|
||||
//! projects vector from the original space to the principal components subspace
|
||||
void project(const Mat& vec, CV_OUT Mat& result) const;
|
||||
CV_WRAP void project(const Mat& vec, CV_OUT Mat& result) const;
|
||||
//! reconstructs the original vector from the projection
|
||||
Mat backProject(const Mat& vec) const;
|
||||
//! reconstructs the original vector from the projection
|
||||
void backProject(const Mat& vec, CV_OUT Mat& result) const;
|
||||
CV_WRAP void backProject(const Mat& vec, CV_OUT Mat& result) const;
|
||||
|
||||
Mat eigenvectors; //!< eigenvectors of the covariation matrix
|
||||
Mat eigenvalues; //!< eigenvalues of the covariation matrix
|
||||
Mat mean; //!< mean value subtracted before the projection and added after the back projection
|
||||
CV_PROP Mat eigenvectors; //!< eigenvectors of the covariation matrix
|
||||
CV_PROP Mat eigenvalues; //!< eigenvalues of the covariation matrix
|
||||
CV_PROP Mat mean; //!< mean value subtracted before the projection and added after the back projection
|
||||
};
|
||||
|
||||
/*!
|
||||
@ -2184,11 +2202,11 @@ public:
|
||||
SVD& operator ()( const Mat& src, int flags=0 );
|
||||
|
||||
//! decomposes matrix and stores the results to user-provided matrices
|
||||
static void compute( const Mat& src, CV_OUT Mat& w, CV_OUT Mat& u, CV_OUT Mat& vt, int flags=0 );
|
||||
CV_WRAP_AS(SVDecomp) static void compute( const Mat& src, CV_OUT Mat& w, CV_OUT Mat& u, CV_OUT Mat& vt, int flags=0 );
|
||||
//! computes singular values of a matrix
|
||||
static void compute( const Mat& src, CV_OUT Mat& w, int flags=0 );
|
||||
CV_WRAP_AS(SVDecomp) static void compute( const Mat& src, CV_OUT Mat& w, int flags=0 );
|
||||
//! performs back substitution
|
||||
static void backSubst( const Mat& w, const Mat& u, const Mat& vt,
|
||||
CV_WRAP_AS(SVBackSubst) static void backSubst( const Mat& w, const Mat& u, const Mat& vt,
|
||||
const Mat& rhs, CV_OUT Mat& dst );
|
||||
|
||||
template<typename _Tp, int m, int n, int nm> static void compute( const Matx<_Tp, m, n>& a,
|
||||
@ -2207,24 +2225,24 @@ public:
|
||||
};
|
||||
|
||||
//! computes Mahalanobis distance between two vectors: sqrt((v1-v2)'*icovar*(v1-v2)), where icovar is the inverse covariation matrix
|
||||
CV_EXPORTS double Mahalanobis(const Mat& v1, const Mat& v2, const Mat& icovar);
|
||||
CV_EXPORTS_W double Mahalanobis(const Mat& v1, const Mat& v2, const Mat& icovar);
|
||||
//! a synonym for Mahalanobis
|
||||
static inline double Mahalonobis(const Mat& v1, const Mat& v2, const Mat& icovar)
|
||||
{ return Mahalanobis(v1, v2, icovar); }
|
||||
|
||||
//! performs forward or inverse 1D or 2D Discrete Fourier Transformation
|
||||
CV_EXPORTS void dft(const Mat& src, CV_OUT Mat& dst, int flags=0, int nonzeroRows=0);
|
||||
CV_EXPORTS_W void dft(const Mat& src, CV_OUT Mat& dst, int flags=0, int nonzeroRows=0);
|
||||
//! performs inverse 1D or 2D Discrete Fourier Transformation
|
||||
CV_EXPORTS void idft(const Mat& src, CV_OUT Mat& dst, int flags=0, int nonzeroRows=0);
|
||||
CV_EXPORTS_W void idft(const Mat& src, CV_OUT Mat& dst, int flags=0, int nonzeroRows=0);
|
||||
//! performs forward or inverse 1D or 2D Discrete Cosine Transformation
|
||||
CV_EXPORTS void dct(const Mat& src, CV_OUT Mat& dst, int flags=0);
|
||||
CV_EXPORTS_W void dct(const Mat& src, CV_OUT Mat& dst, int flags=0);
|
||||
//! performs inverse 1D or 2D Discrete Cosine Transformation
|
||||
CV_EXPORTS void idct(const Mat& src, CV_OUT Mat& dst, int flags=0);
|
||||
CV_EXPORTS_W void idct(const Mat& src, CV_OUT Mat& dst, int flags=0);
|
||||
//! computes element-wise product of the two Fourier spectrums. The second spectrum can optionally be conjugated before the multiplication
|
||||
CV_EXPORTS void mulSpectrums(const Mat& a, const Mat& b, CV_OUT Mat& c,
|
||||
CV_EXPORTS_W void mulSpectrums(const Mat& a, const Mat& b, CV_OUT Mat& c,
|
||||
int flags, bool conjB=false);
|
||||
//! computes the minimal vector size vecsize1 >= vecsize so that the dft() of the vector of length vecsize1 can be computed efficiently
|
||||
CV_EXPORTS int getOptimalDFTSize(int vecsize);
|
||||
CV_EXPORTS_W int getOptimalDFTSize(int vecsize);
|
||||
|
||||
/*!
|
||||
Various k-Means flags
|
||||
@ -2236,7 +2254,7 @@ enum
|
||||
KMEANS_USE_INITIAL_LABELS=1 // Uses the user-provided labels for K-Means initialization
|
||||
};
|
||||
//! clusters the input data using k-Means algorithm
|
||||
CV_EXPORTS double kmeans( const Mat& data, int K, CV_OUT Mat& bestLabels,
|
||||
CV_EXPORTS_W double kmeans( const Mat& data, int K, CV_OUT Mat& bestLabels,
|
||||
TermCriteria criteria, int attempts,
|
||||
int flags, CV_OUT Mat* centers=0 );
|
||||
|
||||
@ -2247,22 +2265,22 @@ CV_EXPORTS RNG& theRNG();
|
||||
template<typename _Tp> static inline _Tp randu() { return (_Tp)theRNG(); }
|
||||
|
||||
//! fills array with uniformly-distributed random numbers from the range [low, high)
|
||||
static inline void randu(CV_OUT Mat& dst, const Scalar& low, const Scalar& high)
|
||||
CV_WRAP static inline void randu(CV_OUT Mat& dst, const Scalar& low, const Scalar& high)
|
||||
{ theRNG().fill(dst, RNG::UNIFORM, low, high); }
|
||||
|
||||
//! fills array with normally-distributed random numbers with the specified mean and the standard deviation
|
||||
static inline void randn(CV_OUT Mat& dst, const Scalar& mean, const Scalar& stddev)
|
||||
CV_WRAP static inline void randn(CV_OUT Mat& dst, const Scalar& mean, const Scalar& stddev)
|
||||
{ theRNG().fill(dst, RNG::NORMAL, mean, stddev); }
|
||||
|
||||
//! shuffles the input array elements
|
||||
CV_EXPORTS void randShuffle(Mat& dst, double iterFactor=1., RNG* rng=0);
|
||||
CV_EXPORTS_W void randShuffle(Mat& dst, double iterFactor=1., RNG* rng=0);
|
||||
|
||||
//! draws the line segment (pt1, pt2) in the image
|
||||
CV_EXPORTS void line(Mat& img, Point pt1, Point pt2, const Scalar& color,
|
||||
CV_EXPORTS_W void line(Mat& img, Point pt1, Point pt2, const Scalar& color,
|
||||
int thickness=1, int lineType=8, int shift=0);
|
||||
|
||||
//! draws the rectangle outline or a solid rectangle with the opposite corners pt1 and pt2 in the image
|
||||
CV_EXPORTS void rectangle(Mat& img, Point pt1, Point pt2,
|
||||
CV_EXPORTS_W void rectangle(Mat& img, Point pt1, Point pt2,
|
||||
const Scalar& color, int thickness=1,
|
||||
int lineType=8, int shift=0);
|
||||
|
||||
@ -2272,41 +2290,41 @@ CV_EXPORTS void rectangle(Mat& img, Rect rec,
|
||||
int lineType=8, int shift=0);
|
||||
|
||||
//! draws the circle outline or a solid circle in the image
|
||||
CV_EXPORTS void circle(Mat& img, Point center, int radius,
|
||||
CV_EXPORTS_W void circle(Mat& img, Point center, int radius,
|
||||
const Scalar& color, int thickness=1,
|
||||
int lineType=8, int shift=0);
|
||||
|
||||
//! draws an elliptic arc, ellipse sector or a rotated ellipse in the image
|
||||
CV_EXPORTS void ellipse(Mat& img, Point center, Size axes,
|
||||
CV_EXPORTS_W void ellipse(Mat& img, Point center, Size axes,
|
||||
double angle, double startAngle, double endAngle,
|
||||
const Scalar& color, int thickness=1,
|
||||
int lineType=8, int shift=0);
|
||||
|
||||
//! draws a rotated ellipse in the image
|
||||
CV_EXPORTS void ellipse(Mat& img, const RotatedRect& box, const Scalar& color,
|
||||
CV_EXPORTS_W void ellipse(Mat& img, const RotatedRect& box, const Scalar& color,
|
||||
int thickness=1, int lineType=8);
|
||||
|
||||
//! draws a filled convex polygon in the image
|
||||
CV_EXPORTS void fillConvexPoly(Mat& img, CV_CARRAY(npts) const Point* pts, int npts,
|
||||
CV_EXPORTS void fillConvexPoly(Mat& img, const Point* pts, int npts,
|
||||
const Scalar& color, int lineType=8,
|
||||
int shift=0);
|
||||
|
||||
//! fills an area bounded by one or more polygons
|
||||
CV_EXPORTS void fillPoly(Mat& img, CV_CARRAY(ncontours.npts) const Point** pts,
|
||||
CV_CARRAY(ncontours) const int* npts, int ncontours,
|
||||
CV_EXPORTS void fillPoly(Mat& img, const Point** pts,
|
||||
const int* npts, int ncontours,
|
||||
const Scalar& color, int lineType=8, int shift=0,
|
||||
Point offset=Point() );
|
||||
|
||||
//! draws one or more polygonal curves
|
||||
CV_EXPORTS void polylines(Mat& img, CV_CARRAY(ncontours.npts) const Point** pts, CV_CARRAY(ncontours) const int* npts,
|
||||
CV_EXPORTS void polylines(Mat& img, const Point** pts, const int* npts,
|
||||
int ncontours, bool isClosed, const Scalar& color,
|
||||
int thickness=1, int lineType=8, int shift=0 );
|
||||
|
||||
//! clips the line segment by the rectangle Rect(0, 0, imgSize.width, imgSize.height)
|
||||
CV_EXPORTS bool clipLine(Size imgSize, Point& pt1, Point& pt2);
|
||||
CV_EXPORTS bool clipLine(Size imgSize, CV_IN_OUT Point& pt1, CV_IN_OUT Point& pt2);
|
||||
|
||||
//! clips the line segment by the rectangle imgRect
|
||||
CV_EXPORTS bool clipLine(Rect imgRect, Point& pt1, Point& pt2);
|
||||
CV_EXPORTS_W bool clipLine(Rect imgRect, CV_IN_OUT Point& pt1, CV_IN_OUT Point& pt2);
|
||||
|
||||
/*!
|
||||
Line iterator class
|
||||
@ -2338,7 +2356,7 @@ public:
|
||||
};
|
||||
|
||||
//! converts elliptic arc to a polygonal curve
|
||||
CV_EXPORTS void ellipse2Poly( Point center, Size axes, int angle,
|
||||
CV_EXPORTS_W void ellipse2Poly( Point center, Size axes, int angle,
|
||||
int arcStart, int arcEnd, int delta,
|
||||
CV_OUT vector<Point>& pts );
|
||||
|
||||
@ -2356,13 +2374,13 @@ enum
|
||||
};
|
||||
|
||||
//! renders text string in the image
|
||||
CV_EXPORTS void putText( Mat& img, const string& text, Point org,
|
||||
CV_EXPORTS_W void putText( Mat& img, const string& text, Point org,
|
||||
int fontFace, double fontScale, Scalar color,
|
||||
int thickness=1, int linetype=8,
|
||||
bool bottomLeftOrigin=false );
|
||||
|
||||
//! returns bounding box of the text string
|
||||
CV_EXPORTS Size getTextSize(const string& text, int fontFace,
|
||||
CV_EXPORTS_W Size getTextSize(const string& text, int fontFace,
|
||||
double fontScale, int thickness,
|
||||
CV_OUT int* baseLine);
|
||||
|
||||
@ -3535,7 +3553,7 @@ public:
|
||||
CV_Assert(dist[0] <= dist[1] && dist[1] <= dist[2]);
|
||||
\endcode
|
||||
*/
|
||||
class CV_EXPORTS KDTree
|
||||
class CV_EXPORTS_W KDTree
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
@ -3555,13 +3573,14 @@ public:
|
||||
};
|
||||
|
||||
//! the default constructor
|
||||
KDTree();
|
||||
CV_WRAP KDTree();
|
||||
//! the full constructor that builds the search tree
|
||||
KDTree(const Mat& _points, bool copyAndReorderPoints=false);
|
||||
CV_WRAP KDTree(const Mat& _points, bool copyAndReorderPoints=false);
|
||||
//! builds the search tree
|
||||
void build(const Mat& _points, bool copyAndReorderPoints=false);
|
||||
CV_WRAP void build(const Mat& _points, bool copyAndReorderPoints=false);
|
||||
//! finds the K nearest neighbors of "vec" while looking at Emax (at most) leaves
|
||||
int findNearest(const float* vec, int K, int Emax, int* neighborsIdx,
|
||||
int findNearest(const float* vec,
|
||||
int K, int Emax, int* neighborsIdx,
|
||||
Mat* neighbors=0, float* dist=0) const;
|
||||
//! finds the K nearest neighbors while looking at Emax (at most) leaves
|
||||
int findNearest(const float* vec, int K, int Emax,
|
||||
@ -3577,12 +3596,12 @@ public:
|
||||
//! return a vector with the specified index
|
||||
const float* getPoint(int ptidx) const;
|
||||
//! returns the search space dimensionality
|
||||
int dims() const;
|
||||
CV_WRAP int dims() const;
|
||||
|
||||
vector<Node> nodes; //!< all the tree nodes
|
||||
Mat points; //!< all the points. It can be a reordered copy of the input vector set or the original vector set.
|
||||
int maxDepth; //!< maximum depth of the search tree. Do not modify it
|
||||
int normType; //!< type of the distance (cv::NORM_L1 or cv::NORM_L2) used for search. Initially set to cv::NORM_L2, but you can modify it
|
||||
CV_PROP Mat points; //!< all the points. It can be a reordered copy of the input vector set or the original vector set.
|
||||
CV_PROP int maxDepth; //!< maximum depth of the search tree. Do not modify it
|
||||
CV_PROP_RW int normType; //!< type of the distance (cv::NORM_L1 or cv::NORM_L2) used for search. Initially set to cv::NORM_L2, but you can modify it
|
||||
};
|
||||
|
||||
//////////////////////////////////////// XML & YAML I/O ////////////////////////////////////
|
||||
@ -3686,7 +3705,7 @@ class CV_EXPORTS FileNode;
|
||||
lbp_val |= ((int)*it) << k;
|
||||
\endcode
|
||||
*/
|
||||
class CV_EXPORTS FileStorage
|
||||
class CV_EXPORTS_W FileStorage
|
||||
{
|
||||
public:
|
||||
//! file storage mode
|
||||
@ -3704,29 +3723,29 @@ public:
|
||||
INSIDE_MAP=4
|
||||
};
|
||||
//! the default constructor
|
||||
FileStorage();
|
||||
CV_WRAP FileStorage();
|
||||
//! the full constructor that opens file storage for reading or writing
|
||||
FileStorage(const string& filename, int flags);
|
||||
CV_WRAP FileStorage(const string& filename, int flags);
|
||||
//! the constructor that takes pointer to the C FileStorage structure
|
||||
FileStorage(CvFileStorage* fs);
|
||||
//! the destructor. calls release()
|
||||
virtual ~FileStorage();
|
||||
|
||||
//! opens file storage for reading or writing. The previous storage is closed with release()
|
||||
virtual bool open(const string& filename, int flags);
|
||||
CV_WRAP virtual bool open(const string& filename, int flags);
|
||||
//! returns true if the object is associated with currently opened file.
|
||||
virtual bool isOpened() const;
|
||||
CV_WRAP virtual bool isOpened() const;
|
||||
//! closes the file and releases all the memory buffers
|
||||
virtual void release();
|
||||
CV_WRAP virtual void release();
|
||||
|
||||
//! returns the first element of the top-level mapping
|
||||
FileNode getFirstTopLevelNode() const;
|
||||
CV_WRAP FileNode getFirstTopLevelNode() const;
|
||||
//! returns the top-level mapping. YAML supports multiple streams
|
||||
FileNode root(int streamidx=0) const;
|
||||
CV_WRAP FileNode root(int streamidx=0) const;
|
||||
//! returns the specified element of the top-level mapping
|
||||
FileNode operator[](const string& nodename) const;
|
||||
CV_WRAP FileNode operator[](const string& nodename) const;
|
||||
//! returns the specified element of the top-level mapping
|
||||
FileNode operator[](const char* nodename) const;
|
||||
CV_WRAP FileNode operator[](const char* nodename) const;
|
||||
|
||||
//! returns pointer to the underlying C FileStorage structure
|
||||
CvFileStorage* operator *() { return fs; }
|
||||
@ -3738,7 +3757,7 @@ public:
|
||||
void writeObj( const string& name, const void* obj );
|
||||
|
||||
//! returns the normalized object name for the specified file name
|
||||
static string getDefaultObjectName(const string& filename);
|
||||
CV_WRAP static string getDefaultObjectName(const string& filename);
|
||||
|
||||
Ptr<CvFileStorage> fs; //!< the underlying C FileStorage structure
|
||||
string elname; //!< the currently written element
|
||||
@ -3758,7 +3777,7 @@ class CV_EXPORTS FileNodeIterator;
|
||||
Note that file nodes are only used for navigating file storages opened for reading.
|
||||
When a file storage is opened for writing, no data is stored in memory after it is written.
|
||||
*/
|
||||
class CV_EXPORTS FileNode
|
||||
class CV_EXPORTS_W FileNode
|
||||
{
|
||||
public:
|
||||
//! type of the file storage node
|
||||
@ -3780,7 +3799,7 @@ public:
|
||||
NAMED=64 //!< the node has a name (i.e. it is element of a mapping)
|
||||
};
|
||||
//! the default constructor
|
||||
FileNode();
|
||||
CV_WRAP FileNode();
|
||||
//! the full constructor wrapping CvFileNode structure.
|
||||
FileNode(const CvFileStorage* fs, const CvFileNode* node);
|
||||
//! the copy constructor
|
||||
@ -3788,41 +3807,41 @@ public:
|
||||
//! returns element of a mapping node
|
||||
FileNode operator[](const string& nodename) const;
|
||||
//! returns element of a mapping node
|
||||
FileNode operator[](const char* nodename) const;
|
||||
CV_WRAP FileNode operator[](const char* nodename) const;
|
||||
//! returns element of a sequence node
|
||||
FileNode operator[](int i) const;
|
||||
CV_WRAP FileNode operator[](int i) const;
|
||||
//! returns type of the node
|
||||
int type() const;
|
||||
CV_WRAP int type() const;
|
||||
|
||||
int rawDataSize(const string& fmt) const;
|
||||
CV_WRAP int rawDataSize(const string& fmt) const;
|
||||
//! returns true if the node is empty
|
||||
bool empty() const;
|
||||
CV_WRAP bool empty() const;
|
||||
//! returns true if the node is a "none" object
|
||||
bool isNone() const;
|
||||
CV_WRAP bool isNone() const;
|
||||
//! returns true if the node is a sequence
|
||||
bool isSeq() const;
|
||||
CV_WRAP bool isSeq() const;
|
||||
//! returns true if the node is a mapping
|
||||
bool isMap() const;
|
||||
CV_WRAP bool isMap() const;
|
||||
//! returns true if the node is an integer
|
||||
bool isInt() const;
|
||||
CV_WRAP bool isInt() const;
|
||||
//! returns true if the node is a floating-point number
|
||||
bool isReal() const;
|
||||
CV_WRAP bool isReal() const;
|
||||
//! returns true if the node is a text string
|
||||
bool isString() const;
|
||||
CV_WRAP bool isString() const;
|
||||
//! returns true if the node has a name
|
||||
bool isNamed() const;
|
||||
CV_WRAP bool isNamed() const;
|
||||
//! returns the node name or an empty string if the node is nameless
|
||||
string name() const;
|
||||
CV_WRAP string name() const;
|
||||
//! returns the number of elements in the node, if it is a sequence or mapping, or 1 otherwise.
|
||||
size_t size() const;
|
||||
CV_WRAP size_t size() const;
|
||||
//! returns the node content as an integer. If the node stores floating-point number, it is rounded.
|
||||
operator int() const;
|
||||
CV_WRAP operator int() const;
|
||||
//! returns the node content as float
|
||||
operator float() const;
|
||||
CV_WRAP operator float() const;
|
||||
//! returns the node content as double
|
||||
operator double() const;
|
||||
CV_WRAP operator double() const;
|
||||
//! returns the node content as text string
|
||||
operator string() const;
|
||||
CV_WRAP operator string() const;
|
||||
|
||||
//! returns pointer to the underlying file node
|
||||
CvFileNode* operator *();
|
||||
|
@ -608,14 +608,25 @@ template<typename _Tp> inline MatIterator_<_Tp> Mat::end()
|
||||
return it;
|
||||
}
|
||||
|
||||
|
||||
template<typename _Tp> inline void Mat::copyTo(vector<_Tp>& v) const
|
||||
{
|
||||
int n = checkVector(DataType<_Tp>::channels);
|
||||
if( empty() || n == 0 )
|
||||
{
|
||||
v.clear();
|
||||
return;
|
||||
}
|
||||
CV_Assert( n > 0 );
|
||||
v.resize(n);
|
||||
Mat temp(dims, size.p, DataType<_Tp>::type, &v[0]);
|
||||
convertTo(temp, DataType<_Tp>::type);
|
||||
}
|
||||
|
||||
template<typename _Tp> inline Mat::operator vector<_Tp>() const
|
||||
{
|
||||
if( empty() )
|
||||
return vector<_Tp>();
|
||||
CV_Assert( dims >= 1 && DataType<_Tp>::channels == channels());
|
||||
vector<_Tp> v(total());
|
||||
Mat temp(dims, size.p, type(), &v[0]);
|
||||
convertTo(temp, DataType<_Tp>::type);
|
||||
vector<_Tp> v;
|
||||
copyTo(v);
|
||||
return v;
|
||||
}
|
||||
|
||||
@ -1011,7 +1022,9 @@ template<typename _Tp> inline const _Tp& Mat_<_Tp>::operator ()(int i0, int i1,
|
||||
|
||||
template<typename _Tp> inline Mat_<_Tp>::operator vector<_Tp>() const
|
||||
{
|
||||
return this->Mat::operator vector<_Tp>();
|
||||
vector<_Tp> v;
|
||||
copyTo(v);
|
||||
return v;
|
||||
}
|
||||
|
||||
template<typename _Tp> template<int n> inline Mat_<_Tp>::operator Vec<typename DataType<_Tp>::channel_type, n>() const
|
||||
@ -1025,7 +1038,7 @@ template<typename _Tp> template<int m, int n> inline Mat_<_Tp>::operator Matx<ty
|
||||
CV_Assert(n % DataType<_Tp>::channels == 0);
|
||||
return this->Mat::operator Matx<typename DataType<_Tp>::channel_type, m, n>();
|
||||
}
|
||||
|
||||
|
||||
template<typename T1, typename T2, typename Op> inline void
|
||||
process( const Mat_<T1>& m1, Mat_<T2>& m2, Op op )
|
||||
{
|
||||
@ -1522,26 +1535,10 @@ operator ^= (const Mat_<_Tp>& a, const Scalar& s)
|
||||
}
|
||||
|
||||
/////////////////////////////// Miscellaneous operations //////////////////////////////
|
||||
|
||||
static inline void merge(const vector<Mat>& mv, Mat& dst)
|
||||
{ merge(&mv[0], mv.size(), dst); }
|
||||
|
||||
static inline void split(const Mat& m, vector<Mat>& mv)
|
||||
{
|
||||
mv.resize(m.channels());
|
||||
if(m.channels() > 0)
|
||||
split(m, &mv[0]);
|
||||
}
|
||||
|
||||
template<typename _Tp> void split(const Mat& src, vector<Mat_<_Tp> >& mv)
|
||||
{ split(src, (vector<Mat>&)mv ); }
|
||||
|
||||
static inline void mixChannels(const vector<Mat>& src, vector<Mat>& dst,
|
||||
const int* fromTo, int npairs)
|
||||
{
|
||||
mixChannels(&src[0], (int)src.size(), &dst[0], (int)dst.size(), fromTo, npairs);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
template<typename _Tp> inline MatExpr Mat_<_Tp>::zeros(int rows, int cols)
|
||||
|
@ -2494,10 +2494,10 @@ template<> CV_EXPORTS void Ptr<CvFileStorage>::delete_obj();
|
||||
|
||||
//////////////////////////////////////// XML & YAML I/O ////////////////////////////////////
|
||||
|
||||
CV_EXPORTS void write( FileStorage& fs, const string& name, int value );
|
||||
CV_EXPORTS void write( FileStorage& fs, const string& name, float value );
|
||||
CV_EXPORTS void write( FileStorage& fs, const string& name, double value );
|
||||
CV_EXPORTS void write( FileStorage& fs, const string& name, const string& value );
|
||||
CV_EXPORTS_W void write( FileStorage& fs, const string& name, int value );
|
||||
CV_EXPORTS_W void write( FileStorage& fs, const string& name, float value );
|
||||
CV_EXPORTS_W void write( FileStorage& fs, const string& name, double value );
|
||||
CV_EXPORTS_W void write( FileStorage& fs, const string& name, const string& value );
|
||||
|
||||
template<typename _Tp> inline void write(FileStorage& fs, const _Tp& value)
|
||||
{ write(fs, string(), value); }
|
||||
@ -2691,7 +2691,7 @@ operator << ( FileStorage& fs, const vector<_Tp>& vec )
|
||||
return fs;
|
||||
}
|
||||
|
||||
CV_EXPORTS void write( FileStorage& fs, const string& name, const Mat& value );
|
||||
CV_EXPORTS_W void write( FileStorage& fs, const string& name, const Mat& value );
|
||||
CV_EXPORTS void write( FileStorage& fs, const string& name, const SparseMat& value );
|
||||
|
||||
template<typename _Tp> static inline FileStorage& operator << (FileStorage& fs, const _Tp& value)
|
||||
@ -2792,7 +2792,7 @@ static inline void read(const FileNode& node, string& value, const string& defau
|
||||
value = !node.node ? default_value : CV_NODE_IS_STRING(node.node->tag) ? string(node.node->data.str.ptr) : string("");
|
||||
}
|
||||
|
||||
CV_EXPORTS void read(const FileNode& node, Mat& mat, const Mat& default_mat=Mat() );
|
||||
CV_EXPORTS_W void read(const FileNode& node, Mat& mat, const Mat& default_mat=Mat() );
|
||||
CV_EXPORTS void read(const FileNode& node, SparseMat& mat, const SparseMat& default_mat=SparseMat() );
|
||||
|
||||
inline FileNode::operator int() const
|
||||
|
@ -160,10 +160,16 @@ typedef signed char schar;
|
||||
/* special informative macros for wrapper generators */
|
||||
#define CV_CARRAY(counter)
|
||||
#define CV_CUSTOM_CARRAY(args)
|
||||
#define CV_METHOD
|
||||
#define CV_NO_WRAP
|
||||
#define CV_EXPORTS_W CV_EXPORTS
|
||||
#define CV_EXPORTS_AS(synonym) CV_EXPORTS
|
||||
#define CV_EXPORTS_AS_MAP CV_EXPORTS
|
||||
#define CV_IN_OUT
|
||||
#define CV_OUT
|
||||
#define CV_PROP
|
||||
#define CV_PROP_RW
|
||||
#define CV_WRAP
|
||||
#define CV_WRAP_AS(synonym)
|
||||
#define CV_WRAP_DEFAULT(value)
|
||||
|
||||
/* CvArr* is used to pass arbitrary
|
||||
* array-like data structures
|
||||
|
@ -1530,8 +1530,6 @@ void compare( const Mat& src1, double value, Mat& dst, int cmpOp )
|
||||
binarySOpC1_<CmpGE<double> >, 0},
|
||||
};
|
||||
|
||||
dst.create(src1.rows, src1.cols, CV_8U);
|
||||
CV_Assert(src1.channels() == 1);
|
||||
int depth = src1.depth();
|
||||
bool invflag = false;
|
||||
|
||||
@ -1562,7 +1560,7 @@ void compare( const Mat& src1, double value, Mat& dst, int cmpOp )
|
||||
|
||||
if( src1.dims > 2 )
|
||||
{
|
||||
dst.create(src1.dims, src1.size, CV_8U);
|
||||
dst.create(src1.dims, src1.size, CV_8UC(src1.channels()));
|
||||
const Mat* arrays[] = {&src1, &dst, 0};
|
||||
Mat planes[2];
|
||||
NAryMatIterator it(arrays, planes);
|
||||
@ -1576,6 +1574,7 @@ void compare( const Mat& src1, double value, Mat& dst, int cmpOp )
|
||||
return;
|
||||
}
|
||||
|
||||
dst.create(src1.rows, src1.cols, CV_8UC(src1.channels()));
|
||||
func( src1, dst, value );
|
||||
if( invflag )
|
||||
bitwise_not(dst, dst);
|
||||
|
@ -268,8 +268,6 @@ Mat::Mat(const Mat& m, const Range& rowRange, const Range& colRange)
|
||||
if( rows == 1 )
|
||||
flags |= CONTINUOUS_FLAG;
|
||||
|
||||
if( refcount )
|
||||
CV_XADD(refcount, 1);
|
||||
if( rows <= 0 || cols <= 0 )
|
||||
{
|
||||
release();
|
||||
@ -737,6 +735,16 @@ Mat Mat::reshape(int new_cn, int new_rows) const
|
||||
}
|
||||
|
||||
|
||||
int Mat::checkVector(int _elemChannels, int _depth, bool _requireContinuous) const
|
||||
{
|
||||
return (depth() == _depth || _depth <= 0) &&
|
||||
(isContinuous() || !_requireContinuous) &&
|
||||
((dims == 2 && (((rows == 1 || cols == 1) && channels() == _elemChannels) || (cols == _elemChannels))) ||
|
||||
(dims == 3 && channels() == 1 && size.p[2] == _elemChannels && (size.p[0] == 1 || size.p[1] == 1) &&
|
||||
(isContinuous() || step.p[1] == step.p[2]*size.p[2])))
|
||||
? (int)(total()*channels()/_elemChannels) : -1;
|
||||
}
|
||||
|
||||
/*************************************************************************************************\
|
||||
Matrix Operations
|
||||
\*************************************************************************************************/
|
||||
|
@ -254,9 +254,9 @@ public:
|
||||
};
|
||||
|
||||
//! writes vector of keypoints to the file storage
|
||||
CV_EXPORTS void write(FileStorage& fs, const string& name, const vector<KeyPoint>& keypoints);
|
||||
CV_EXPORTS_W void write(FileStorage& fs, const string& name, const vector<KeyPoint>& keypoints);
|
||||
//! reads vector of keypoints from the specified file storage node
|
||||
CV_EXPORTS void read(const FileNode& node, CV_OUT vector<KeyPoint>& keypoints);
|
||||
CV_EXPORTS_W void read(const FileNode& node, CV_OUT vector<KeyPoint>& keypoints);
|
||||
|
||||
/*!
|
||||
SIFT implementation.
|
||||
@ -347,17 +347,17 @@ protected:
|
||||
|
||||
The class implements SURF algorithm by H. Bay et al.
|
||||
*/
|
||||
class CV_EXPORTS SURF : public CvSURFParams
|
||||
class CV_EXPORTS_W SURF : public CvSURFParams
|
||||
{
|
||||
public:
|
||||
//! the default constructor
|
||||
SURF();
|
||||
CV_WRAP SURF();
|
||||
//! the full constructor taking all the necessary parameters
|
||||
SURF(double _hessianThreshold, int _nOctaves=4,
|
||||
CV_WRAP SURF(double _hessianThreshold, int _nOctaves=4,
|
||||
int _nOctaveLayers=2, bool _extended=false);
|
||||
|
||||
//! returns the descriptor size in float's (64 or 128)
|
||||
int descriptorSize() const;
|
||||
CV_WRAP int descriptorSize() const;
|
||||
//! finds the keypoints using fast hessian detector used in SURF
|
||||
CV_WRAP_AS(detect) void operator()(const Mat& img, const Mat& mask,
|
||||
CV_OUT vector<KeyPoint>& keypoints) const;
|
||||
@ -377,13 +377,13 @@ public:
|
||||
|
||||
It returns the regions, each of those is encoded as a contour.
|
||||
*/
|
||||
class CV_EXPORTS MSER : public CvMSERParams
|
||||
class CV_EXPORTS_W MSER : public CvMSERParams
|
||||
{
|
||||
public:
|
||||
//! the default constructor
|
||||
MSER();
|
||||
CV_WRAP MSER();
|
||||
//! the full constructor
|
||||
MSER( int _delta, int _min_area, int _max_area,
|
||||
CV_WRAP MSER( int _delta, int _min_area, int _max_area,
|
||||
double _max_variation, double _min_diversity,
|
||||
int _max_evolution, double _area_threshold,
|
||||
double _min_margin, int _edge_blur_size );
|
||||
@ -397,13 +397,13 @@ public:
|
||||
|
||||
The class implements the keypoint detector introduced by K. Konolige.
|
||||
*/
|
||||
class CV_EXPORTS StarDetector : public CvStarDetectorParams
|
||||
class CV_EXPORTS_W StarDetector : public CvStarDetectorParams
|
||||
{
|
||||
public:
|
||||
//! the default constructor
|
||||
StarDetector();
|
||||
CV_WRAP StarDetector();
|
||||
//! the full constructor
|
||||
StarDetector(int _maxSize, int _responseThreshold,
|
||||
CV_WRAP StarDetector(int _maxSize, int _responseThreshold,
|
||||
int _lineThresholdProjected,
|
||||
int _lineThresholdBinarized,
|
||||
int _suppressNonmaxSize);
|
||||
@ -428,8 +428,8 @@ public:
|
||||
double _lambdaMin=0.6, double _lambdaMax=1.5,
|
||||
double _thetaMin=-CV_PI, double _thetaMax=CV_PI,
|
||||
double _phiMin=-CV_PI, double _phiMax=CV_PI );
|
||||
CV_WRAP_AS(generate) void operator()(const Mat& image, Point2f pt, Mat& patch, Size patchSize, RNG& rng) const;
|
||||
CV_WRAP_AS(generate) void operator()(const Mat& image, const Mat& transform, Mat& patch,
|
||||
void operator()(const Mat& image, Point2f pt, Mat& patch, Size patchSize, RNG& rng) const;
|
||||
void operator()(const Mat& image, const Mat& transform, Mat& patch,
|
||||
Size patchSize, RNG& rng) const;
|
||||
void warpWholeImage(const Mat& image, Mat& matT, Mat& buf,
|
||||
CV_OUT Mat& warped, int border, RNG& rng) const;
|
||||
@ -453,10 +453,10 @@ public:
|
||||
LDetector();
|
||||
LDetector(int _radius, int _threshold, int _nOctaves,
|
||||
int _nViews, double _baseFeatureSize, double _clusteringDistance);
|
||||
CV_WRAP_AS(detect) void operator()(const Mat& image,
|
||||
void operator()(const Mat& image,
|
||||
CV_OUT vector<KeyPoint>& keypoints,
|
||||
int maxCount=0, bool scaleCoords=true) const;
|
||||
CV_WRAP_AS(detect) void operator()(const vector<Mat>& pyr,
|
||||
void operator()(const vector<Mat>& pyr,
|
||||
CV_OUT vector<KeyPoint>& keypoints,
|
||||
int maxCount=0, bool scaleCoords=true) const;
|
||||
void getMostStable2D(const Mat& image, CV_OUT vector<KeyPoint>& keypoints,
|
||||
@ -607,8 +607,8 @@ public:
|
||||
|
||||
void read(const FileNode& node);
|
||||
void write(FileStorage& fs, const String& name=String()) const;
|
||||
CV_WRAP_AS(detect) bool operator()(const Mat& image, CV_OUT Mat& H, CV_OUT vector<Point2f>& corners) const;
|
||||
CV_WRAP_AS(detect) bool operator()(const vector<Mat>& pyr, const vector<KeyPoint>& keypoints,
|
||||
bool operator()(const Mat& image, CV_OUT Mat& H, CV_OUT vector<Point2f>& corners) const;
|
||||
bool operator()(const vector<Mat>& pyr, const vector<KeyPoint>& keypoints,
|
||||
CV_OUT Mat& H, CV_OUT vector<Point2f>& corners,
|
||||
CV_OUT vector<int>* pairs=0) const;
|
||||
|
||||
|
@ -56,12 +56,12 @@ namespace cv
|
||||
|
||||
enum { WINDOW_AUTOSIZE=1 };
|
||||
|
||||
CV_EXPORTS void namedWindow( const string& winname, int flags CV_DEFAULT(WINDOW_AUTOSIZE) );
|
||||
CV_EXPORTS void destroyWindow( const string& winname );
|
||||
CV_EXPORTS int startWindowThread();
|
||||
CV_EXPORTS_W void namedWindow( const string& winname, int flags CV_DEFAULT(WINDOW_AUTOSIZE) );
|
||||
CV_EXPORTS_W void destroyWindow( const string& winname );
|
||||
CV_EXPORTS_W int startWindowThread();
|
||||
|
||||
CV_EXPORTS void setWindowProperty(const string& winname, int prop_id, double prop_value);//YV
|
||||
CV_EXPORTS double getWindowProperty(const string& winname, int prop_id);//YV
|
||||
CV_EXPORTS_W void setWindowProperty(const string& winname, int prop_id, double prop_value);//YV
|
||||
CV_EXPORTS_W double getWindowProperty(const string& winname, int prop_id);//YV
|
||||
|
||||
|
||||
//Only for Qt
|
||||
@ -84,75 +84,75 @@ typedef void (CV_CDECL *ButtonCallback)(int state, void* userdata);
|
||||
CV_EXPORTS int createButton( const string& bar_name, ButtonCallback on_change , void* userdata CV_DEFAULT(NULL), int type CV_DEFAULT(CV_PUSH_BUTTON), bool initial_button_state CV_DEFAULT(0));
|
||||
//-------------------------
|
||||
|
||||
CV_EXPORTS void imshow( const string& winname, const Mat& mat );
|
||||
CV_EXPORTS_W void imshow( const string& winname, const Mat& mat );
|
||||
|
||||
typedef void (CV_CDECL *TrackbarCallback)(int pos, void* userdata);
|
||||
|
||||
CV_EXPORTS int createTrackbar( const string& trackbarname, const string& winname,
|
||||
CV_EXPORTS_W int createTrackbar( const string& trackbarname, const string& winname,
|
||||
int* value, int count,
|
||||
TrackbarCallback onChange CV_DEFAULT(0),
|
||||
void* userdata CV_DEFAULT(0));
|
||||
|
||||
CV_EXPORTS int getTrackbarPos( const string& trackbarname, const string& winname );
|
||||
CV_EXPORTS void setTrackbarPos( const string& trackbarname, const string& winname, int pos );
|
||||
CV_EXPORTS_W int getTrackbarPos( const string& trackbarname, const string& winname );
|
||||
CV_EXPORTS_W void setTrackbarPos( const string& trackbarname, const string& winname, int pos );
|
||||
|
||||
typedef void (*MouseCallback )(int event, int x, int y, int flags, void* param);
|
||||
|
||||
//! assigns callback for mouse events
|
||||
CV_EXPORTS void setMouseCallback( const string& windowName, MouseCallback onMouse, void* param=0);
|
||||
CV_EXPORTS_W void setMouseCallback( const string& windowName, MouseCallback onMouse, void* param=0);
|
||||
|
||||
CV_EXPORTS Mat imread( const string& filename, int flags=1 );
|
||||
CV_EXPORTS bool imwrite( const string& filename, const Mat& img,
|
||||
CV_EXPORTS_W Mat imread( const string& filename, int flags=1 );
|
||||
CV_EXPORTS_W bool imwrite( const string& filename, const Mat& img,
|
||||
const vector<int>& params=vector<int>());
|
||||
CV_EXPORTS Mat imdecode( const Mat& buf, int flags );
|
||||
CV_EXPORTS bool imencode( const string& ext, const Mat& img,
|
||||
CV_EXPORTS_W Mat imdecode( const Mat& buf, int flags );
|
||||
CV_EXPORTS_W bool imencode( const string& ext, const Mat& img,
|
||||
CV_OUT vector<uchar>& buf,
|
||||
const vector<int>& params=vector<int>());
|
||||
|
||||
CV_EXPORTS int waitKey(int delay=0);
|
||||
CV_EXPORTS_W int waitKey(int delay=0);
|
||||
|
||||
#ifndef CV_NO_VIDEO_CAPTURE_CPP_API
|
||||
|
||||
template<> void CV_EXPORTS Ptr<CvCapture>::delete_obj();
|
||||
template<> void CV_EXPORTS Ptr<CvVideoWriter>::delete_obj();
|
||||
|
||||
class CV_EXPORTS VideoCapture
|
||||
class CV_EXPORTS_W VideoCapture
|
||||
{
|
||||
public:
|
||||
VideoCapture();
|
||||
VideoCapture(const string& filename);
|
||||
VideoCapture(int device);
|
||||
CV_WRAP VideoCapture();
|
||||
CV_WRAP VideoCapture(const string& filename);
|
||||
CV_WRAP VideoCapture(int device);
|
||||
|
||||
virtual ~VideoCapture();
|
||||
virtual bool open(const string& filename);
|
||||
virtual bool open(int device);
|
||||
virtual bool isOpened() const;
|
||||
virtual void release();
|
||||
CV_WRAP virtual bool open(const string& filename);
|
||||
CV_WRAP virtual bool open(int device);
|
||||
CV_WRAP virtual bool isOpened() const;
|
||||
CV_WRAP virtual void release();
|
||||
|
||||
virtual bool grab();
|
||||
virtual bool retrieve(CV_OUT Mat& image, int channel=0);
|
||||
virtual VideoCapture& operator >> (Mat& image);
|
||||
CV_WRAP virtual bool grab();
|
||||
CV_WRAP virtual bool retrieve(CV_OUT Mat& image, int channel=0);
|
||||
CV_WRAP_AS(read) virtual VideoCapture& operator >> (CV_OUT Mat& image);
|
||||
|
||||
virtual bool set(int propId, double value);
|
||||
virtual double get(int propId);
|
||||
CV_WRAP virtual bool set(int propId, double value);
|
||||
CV_WRAP virtual double get(int propId);
|
||||
|
||||
protected:
|
||||
Ptr<CvCapture> cap;
|
||||
};
|
||||
|
||||
|
||||
class CV_EXPORTS VideoWriter
|
||||
class CV_EXPORTS_W VideoWriter
|
||||
{
|
||||
public:
|
||||
VideoWriter();
|
||||
VideoWriter(const string& filename, int fourcc, double fps,
|
||||
CV_WRAP VideoWriter();
|
||||
CV_WRAP VideoWriter(const string& filename, int fourcc, double fps,
|
||||
Size frameSize, bool isColor=true);
|
||||
|
||||
virtual ~VideoWriter();
|
||||
virtual bool open(const string& filename, int fourcc, double fps,
|
||||
CV_WRAP virtual bool open(const string& filename, int fourcc, double fps,
|
||||
Size frameSize, bool isColor=true);
|
||||
virtual bool isOpened() const;
|
||||
virtual VideoWriter& operator << (const Mat& image);
|
||||
CV_WRAP virtual bool isOpened() const;
|
||||
CV_WRAP_AS(write) virtual VideoWriter& operator << (const Mat& image);
|
||||
|
||||
protected:
|
||||
Ptr<CvVideoWriter> writer;
|
||||
|
@ -65,7 +65,7 @@ enum { BORDER_REPLICATE=IPL_BORDER_REPLICATE, BORDER_CONSTANT=IPL_BORDER_CONSTAN
|
||||
BORDER_TRANSPARENT, BORDER_DEFAULT=BORDER_REFLECT_101, BORDER_ISOLATED=16 };
|
||||
|
||||
//! 1D interpolation function: returns coordinate of the "donor" pixel for the specified location p.
|
||||
CV_EXPORTS int borderInterpolate( int p, int len, int borderType );
|
||||
CV_EXPORTS_W int borderInterpolate( int p, int len, int borderType );
|
||||
|
||||
/*!
|
||||
The Base Class for 1D or Row-wise Filters
|
||||
@ -320,14 +320,14 @@ CV_EXPORTS Ptr<FilterEngine> createLinearFilter(int srcType, int dstType,
|
||||
int _columnBorderType=-1, const Scalar& _borderValue=Scalar());
|
||||
|
||||
//! returns the Gaussian kernel with the specified parameters
|
||||
CV_EXPORTS Mat getGaussianKernel( int ksize, double sigma, int ktype=CV_64F );
|
||||
CV_EXPORTS_W Mat getGaussianKernel( int ksize, double sigma, int ktype=CV_64F );
|
||||
|
||||
//! returns the Gaussian filter engine
|
||||
CV_EXPORTS Ptr<FilterEngine> createGaussianFilter( int type, Size ksize,
|
||||
double sigma1, double sigma2=0,
|
||||
int borderType=BORDER_DEFAULT);
|
||||
//! initializes kernels of the generalized Sobel operator
|
||||
CV_EXPORTS void getDerivKernels( CV_OUT Mat& kx, CV_OUT Mat& ky,
|
||||
CV_EXPORTS_W void getDerivKernels( CV_OUT Mat& kx, CV_OUT Mat& ky,
|
||||
int dx, int dy, int ksize,
|
||||
bool normalize=false, int ktype=CV_32F );
|
||||
//! returns filter engine for the generalized Sobel operator
|
||||
@ -370,32 +370,32 @@ CV_EXPORTS Ptr<FilterEngine> createMorphologyFilter(int op, int type, const Mat&
|
||||
//! shape of the structuring element
|
||||
enum { MORPH_RECT=0, MORPH_CROSS=1, MORPH_ELLIPSE=2 };
|
||||
//! returns structuring element of the specified shape and size
|
||||
CV_EXPORTS Mat getStructuringElement(int shape, Size ksize, Point anchor=Point(-1,-1));
|
||||
CV_EXPORTS_W Mat getStructuringElement(int shape, Size ksize, Point anchor=Point(-1,-1));
|
||||
|
||||
template<> CV_EXPORTS void Ptr<IplConvKernel>::delete_obj();
|
||||
|
||||
//! copies 2D array to a larger destination array with extrapolation of the outer part of src using the specified border mode
|
||||
CV_EXPORTS void copyMakeBorder( const Mat& src, CV_OUT Mat& dst,
|
||||
CV_EXPORTS_W void copyMakeBorder( const Mat& src, CV_OUT Mat& dst,
|
||||
int top, int bottom, int left, int right,
|
||||
int borderType, const Scalar& value=Scalar() );
|
||||
|
||||
//! smooths the image using median filter.
|
||||
CV_EXPORTS void medianBlur( const Mat& src, CV_OUT Mat& dst, int ksize );
|
||||
CV_EXPORTS_W void medianBlur( const Mat& src, CV_OUT Mat& dst, int ksize );
|
||||
//! smooths the image using Gaussian filter.
|
||||
CV_EXPORTS void GaussianBlur( const Mat& src, CV_OUT Mat& dst, Size ksize,
|
||||
CV_EXPORTS_W void GaussianBlur( const Mat& src, CV_OUT Mat& dst, Size ksize,
|
||||
double sigma1, double sigma2=0,
|
||||
int borderType=BORDER_DEFAULT );
|
||||
//! smooths the image using bilateral filter
|
||||
CV_EXPORTS void bilateralFilter( const Mat& src, CV_OUT Mat& dst, int d,
|
||||
CV_EXPORTS_W void bilateralFilter( const Mat& src, CV_OUT Mat& dst, int d,
|
||||
double sigmaColor, double sigmaSpace,
|
||||
int borderType=BORDER_DEFAULT );
|
||||
//! smooths the image using the box filter. Each pixel is processed in O(1) time
|
||||
CV_EXPORTS void boxFilter( const Mat& src, CV_OUT Mat& dst, int ddepth,
|
||||
CV_EXPORTS_W void boxFilter( const Mat& src, CV_OUT Mat& dst, int ddepth,
|
||||
Size ksize, Point anchor=Point(-1,-1),
|
||||
bool normalize=true,
|
||||
int borderType=BORDER_DEFAULT );
|
||||
//! a synonym for normalized box filter
|
||||
static inline void blur( const Mat& src, CV_OUT Mat& dst,
|
||||
CV_WRAP static inline void blur( const Mat& src, CV_OUT Mat& dst,
|
||||
Size ksize, Point anchor=Point(-1,-1),
|
||||
int borderType=BORDER_DEFAULT )
|
||||
{
|
||||
@ -403,54 +403,54 @@ static inline void blur( const Mat& src, CV_OUT Mat& dst,
|
||||
}
|
||||
|
||||
//! applies non-separable 2D linear filter to the image
|
||||
CV_EXPORTS void filter2D( const Mat& src, CV_OUT Mat& dst, int ddepth,
|
||||
CV_EXPORTS_W void filter2D( const Mat& src, CV_OUT Mat& dst, int ddepth,
|
||||
const Mat& kernel, Point anchor=Point(-1,-1),
|
||||
double delta=0, int borderType=BORDER_DEFAULT );
|
||||
|
||||
//! applies separable 2D linear filter to the image
|
||||
CV_EXPORTS void sepFilter2D( const Mat& src, CV_OUT Mat& dst, int ddepth,
|
||||
CV_EXPORTS_W void sepFilter2D( const Mat& src, CV_OUT Mat& dst, int ddepth,
|
||||
const Mat& kernelX, const Mat& kernelY,
|
||||
Point anchor=Point(-1,-1),
|
||||
double delta=0, int borderType=BORDER_DEFAULT );
|
||||
|
||||
//! applies generalized Sobel operator to the image
|
||||
CV_EXPORTS void Sobel( const Mat& src, CV_OUT Mat& dst, int ddepth,
|
||||
CV_EXPORTS_W void Sobel( const Mat& src, CV_OUT Mat& dst, int ddepth,
|
||||
int dx, int dy, int ksize=3,
|
||||
double scale=1, double delta=0,
|
||||
int borderType=BORDER_DEFAULT );
|
||||
|
||||
//! applies the vertical or horizontal Scharr operator to the image
|
||||
CV_EXPORTS void Scharr( const Mat& src, CV_OUT Mat& dst, int ddepth,
|
||||
CV_EXPORTS_W void Scharr( const Mat& src, CV_OUT Mat& dst, int ddepth,
|
||||
int dx, int dy, double scale=1, double delta=0,
|
||||
int borderType=BORDER_DEFAULT );
|
||||
|
||||
//! applies Laplacian operator to the image
|
||||
CV_EXPORTS void Laplacian( const Mat& src, CV_OUT Mat& dst, int ddepth,
|
||||
CV_EXPORTS_W void Laplacian( const Mat& src, CV_OUT Mat& dst, int ddepth,
|
||||
int ksize=1, double scale=1, double delta=0,
|
||||
int borderType=BORDER_DEFAULT );
|
||||
|
||||
//! applies Canny edge detector and produces the edge map.
|
||||
CV_EXPORTS void Canny( const Mat& image, CV_OUT Mat& edges,
|
||||
CV_EXPORTS_W void Canny( const Mat& image, CV_OUT Mat& edges,
|
||||
double threshold1, double threshold2,
|
||||
int apertureSize=3, bool L2gradient=false );
|
||||
|
||||
//! computes minimum eigen value of 2x2 derivative covariation matrix at each pixel - the cornerness criteria
|
||||
CV_EXPORTS void cornerMinEigenVal( const Mat& src, CV_OUT Mat& dst,
|
||||
CV_EXPORTS_W void cornerMinEigenVal( const Mat& src, CV_OUT Mat& dst,
|
||||
int blockSize, int ksize=3,
|
||||
int borderType=BORDER_DEFAULT );
|
||||
|
||||
//! computes Harris cornerness criteria at each image pixel
|
||||
CV_EXPORTS void cornerHarris( const Mat& src, CV_OUT Mat& dst, int blockSize,
|
||||
CV_EXPORTS_W void cornerHarris( const Mat& src, CV_OUT Mat& dst, int blockSize,
|
||||
int ksize, double k,
|
||||
int borderType=BORDER_DEFAULT );
|
||||
|
||||
//! computes both eigenvalues and the eigenvectors of 2x2 derivative covariation matrix at each pixel. The output is stored as 6-channel matrix.
|
||||
CV_EXPORTS void cornerEigenValsAndVecs( const Mat& src, CV_OUT Mat& dst,
|
||||
CV_EXPORTS_W void cornerEigenValsAndVecs( const Mat& src, CV_OUT Mat& dst,
|
||||
int blockSize, int ksize,
|
||||
int borderType=BORDER_DEFAULT );
|
||||
|
||||
//! computes another complex cornerness criteria at each pixel
|
||||
CV_EXPORTS void preCornerDetect( const Mat& src, CV_OUT Mat& dst, int ksize,
|
||||
CV_EXPORTS_W void preCornerDetect( const Mat& src, CV_OUT Mat& dst, int ksize,
|
||||
int borderType=BORDER_DEFAULT );
|
||||
|
||||
//! adjusts the corner locations with sub-pixel accuracy to maximize the certain cornerness criteria
|
||||
@ -481,19 +481,19 @@ CV_EXPORTS void HoughCircles( const Mat& image, CV_OUT vector<Vec3f>& circles,
|
||||
int minRadius=0, int maxRadius=0 );
|
||||
|
||||
//! erodes the image (applies the local minimum operator)
|
||||
CV_EXPORTS void erode( const Mat& src, CV_OUT Mat& dst, const Mat& kernel,
|
||||
CV_EXPORTS_W void erode( const Mat& src, CV_OUT Mat& dst, const Mat& kernel,
|
||||
Point anchor=Point(-1,-1), int iterations=1,
|
||||
int borderType=BORDER_CONSTANT,
|
||||
const Scalar& borderValue=morphologyDefaultBorderValue() );
|
||||
|
||||
//! dilates the image (applies the local maximum operator)
|
||||
CV_EXPORTS void dilate( const Mat& src, CV_OUT Mat& dst, const Mat& kernel,
|
||||
CV_EXPORTS_W void dilate( const Mat& src, CV_OUT Mat& dst, const Mat& kernel,
|
||||
Point anchor=Point(-1,-1), int iterations=1,
|
||||
int borderType=BORDER_CONSTANT,
|
||||
const Scalar& borderValue=morphologyDefaultBorderValue() );
|
||||
|
||||
//! applies an advanced morphological operation to the image
|
||||
CV_EXPORTS void morphologyEx( const Mat& src, CV_OUT Mat& dst,
|
||||
CV_EXPORTS_W void morphologyEx( const Mat& src, CV_OUT Mat& dst,
|
||||
int op, const Mat& kernel,
|
||||
Point anchor=Point(-1,-1), int iterations=1,
|
||||
int borderType=BORDER_CONSTANT,
|
||||
@ -512,19 +512,19 @@ enum
|
||||
};
|
||||
|
||||
//! resizes the image
|
||||
CV_EXPORTS void resize( const Mat& src, CV_OUT Mat& dst,
|
||||
CV_EXPORTS_W void resize( const Mat& src, CV_OUT Mat& dst,
|
||||
Size dsize, double fx=0, double fy=0,
|
||||
int interpolation=INTER_LINEAR );
|
||||
|
||||
//! warps the image using affine transformation
|
||||
CV_EXPORTS void warpAffine( const Mat& src, CV_OUT Mat& dst,
|
||||
CV_EXPORTS_W void warpAffine( const Mat& src, CV_OUT Mat& dst,
|
||||
const Mat& M, Size dsize,
|
||||
int flags=INTER_LINEAR,
|
||||
int borderMode=BORDER_CONSTANT,
|
||||
const Scalar& borderValue=Scalar());
|
||||
|
||||
//! warps the image using perspective transformation
|
||||
CV_EXPORTS void warpPerspective( const Mat& src, CV_OUT Mat& dst,
|
||||
CV_EXPORTS_W void warpPerspective( const Mat& src, CV_OUT Mat& dst,
|
||||
const Mat& M, Size dsize,
|
||||
int flags=INTER_LINEAR,
|
||||
int borderMode=BORDER_CONSTANT,
|
||||
@ -535,44 +535,44 @@ enum { INTER_BITS=5, INTER_BITS2=INTER_BITS*2,
|
||||
INTER_TAB_SIZE2=INTER_TAB_SIZE*INTER_TAB_SIZE };
|
||||
|
||||
//! warps the image using the precomputed maps. The maps are stored in either floating-point or integer fixed-point format
|
||||
CV_EXPORTS void remap( const Mat& src, CV_OUT Mat& dst, const Mat& map1, const Mat& map2,
|
||||
CV_EXPORTS_W void remap( const Mat& src, CV_OUT Mat& dst, const Mat& map1, const Mat& map2,
|
||||
int interpolation, int borderMode=BORDER_CONSTANT,
|
||||
const Scalar& borderValue=Scalar());
|
||||
|
||||
//! converts maps for remap from floating-point to fixed-point format or backwards
|
||||
CV_EXPORTS void convertMaps( const Mat& map1, const Mat& map2,
|
||||
CV_EXPORTS_W void convertMaps( const Mat& map1, const Mat& map2,
|
||||
CV_OUT Mat& dstmap1, CV_OUT Mat& dstmap2,
|
||||
int dstmap1type, bool nninterpolation=false );
|
||||
|
||||
//! returns 2x3 affine transformation matrix for the planar rotation.
|
||||
CV_EXPORTS Mat getRotationMatrix2D( Point2f center, double angle, double scale );
|
||||
CV_EXPORTS_W Mat getRotationMatrix2D( Point2f center, double angle, double scale );
|
||||
//! returns 3x3 perspective transformation for the corresponding 4 point pairs.
|
||||
CV_EXPORTS Mat getPerspectiveTransform( const Point2f src[], const Point2f dst[] );
|
||||
//! returns 2x3 affine transformation for the corresponding 3 point pairs.
|
||||
CV_EXPORTS Mat getAffineTransform( const Point2f src[], const Point2f dst[] );
|
||||
//! computes 2x3 affine transformation matrix that is inverse to the specified 2x3 affine transformation.
|
||||
CV_EXPORTS void invertAffineTransform( const Mat& M, CV_OUT Mat& iM );
|
||||
CV_EXPORTS_W void invertAffineTransform( const Mat& M, CV_OUT Mat& iM );
|
||||
|
||||
//! extracts rectangle from the image at sub-pixel location
|
||||
CV_EXPORTS void getRectSubPix( const Mat& image, Size patchSize,
|
||||
CV_EXPORTS_W void getRectSubPix( const Mat& image, Size patchSize,
|
||||
Point2f center, CV_OUT Mat& patch, int patchType=-1 );
|
||||
|
||||
//! computes the integral image
|
||||
CV_EXPORTS void integral( const Mat& src, CV_OUT Mat& sum, int sdepth=-1 );
|
||||
CV_EXPORTS_W void integral( const Mat& src, CV_OUT Mat& sum, int sdepth=-1 );
|
||||
//! computes the integral image and integral for the squared image
|
||||
CV_EXPORTS void integral( const Mat& src, CV_OUT Mat& sum, CV_OUT Mat& sqsum, int sdepth=-1 );
|
||||
CV_EXPORTS_AS(integral2) void integral( const Mat& src, CV_OUT Mat& sum, CV_OUT Mat& sqsum, int sdepth=-1 );
|
||||
//! computes the integral image, integral for the squared image and the tilted integral image
|
||||
CV_EXPORTS void integral( const Mat& src, CV_OUT Mat& sum, CV_OUT Mat& sqsum, CV_OUT Mat& tilted, int sdepth=-1 );
|
||||
CV_EXPORTS_AS(integral3) void integral( const Mat& src, CV_OUT Mat& sum, CV_OUT Mat& sqsum, CV_OUT Mat& tilted, int sdepth=-1 );
|
||||
|
||||
//! adds image to the accumulator (dst += src). Unlike cv::add, dst and src can have different types.
|
||||
CV_EXPORTS void accumulate( const Mat& src, CV_OUT Mat& dst, const Mat& mask=Mat() );
|
||||
CV_EXPORTS_W void accumulate( const Mat& src, CV_OUT Mat& dst, const Mat& mask=Mat() );
|
||||
//! adds squared src image to the accumulator (dst += src*src).
|
||||
CV_EXPORTS void accumulateSquare( const Mat& src, CV_OUT Mat& dst, const Mat& mask=Mat() );
|
||||
CV_EXPORTS_W void accumulateSquare( const Mat& src, CV_OUT Mat& dst, const Mat& mask=Mat() );
|
||||
//! adds product of the 2 images to the accumulator (dst += src1*src2).
|
||||
CV_EXPORTS void accumulateProduct( const Mat& src1, const Mat& src2,
|
||||
CV_EXPORTS_W void accumulateProduct( const Mat& src1, const Mat& src2,
|
||||
CV_OUT Mat& dst, const Mat& mask=Mat() );
|
||||
//! updates the running average (dst = dst*(1-alpha) + src*alpha)
|
||||
CV_EXPORTS void accumulateWeighted( const Mat& src, CV_OUT Mat& dst,
|
||||
CV_EXPORTS_W void accumulateWeighted( const Mat& src, CV_OUT Mat& dst,
|
||||
double alpha, const Mat& mask=Mat() );
|
||||
|
||||
//! type of the threshold operation
|
||||
@ -580,28 +580,28 @@ enum { THRESH_BINARY=0, THRESH_BINARY_INV=1, THRESH_TRUNC=2, THRESH_TOZERO=3,
|
||||
THRESH_TOZERO_INV=4, THRESH_MASK=7, THRESH_OTSU=8 };
|
||||
|
||||
//! applies fixed threshold to the image
|
||||
CV_EXPORTS double threshold( const Mat& src, CV_OUT Mat& dst, double thresh, double maxval, int type );
|
||||
CV_EXPORTS_W double threshold( const Mat& src, CV_OUT Mat& dst, double thresh, double maxval, int type );
|
||||
|
||||
//! adaptive threshold algorithm
|
||||
enum { ADAPTIVE_THRESH_MEAN_C=0, ADAPTIVE_THRESH_GAUSSIAN_C=1 };
|
||||
|
||||
//! applies variable (adaptive) threshold to the image
|
||||
CV_EXPORTS void adaptiveThreshold( const Mat& src, CV_OUT Mat& dst, double maxValue,
|
||||
CV_EXPORTS_W void adaptiveThreshold( const Mat& src, CV_OUT Mat& dst, double maxValue,
|
||||
int adaptiveMethod, int thresholdType,
|
||||
int blockSize, double C );
|
||||
|
||||
//! smooths and downsamples the image
|
||||
CV_EXPORTS void pyrDown( const Mat& src, CV_OUT Mat& dst, const Size& dstsize=Size());
|
||||
CV_EXPORTS_W void pyrDown( const Mat& src, CV_OUT Mat& dst, const Size& dstsize=Size());
|
||||
//! upsamples and smoothes the image
|
||||
CV_EXPORTS void pyrUp( const Mat& src, CV_OUT Mat& dst, const Size& dstsize=Size());
|
||||
CV_EXPORTS_W void pyrUp( const Mat& src, CV_OUT Mat& dst, const Size& dstsize=Size());
|
||||
//! builds the gaussian pyramid using pyrDown() as a basic operation
|
||||
CV_EXPORTS void buildPyramid( const Mat& src, CV_OUT vector<Mat>& dst, int maxlevel );
|
||||
|
||||
//! corrects lens distortion for the given camera matrix and distortion coefficients
|
||||
CV_EXPORTS void undistort( const Mat& src, CV_OUT Mat& dst, const Mat& cameraMatrix,
|
||||
CV_EXPORTS_W void undistort( const Mat& src, CV_OUT Mat& dst, const Mat& cameraMatrix,
|
||||
const Mat& distCoeffs, const Mat& newCameraMatrix=Mat() );
|
||||
//! initializes maps for cv::remap() to correct lens distortion and optionally rectify the image
|
||||
CV_EXPORTS void initUndistortRectifyMap( const Mat& cameraMatrix, const Mat& distCoeffs,
|
||||
CV_EXPORTS_W void initUndistortRectifyMap( const Mat& cameraMatrix, const Mat& distCoeffs,
|
||||
const Mat& R, const Mat& newCameraMatrix,
|
||||
Size size, int m1type, CV_OUT Mat& map1, CV_OUT Mat& map2 );
|
||||
|
||||
@ -612,67 +612,64 @@ enum
|
||||
};
|
||||
|
||||
//! initializes maps for cv::remap() for wide-angle
|
||||
CV_EXPORTS float initWideAngleProjMap( const Mat& cameraMatrix, const Mat& distCoeffs,
|
||||
CV_EXPORTS_W float initWideAngleProjMap( const Mat& cameraMatrix, const Mat& distCoeffs,
|
||||
Size imageSize, int destImageWidth,
|
||||
int m1type, CV_OUT Mat& map1, CV_OUT Mat& map2,
|
||||
int projType=PROJ_SPHERICAL_EQRECT, double alpha=0);
|
||||
|
||||
//! returns the default new camera matrix (by default it is the same as cameraMatrix unless centerPricipalPoint=true)
|
||||
CV_EXPORTS Mat getDefaultNewCameraMatrix( const Mat& cameraMatrix, Size imgsize=Size(),
|
||||
CV_EXPORTS_W Mat getDefaultNewCameraMatrix( const Mat& cameraMatrix, Size imgsize=Size(),
|
||||
bool centerPrincipalPoint=false );
|
||||
//! returns points' coordinates after lens distortion correction
|
||||
CV_EXPORTS void undistortPoints( const Mat& src, CV_OUT vector<Point2f>& dst,
|
||||
const Mat& cameraMatrix, const Mat& distCoeffs,
|
||||
const Mat& R=Mat(), const Mat& P=Mat());
|
||||
//! returns points' coordinates after lens distortion correction
|
||||
CV_EXPORTS void undistortPoints( const Mat& src, CV_OUT Mat& dst,
|
||||
CV_EXPORTS_W void undistortPoints( const Mat& src, CV_OUT Mat& dst,
|
||||
const Mat& cameraMatrix, const Mat& distCoeffs,
|
||||
const Mat& R=Mat(), const Mat& P=Mat());
|
||||
|
||||
template<> CV_EXPORTS void Ptr<CvHistogram>::delete_obj();
|
||||
|
||||
//! computes the joint dense histogram for a set of images.
|
||||
CV_EXPORTS void calcHist( CV_CARRAY(nimages) const Mat* images, int nimages,
|
||||
CV_CARRAY(dims) const int* channels, const Mat& mask,
|
||||
CV_OUT Mat& hist, int dims, CV_CARRAY(dims) const int* histSize,
|
||||
CV_CUSTOM_CARRAY((dims,histSize,uniform)) const float** ranges,
|
||||
bool uniform=true, bool accumulate=false );
|
||||
CV_EXPORTS void calcHist( const Mat* images, int nimages,
|
||||
const int* channels, const Mat& mask,
|
||||
Mat& hist, int dims, const int* histSize,
|
||||
const float** ranges, bool uniform=true, bool accumulate=false );
|
||||
|
||||
//! computes the joint sparse histogram for a set of images.
|
||||
CV_EXPORTS void calcHist( CV_CARRAY(nimages) const Mat* images, int nimages,
|
||||
CV_CARRAY(dims) const int* channels, const Mat& mask,
|
||||
CV_OUT SparseMat& hist, int dims, CV_CARRAY(dims) const int* histSize,
|
||||
CV_CUSTOM_CARRAY((dims,histSize,uniform)) const float** ranges,
|
||||
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 );
|
||||
|
||||
//! computes back projection for the set of images
|
||||
CV_EXPORTS void calcBackProject( CV_CARRAY(nimages) const Mat* images, int nimages,
|
||||
CV_CARRAY(hist.dims) const int* channels, const Mat& hist,
|
||||
CV_OUT Mat& backProject,
|
||||
CV_CUSTOM_CARRAY(hist) const float** ranges,
|
||||
CV_EXPORTS void calcBackProject( const Mat* images, int nimages,
|
||||
const int* channels, const Mat& hist,
|
||||
Mat& backProject, const float** ranges,
|
||||
double scale=1, bool uniform=true );
|
||||
|
||||
//! computes back projection for the set of images
|
||||
CV_EXPORTS void calcBackProject( CV_CARRAY(nimages) const Mat* images, int nimages,
|
||||
CV_CARRAY(hist.dims()) const int* channels,
|
||||
const SparseMat& hist, CV_OUT Mat& backProject,
|
||||
CV_CUSTOM_CARRAY(hist) const 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 );
|
||||
|
||||
//! compares two histograms stored in dense arrays
|
||||
CV_EXPORTS double compareHist( const Mat& H1, const Mat& H2, int method );
|
||||
CV_EXPORTS_W double compareHist( const Mat& H1, const Mat& H2, int method );
|
||||
|
||||
//! compares two histograms stored in sparse arrays
|
||||
CV_EXPORTS double compareHist( const SparseMat& H1, const SparseMat& H2, int method );
|
||||
|
||||
//! normalizes the grayscale image brightness and contrast by normalizing its histogram
|
||||
CV_EXPORTS void equalizeHist( const Mat& src, CV_OUT Mat& dst );
|
||||
CV_EXPORTS_W void equalizeHist( const Mat& src, CV_OUT Mat& dst );
|
||||
|
||||
//! segments the image using watershed algorithm
|
||||
CV_EXPORTS void watershed( const Mat& image, Mat& markers );
|
||||
CV_EXPORTS_W void watershed( const Mat& image, Mat& markers );
|
||||
|
||||
//! filters image using meanshift algorithm
|
||||
CV_EXPORTS void pyrMeanShiftFiltering( const Mat& src, CV_OUT Mat& dst,
|
||||
CV_EXPORTS_W void pyrMeanShiftFiltering( const Mat& src, CV_OUT Mat& dst,
|
||||
double sp, double sr, int maxLevel=1,
|
||||
TermCriteria termcrit=TermCriteria(TermCriteria::MAX_ITER+TermCriteria::EPS,5,1) );
|
||||
|
||||
@ -690,7 +687,7 @@ enum { GC_INIT_WITH_RECT = 0,
|
||||
};
|
||||
|
||||
//! segments the image using GrabCut algorithm
|
||||
CV_EXPORTS void grabCut( const Mat& img, Mat& mask, Rect rect,
|
||||
CV_EXPORTS_W void grabCut( const Mat& img, Mat& mask, Rect rect,
|
||||
Mat& bgdModel, Mat& fgdModel,
|
||||
int iterCount, int mode = GC_EVAL );
|
||||
|
||||
@ -702,34 +699,35 @@ enum
|
||||
};
|
||||
|
||||
//! restores the damaged image areas using one of the available intpainting algorithms
|
||||
CV_EXPORTS void inpaint( const Mat& src, const Mat& inpaintMask,
|
||||
CV_EXPORTS_W void inpaint( const Mat& src, const Mat& inpaintMask,
|
||||
CV_OUT Mat& dst, double inpaintRange, int flags );
|
||||
|
||||
//! builds the discrete Voronoi diagram
|
||||
CV_EXPORTS void distanceTransform( const Mat& src, CV_OUT Mat& dst, Mat& labels,
|
||||
int distanceType, int maskSize );
|
||||
CV_EXPORTS_AS(distanceTransformWithLabels)
|
||||
void distanceTransform( const Mat& src, CV_OUT Mat& dst, Mat& labels,
|
||||
int distanceType, int maskSize );
|
||||
|
||||
//! computes the distance transform map
|
||||
CV_EXPORTS void distanceTransform( const Mat& src, CV_OUT Mat& dst,
|
||||
CV_EXPORTS_W void distanceTransform( const Mat& src, CV_OUT Mat& dst,
|
||||
int distanceType, int maskSize );
|
||||
|
||||
enum { FLOODFILL_FIXED_RANGE = 1 << 16,
|
||||
FLOODFILL_MASK_ONLY = 1 << 17 };
|
||||
|
||||
//! fills the semi-uniform image region starting from the specified seed point
|
||||
CV_EXPORTS int floodFill( Mat& image,
|
||||
CV_EXPORTS_W int floodFill( Mat& image,
|
||||
Point seedPoint, Scalar newVal, Rect* rect=0,
|
||||
Scalar loDiff=Scalar(), Scalar upDiff=Scalar(),
|
||||
int flags=4 );
|
||||
|
||||
//! fills the semi-uniform image region and/or the mask starting from the specified seed point
|
||||
CV_EXPORTS int floodFill( Mat& image, Mat& mask,
|
||||
CV_EXPORTS_AS(floodFillMask) int floodFill( Mat& image, Mat& mask,
|
||||
Point seedPoint, Scalar newVal, Rect* rect=0,
|
||||
Scalar loDiff=Scalar(), Scalar upDiff=Scalar(),
|
||||
int flags=4 );
|
||||
|
||||
//! converts image from one color space to another
|
||||
CV_EXPORTS void cvtColor( const Mat& src, CV_OUT Mat& dst, int code, int dstCn=0 );
|
||||
CV_EXPORTS_W void cvtColor( const Mat& src, CV_OUT Mat& dst, int code, int dstCn=0 );
|
||||
|
||||
//! raster image moments
|
||||
class CV_EXPORTS Moments
|
||||
@ -754,7 +752,7 @@ public:
|
||||
};
|
||||
|
||||
//! computes moments of the rasterized shape or a vector of points
|
||||
CV_EXPORTS Moments moments( const Mat& array, bool binaryImage=false );
|
||||
CV_EXPORTS_W Moments moments( const Mat& array, bool binaryImage=false );
|
||||
|
||||
//! computes 7 Hu invariants from the moments
|
||||
CV_EXPORTS void HuMoments( const Moments& moments, double hu[7] );
|
||||
@ -763,7 +761,7 @@ CV_EXPORTS void HuMoments( const Moments& moments, double hu[7] );
|
||||
enum { TM_SQDIFF=0, TM_SQDIFF_NORMED=1, TM_CCORR=2, TM_CCORR_NORMED=3, TM_CCOEFF=4, TM_CCOEFF_NORMED=5 };
|
||||
|
||||
//! computes the proximity map for the raster template and the image where the template is searched for
|
||||
CV_EXPORTS void matchTemplate( const Mat& image, const Mat& templ, CV_OUT Mat& result, int method );
|
||||
CV_EXPORTS_W void matchTemplate( const Mat& image, const Mat& templ, CV_OUT Mat& result, int method );
|
||||
|
||||
//! mode of the contour retrieval algorithm
|
||||
enum
|
||||
@ -808,18 +806,18 @@ CV_EXPORTS void approxPolyDP( const Mat& curve,
|
||||
CV_OUT vector<Point2f>& approxCurve,
|
||||
double epsilon, bool closed );
|
||||
//! computes the contour perimeter (closed=true) or a curve length
|
||||
CV_EXPORTS double arcLength( const Mat& curve, bool closed );
|
||||
CV_EXPORTS_W double arcLength( const Mat& curve, bool closed );
|
||||
//! computes the bounding rectangle for a contour
|
||||
CV_EXPORTS Rect boundingRect( const Mat& points );
|
||||
CV_EXPORTS_W Rect boundingRect( const Mat& points );
|
||||
//! computes the contour area
|
||||
CV_EXPORTS double contourArea( const Mat& contour, bool oriented=false );
|
||||
CV_EXPORTS_W double contourArea( const Mat& contour, bool oriented=false );
|
||||
//! computes the minimal rotated rectangle for a set of points
|
||||
CV_EXPORTS RotatedRect minAreaRect( const Mat& points );
|
||||
CV_EXPORTS_W RotatedRect minAreaRect( const Mat& points );
|
||||
//! computes the minimal enclosing circle for a set of points
|
||||
CV_EXPORTS void minEnclosingCircle( const Mat& points,
|
||||
CV_EXPORTS_W void minEnclosingCircle( const Mat& points,
|
||||
Point2f& center, float& radius );
|
||||
//! matches two contours using one of the available algorithms
|
||||
CV_EXPORTS double matchShapes( const Mat& contour1,
|
||||
CV_EXPORTS_W double matchShapes( const Mat& contour1,
|
||||
const Mat& contour2,
|
||||
int method, double parameter );
|
||||
//! computes convex hull for a set of 2D points.
|
||||
@ -830,28 +828,28 @@ CV_EXPORTS void convexHull( const Mat& points, CV_OUT vector<Point>& hull, bool
|
||||
CV_EXPORTS void convexHull( const Mat& points, CV_OUT vector<Point2f>& hull, bool clockwise=false );
|
||||
|
||||
//! returns true iff the contour is convex. Does not support contours with self-intersection
|
||||
CV_EXPORTS bool isContourConvex( const Mat& contour );
|
||||
CV_EXPORTS_W bool isContourConvex( const Mat& contour );
|
||||
|
||||
//! fits ellipse to the set of 2D points
|
||||
CV_EXPORTS RotatedRect fitEllipse( const Mat& points );
|
||||
CV_EXPORTS_W RotatedRect fitEllipse( const Mat& points );
|
||||
|
||||
//! fits line to the set of 2D points using M-estimator algorithm
|
||||
CV_EXPORTS void fitLine( const Mat& points, CV_OUT Vec4f& line, int distType,
|
||||
double param, double reps, double aeps );
|
||||
double param, double reps, double aeps );
|
||||
//! fits line to the set of 3D points using M-estimator algorithm
|
||||
CV_EXPORTS void fitLine( const Mat& points, CV_OUT Vec6f& line, int distType,
|
||||
double param, double reps, double aeps );
|
||||
double param, double reps, double aeps );
|
||||
//! checks if the point is inside the contour. Optionally computes the signed distance from the point to the contour boundary
|
||||
CV_EXPORTS double pointPolygonTest( const Mat& contour,
|
||||
CV_EXPORTS_W double pointPolygonTest( const Mat& contour,
|
||||
Point2f pt, bool measureDist );
|
||||
|
||||
//! estimates the best-fit affine transformation that maps one 2D point set to another or one image to another.
|
||||
CV_EXPORTS Mat estimateRigidTransform( const Mat& A, const Mat& B,
|
||||
CV_EXPORTS_W Mat estimateRigidTransform( const Mat& A, const Mat& B,
|
||||
bool fullAffine );
|
||||
|
||||
//! computes the best-fit affine transformation that maps one 3D point set to another (RANSAC algorithm is used)
|
||||
CV_EXPORTS int estimateAffine3D(const Mat& from, const Mat& to, CV_OUT Mat& dst,
|
||||
vector<uchar>& outliers,
|
||||
CV_OUT vector<uchar>& outliers,
|
||||
double param1 = 3.0, double param2 = 0.99);
|
||||
|
||||
}
|
||||
|
@ -1627,12 +1627,11 @@ void cv::drawContours( Mat& image, const vector<vector<Point> >& contours,
|
||||
-maxLevel : maxLevel, thickness, lineType, offset );
|
||||
}
|
||||
|
||||
|
||||
void cv::approxPolyDP( const Mat& curve, vector<Point>& approxCurve,
|
||||
double epsilon, bool closed )
|
||||
{
|
||||
CV_Assert(curve.isContinuous() && curve.depth() == CV_32S &&
|
||||
((curve.rows == 1 && curve.channels() == 2) ||
|
||||
curve.cols*curve.channels() == 2));
|
||||
CV_Assert(curve.checkVector(2, CV_32S) >= 0);
|
||||
CvMat _curve = curve;
|
||||
MemStorage storage(cvCreateMemStorage());
|
||||
Seq<Point> seq(cvApproxPoly(&_curve, sizeof(CvContour), storage, CV_POLY_APPROX_DP, epsilon, closed));
|
||||
@ -1642,9 +1641,7 @@ void cv::approxPolyDP( const Mat& curve, vector<Point>& approxCurve,
|
||||
void cv::approxPolyDP( const Mat& curve, vector<Point2f>& approxCurve,
|
||||
double epsilon, bool closed )
|
||||
{
|
||||
CV_Assert(curve.isContinuous() && curve.depth() == CV_32F &&
|
||||
((curve.rows == 1 && curve.channels() == 2) ||
|
||||
curve.cols*curve.channels() == 2));
|
||||
CV_Assert(curve.checkVector(2, CV_32F) >= 0);
|
||||
CvMat _curve = curve;
|
||||
MemStorage storage(cvCreateMemStorage());
|
||||
Seq<Point2f> seq(cvApproxPoly(&_curve, sizeof(CvContour), storage, CV_POLY_APPROX_DP, epsilon, closed));
|
||||
@ -1653,10 +1650,7 @@ void cv::approxPolyDP( const Mat& curve, vector<Point2f>& approxCurve,
|
||||
|
||||
double cv::arcLength( const Mat& curve, bool closed )
|
||||
{
|
||||
CV_Assert(curve.isContinuous() &&
|
||||
(curve.depth() == CV_32S || curve.depth() == CV_32F) &&
|
||||
((curve.rows == 1 && curve.channels() == 2) ||
|
||||
curve.cols*curve.channels() == 2));
|
||||
CV_Assert(curve.checkVector(2) >= 0 && (curve.depth() == CV_32F || curve.depth() == CV_32S));
|
||||
CvMat _curve = curve;
|
||||
return cvArcLength(&_curve, CV_WHOLE_SEQ, closed);
|
||||
}
|
||||
@ -1664,10 +1658,7 @@ double cv::arcLength( const Mat& curve, bool closed )
|
||||
|
||||
cv::Rect cv::boundingRect( const Mat& points )
|
||||
{
|
||||
CV_Assert(points.isContinuous() &&
|
||||
(points.depth() == CV_32S || points.depth() == CV_32F) &&
|
||||
((points.rows == 1 && points.channels() == 2) ||
|
||||
points.cols*points.channels() == 2));
|
||||
CV_Assert(points.checkVector(2) >= 0 && (points.depth() == CV_32F || points.depth() == CV_32S));
|
||||
CvMat _points = points;
|
||||
return cvBoundingRect(&_points, 0);
|
||||
}
|
||||
@ -1675,10 +1666,7 @@ cv::Rect cv::boundingRect( const Mat& points )
|
||||
|
||||
double cv::contourArea( const Mat& contour, bool oriented )
|
||||
{
|
||||
CV_Assert(contour.isContinuous() &&
|
||||
(contour.depth() == CV_32S || contour.depth() == CV_32F) &&
|
||||
((contour.rows == 1 && contour.channels() == 2) ||
|
||||
contour.cols*contour.channels() == 2));
|
||||
CV_Assert(contour.checkVector(2) >= 0 && (contour.depth() == CV_32F || contour.depth() == CV_32S));
|
||||
CvMat _contour = contour;
|
||||
return cvContourArea(&_contour, CV_WHOLE_SEQ, oriented);
|
||||
}
|
||||
@ -1686,10 +1674,7 @@ double cv::contourArea( const Mat& contour, bool oriented )
|
||||
|
||||
cv::RotatedRect cv::minAreaRect( const Mat& points )
|
||||
{
|
||||
CV_Assert(points.isContinuous() &&
|
||||
(points.depth() == CV_32S || points.depth() == CV_32F) &&
|
||||
((points.rows == 1 && points.channels() == 2) ||
|
||||
points.cols*points.channels() == 2));
|
||||
CV_Assert(points.checkVector(2) >= 0 && (points.depth() == CV_32F || points.depth() == CV_32S));
|
||||
CvMat _points = points;
|
||||
return cvMinAreaRect2(&_points, 0);
|
||||
}
|
||||
@ -1698,10 +1683,7 @@ cv::RotatedRect cv::minAreaRect( const Mat& points )
|
||||
void cv::minEnclosingCircle( const Mat& points,
|
||||
Point2f& center, float& radius )
|
||||
{
|
||||
CV_Assert(points.isContinuous() &&
|
||||
(points.depth() == CV_32S || points.depth() == CV_32F) &&
|
||||
((points.rows == 1 && points.channels() == 2) ||
|
||||
points.cols*points.channels() == 2));
|
||||
CV_Assert(points.checkVector(2) >= 0 && (points.depth() == CV_32F || points.depth() == CV_32S));
|
||||
CvMat _points = points;
|
||||
cvMinEnclosingCircle( &_points, (CvPoint2D32f*)¢er, &radius );
|
||||
}
|
||||
@ -1711,13 +1693,9 @@ double cv::matchShapes( const Mat& contour1,
|
||||
const Mat& contour2,
|
||||
int method, double parameter )
|
||||
{
|
||||
CV_Assert(contour1.isContinuous() && contour2.isContinuous() &&
|
||||
(contour1.depth() == CV_32S || contour1.depth() == CV_32F) &&
|
||||
contour1.depth() == contour2.depth() &&
|
||||
((contour1.rows == 1 && contour1.channels() == 2 &&
|
||||
contour2.rows == 1 && contour2.channels() == 2) ||
|
||||
(contour1.cols*contour1.channels() == 2 &&
|
||||
contour2.cols*contour2.channels() == 2)));
|
||||
CV_Assert(contour1.checkVector(2) >= 0 && contour2.checkVector(2) >= 0 &&
|
||||
(contour1.depth() == CV_32F || contour1.depth() == CV_32S) &&
|
||||
contour1.depth() == contour2.depth());
|
||||
|
||||
CvMat c1 = Mat(contour1), c2 = Mat(contour2);
|
||||
return cvMatchShapes(&c1, &c2, method, parameter);
|
||||
@ -1726,10 +1704,7 @@ double cv::matchShapes( const Mat& contour1,
|
||||
|
||||
void cv::convexHull( const Mat& points, vector<int>& hull, bool clockwise )
|
||||
{
|
||||
CV_Assert(points.isContinuous() &&
|
||||
(points.depth() == CV_32S || points.depth() == CV_32F) &&
|
||||
((points.rows == 1 && points.channels() == 2) ||
|
||||
points.cols*points.channels() == 2));
|
||||
CV_Assert(points.checkVector(2) >= 0 && (points.depth() == CV_32F || points.depth() == CV_32S));
|
||||
hull.resize(points.cols*points.rows*points.channels()/2);
|
||||
CvMat _points = Mat(points), _hull=Mat(hull);
|
||||
cvConvexHull2(&_points, &_hull, clockwise ? CV_CLOCKWISE : CV_COUNTER_CLOCKWISE, 0);
|
||||
@ -1740,9 +1715,7 @@ void cv::convexHull( const Mat& points, vector<int>& hull, bool clockwise )
|
||||
void cv::convexHull( const Mat& points,
|
||||
vector<Point>& hull, bool clockwise )
|
||||
{
|
||||
CV_Assert(points.isContinuous() && points.depth() == CV_32S &&
|
||||
((points.rows == 1 && points.channels() == 2) ||
|
||||
points.cols*points.channels() == 2));
|
||||
CV_Assert(points.checkVector(2, CV_32S) >= 0);
|
||||
hull.resize(points.cols*points.rows*points.channels()/2);
|
||||
CvMat _points = Mat(points), _hull=Mat(hull);
|
||||
cvConvexHull2(&_points, &_hull, clockwise ? CV_CLOCKWISE : CV_COUNTER_CLOCKWISE, 1);
|
||||
@ -1753,9 +1726,7 @@ void cv::convexHull( const Mat& points,
|
||||
void cv::convexHull( const Mat& points,
|
||||
vector<Point2f>& hull, bool clockwise )
|
||||
{
|
||||
CV_Assert(points.isContinuous() && points.depth() == CV_32F &&
|
||||
((points.rows == 1 && points.channels() == 2) ||
|
||||
points.cols*points.channels() == 2));
|
||||
CV_Assert(points.checkVector(2, CV_32F) >= 0);
|
||||
hull.resize(points.cols*points.rows*points.channels()/2);
|
||||
CvMat _points = Mat(points), _hull=Mat(hull);
|
||||
cvConvexHull2(&_points, &_hull, clockwise ? CV_CLOCKWISE : CV_COUNTER_CLOCKWISE, 1);
|
||||
@ -1764,20 +1735,16 @@ void cv::convexHull( const Mat& points,
|
||||
|
||||
bool cv::isContourConvex( const Mat& contour )
|
||||
{
|
||||
CV_Assert(contour.isContinuous() &&
|
||||
(contour.depth() == CV_32S || contour.depth() == CV_32F) &&
|
||||
((contour.rows == 1 && contour.channels() == 2) ||
|
||||
contour.cols*contour.channels() == 2));
|
||||
CV_Assert(contour.checkVector(2) >= 0 &&
|
||||
(contour.depth() == CV_32F || contour.depth() == CV_32S));
|
||||
CvMat c = Mat(contour);
|
||||
return cvCheckContourConvexity(&c) > 0;
|
||||
}
|
||||
|
||||
cv::RotatedRect cv::fitEllipse( const Mat& points )
|
||||
{
|
||||
CV_Assert(points.isContinuous() &&
|
||||
(points.depth() == CV_32S || points.depth() == CV_32F) &&
|
||||
((points.rows == 1 && points.channels() == 2) ||
|
||||
points.cols*points.channels() == 2));
|
||||
CV_Assert(points.checkVector(2) >= 0 &&
|
||||
(points.depth() == CV_32F || points.depth() == CV_32S));
|
||||
CvMat _points = points;
|
||||
return cvFitEllipse2(&_points);
|
||||
}
|
||||
@ -1786,10 +1753,8 @@ cv::RotatedRect cv::fitEllipse( const Mat& points )
|
||||
void cv::fitLine( const Mat& points, Vec4f& line, int distType,
|
||||
double param, double reps, double aeps )
|
||||
{
|
||||
CV_Assert(points.isContinuous() &&
|
||||
(points.depth() == CV_32S || points.depth() == CV_32F) &&
|
||||
((points.rows == 1 && points.channels() == 2) ||
|
||||
points.cols*points.channels() == 2));
|
||||
CV_Assert(points.checkVector(2) >= 0 &&
|
||||
(points.depth() == CV_32F || points.depth() == CV_32S));
|
||||
CvMat _points = points;
|
||||
cvFitLine(&_points, distType, param, reps, aeps, &line[0]);
|
||||
}
|
||||
@ -1798,10 +1763,8 @@ void cv::fitLine( const Mat& points, Vec4f& line, int distType,
|
||||
void cv::fitLine( const Mat& points, Vec6f& line, int distType,
|
||||
double param, double reps, double aeps )
|
||||
{
|
||||
CV_Assert(points.isContinuous() &&
|
||||
(points.depth() == CV_32S || points.depth() == CV_32F) &&
|
||||
((points.rows == 1 && points.channels() == 3) ||
|
||||
points.cols*points.channels() == 3));
|
||||
CV_Assert(points.checkVector(3) >= 0 &&
|
||||
(points.depth() == CV_32F || points.depth() == CV_32S));
|
||||
CvMat _points = points;
|
||||
cvFitLine(&_points, distType, param, reps, aeps, &line[0]);
|
||||
}
|
||||
@ -1809,10 +1772,8 @@ void cv::fitLine( const Mat& points, Vec6f& line, int distType,
|
||||
double cv::pointPolygonTest( const Mat& contour,
|
||||
Point2f pt, bool measureDist )
|
||||
{
|
||||
CV_Assert(contour.isContinuous() &&
|
||||
(contour.depth() == CV_32S || contour.depth() == CV_32F) &&
|
||||
((contour.rows == 1 && contour.channels() == 2) ||
|
||||
contour.cols*contour.channels() == 2));
|
||||
CV_Assert(contour.checkVector(2) >= 0 &&
|
||||
(contour.depth() == CV_32F || contour.depth() == CV_32S));
|
||||
CvMat c = Mat(contour);
|
||||
return cvPointPolygonTest( &c, pt, measureDist );
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ CV_INLINE CvParamLattice cvDefaultParamLattice( void )
|
||||
#define CV_TRAIN_ERROR 0
|
||||
#define CV_TEST_ERROR 1
|
||||
|
||||
class CV_EXPORTS CvStatModel
|
||||
class CV_EXPORTS_AS(StatModel) CvStatModel
|
||||
{
|
||||
public:
|
||||
CvStatModel();
|
||||
@ -196,8 +196,8 @@ public:
|
||||
|
||||
virtual void clear();
|
||||
|
||||
virtual void save( const char* filename, const char* name=0 ) const;
|
||||
virtual void load( const char* filename, const char* name=0 );
|
||||
CV_WRAP virtual void save( const char* filename, const char* name=0 ) const;
|
||||
CV_WRAP virtual void load( const char* filename, const char* name=0 );
|
||||
|
||||
virtual void write( CvFileStorage* storage, const char* name ) const;
|
||||
virtual void read( CvFileStorage* storage, CvFileNode* node );
|
||||
@ -241,27 +241,29 @@ struct CV_EXPORTS CvParamGrid
|
||||
double step;
|
||||
};
|
||||
|
||||
class CV_EXPORTS CvNormalBayesClassifier : public CvStatModel
|
||||
class CV_EXPORTS_AS(NormalBayesClassifier) CvNormalBayesClassifier : public CvStatModel
|
||||
{
|
||||
public:
|
||||
CvNormalBayesClassifier();
|
||||
CV_WRAP CvNormalBayesClassifier();
|
||||
virtual ~CvNormalBayesClassifier();
|
||||
|
||||
CV_NO_WRAP CvNormalBayesClassifier( const CvMat* _train_data, const CvMat* _responses,
|
||||
CvNormalBayesClassifier( const CvMat* _train_data, const CvMat* _responses,
|
||||
const CvMat* _var_idx=0, const CvMat* _sample_idx=0 );
|
||||
|
||||
CV_NO_WRAP virtual bool train( const CvMat* _train_data, const CvMat* _responses,
|
||||
virtual bool train( const CvMat* _train_data, const CvMat* _responses,
|
||||
const CvMat* _var_idx = 0, const CvMat* _sample_idx=0, bool update=false );
|
||||
|
||||
CV_NO_WRAP virtual float predict( const CvMat* _samples, CvMat* results=0 ) const;
|
||||
virtual void clear();
|
||||
virtual float predict( const CvMat* _samples, CV_OUT CvMat* results=0 ) const;
|
||||
CV_WRAP virtual void clear();
|
||||
|
||||
CvNormalBayesClassifier( const cv::Mat& _train_data, const cv::Mat& _responses,
|
||||
#ifndef SWIG
|
||||
CV_WRAP CvNormalBayesClassifier( const cv::Mat& _train_data, const cv::Mat& _responses,
|
||||
const cv::Mat& _var_idx=cv::Mat(), const cv::Mat& _sample_idx=cv::Mat() );
|
||||
virtual bool train( const cv::Mat& _train_data, const cv::Mat& _responses,
|
||||
CV_WRAP virtual bool train( const cv::Mat& _train_data, const cv::Mat& _responses,
|
||||
const cv::Mat& _var_idx = cv::Mat(), const cv::Mat& _sample_idx=cv::Mat(),
|
||||
bool update=false );
|
||||
virtual float predict( const cv::Mat& _samples, cv::Mat* results=0 ) const;
|
||||
CV_WRAP virtual float predict( const cv::Mat& _samples, cv::Mat* results=0 ) const;
|
||||
#endif
|
||||
|
||||
virtual void write( CvFileStorage* storage, const char* name ) const;
|
||||
virtual void read( CvFileStorage* storage, CvFileNode* node );
|
||||
@ -285,11 +287,11 @@ protected:
|
||||
\****************************************************************************************/
|
||||
|
||||
// k Nearest Neighbors
|
||||
class CV_EXPORTS CvKNearest : public CvStatModel
|
||||
class CV_EXPORTS_AS(KNearest) CvKNearest : public CvStatModel
|
||||
{
|
||||
public:
|
||||
|
||||
CvKNearest();
|
||||
CV_WRAP CvKNearest();
|
||||
virtual ~CvKNearest();
|
||||
|
||||
CvKNearest( const CvMat* _train_data, const CvMat* _responses,
|
||||
@ -299,18 +301,18 @@ public:
|
||||
const CvMat* _sample_idx=0, bool is_regression=false,
|
||||
int _max_k=32, bool _update_base=false );
|
||||
|
||||
virtual float find_nearest( const CvMat* _samples, int k, CvMat* results=0,
|
||||
const float** neighbors=0, CvMat* neighbor_responses=0, CvMat* dist=0 ) const;
|
||||
virtual float find_nearest( const CvMat* _samples, int k, CV_OUT CvMat* results=0,
|
||||
const float** neighbors=0, CV_OUT CvMat* neighbor_responses=0, CV_OUT CvMat* dist=0 ) const;
|
||||
|
||||
#ifndef SWIG
|
||||
CvKNearest( const cv::Mat& _train_data, const cv::Mat& _responses,
|
||||
CV_WRAP CvKNearest( const cv::Mat& _train_data, const cv::Mat& _responses,
|
||||
const cv::Mat& _sample_idx=cv::Mat(), bool _is_regression=false, int max_k=32 );
|
||||
|
||||
virtual bool train( const cv::Mat& _train_data, const cv::Mat& _responses,
|
||||
CV_WRAP virtual bool train( const cv::Mat& _train_data, const cv::Mat& _responses,
|
||||
const cv::Mat& _sample_idx=cv::Mat(), bool is_regression=false,
|
||||
int _max_k=32, bool _update_base=false );
|
||||
|
||||
virtual float find_nearest( const cv::Mat& _samples, int k, cv::Mat* results=0,
|
||||
CV_WRAP virtual float find_nearest( const cv::Mat& _samples, int k, cv::Mat* results=0,
|
||||
const float** neighbors=0,
|
||||
cv::Mat* neighbor_responses=0,
|
||||
cv::Mat* dist=0 ) const;
|
||||
@ -343,7 +345,7 @@ protected:
|
||||
\****************************************************************************************/
|
||||
|
||||
// SVM training parameters
|
||||
struct CV_EXPORTS CvSVMParams
|
||||
struct CV_EXPORTS_AS_MAP CvSVMParams
|
||||
{
|
||||
CvSVMParams();
|
||||
CvSVMParams( int _svm_type, int _kernel_type,
|
||||
@ -506,7 +508,7 @@ struct CvSVMDecisionFunc
|
||||
|
||||
|
||||
// SVM model
|
||||
class CV_EXPORTS CvSVM : public CvStatModel
|
||||
class CV_EXPORTS_AS(SVM) CvSVM : public CvStatModel
|
||||
{
|
||||
public:
|
||||
// SVM type
|
||||
@ -518,7 +520,7 @@ public:
|
||||
// SVM params type
|
||||
enum { C=0, GAMMA=1, P=2, NU=3, COEF=4, DEGREE=5 };
|
||||
|
||||
CvSVM();
|
||||
CV_WRAP CvSVM();
|
||||
virtual ~CvSVM();
|
||||
|
||||
CvSVM( const CvMat* _train_data, const CvMat* _responses,
|
||||
@ -542,15 +544,15 @@ public:
|
||||
virtual float predict( const CvMat* _sample, bool returnDFVal=false ) const;
|
||||
|
||||
#ifndef SWIG
|
||||
CvSVM( const cv::Mat& _train_data, const cv::Mat& _responses,
|
||||
CV_WRAP CvSVM( const cv::Mat& _train_data, const cv::Mat& _responses,
|
||||
const cv::Mat& _var_idx=cv::Mat(), const cv::Mat& _sample_idx=cv::Mat(),
|
||||
CvSVMParams _params=CvSVMParams() );
|
||||
|
||||
virtual bool train( const cv::Mat& _train_data, const cv::Mat& _responses,
|
||||
CV_WRAP virtual bool train( const cv::Mat& _train_data, const cv::Mat& _responses,
|
||||
const cv::Mat& _var_idx=cv::Mat(), const cv::Mat& _sample_idx=cv::Mat(),
|
||||
CvSVMParams _params=CvSVMParams() );
|
||||
|
||||
virtual bool train_auto( const cv::Mat& _train_data, const cv::Mat& _responses,
|
||||
CV_WRAP virtual bool train_auto( const cv::Mat& _train_data, const cv::Mat& _responses,
|
||||
const cv::Mat& _var_idx, const cv::Mat& _sample_idx, CvSVMParams _params,
|
||||
int k_fold = 10,
|
||||
CvParamGrid C_grid = get_default_grid(CvSVM::C),
|
||||
@ -559,19 +561,19 @@ public:
|
||||
CvParamGrid nu_grid = get_default_grid(CvSVM::NU),
|
||||
CvParamGrid coef_grid = get_default_grid(CvSVM::COEF),
|
||||
CvParamGrid degree_grid = get_default_grid(CvSVM::DEGREE) );
|
||||
virtual float predict( const cv::Mat& _sample, bool returnDFVal=false ) const;
|
||||
CV_WRAP virtual float predict( const cv::Mat& _sample, bool returnDFVal=false ) const;
|
||||
#endif
|
||||
|
||||
virtual int get_support_vector_count() const;
|
||||
CV_WRAP virtual int get_support_vector_count() const;
|
||||
virtual const float* get_support_vector(int i) const;
|
||||
virtual CvSVMParams get_params() const { return params; };
|
||||
virtual void clear();
|
||||
CV_WRAP virtual CvSVMParams get_params() const { return params; };
|
||||
CV_WRAP virtual void clear();
|
||||
|
||||
static CvParamGrid get_default_grid( int param_id );
|
||||
|
||||
virtual void write( CvFileStorage* storage, const char* name ) const;
|
||||
virtual void read( CvFileStorage* storage, CvFileNode* node );
|
||||
int get_var_count() const { return var_idx ? var_idx->cols : var_all; }
|
||||
CV_WRAP int get_var_count() const { return var_idx ? var_idx->cols : var_all; }
|
||||
|
||||
protected:
|
||||
|
||||
@ -607,7 +609,7 @@ protected:
|
||||
* Expectation - Maximization *
|
||||
\****************************************************************************************/
|
||||
|
||||
struct CV_EXPORTS CvEMParams
|
||||
struct CV_EXPORTS_AS_MAP CvEMParams
|
||||
{
|
||||
CvEMParams() : nclusters(10), cov_mat_type(1/*CvEM::COV_MAT_DIAGONAL*/),
|
||||
start_step(0/*CvEM::START_AUTO_STEP*/), probs(0), weights(0), means(0), covs(0)
|
||||
@ -634,7 +636,7 @@ struct CV_EXPORTS CvEMParams
|
||||
};
|
||||
|
||||
|
||||
class CV_EXPORTS CvEM : public CvStatModel
|
||||
class CV_EXPORTS_AS(EM) CvEM : public CvStatModel
|
||||
{
|
||||
public:
|
||||
// Type of covariation matrices
|
||||
@ -643,37 +645,38 @@ public:
|
||||
// The initial step
|
||||
enum { START_E_STEP=1, START_M_STEP=2, START_AUTO_STEP=0 };
|
||||
|
||||
CvEM();
|
||||
CV_WRAP CvEM();
|
||||
CvEM( const CvMat* samples, const CvMat* sample_idx=0,
|
||||
CvEMParams params=CvEMParams(), CvMat* labels=0 );
|
||||
//CvEM (CvEMParams params, CvMat * means, CvMat ** covs, CvMat * weights, CvMat * probs, CvMat * log_weight_div_det, CvMat * inv_eigen_values, CvMat** cov_rotate_mats);
|
||||
//CvEM (CvEMParams params, CvMat * means, CvMat ** covs, CvMat * weights,
|
||||
// CvMat * probs, CvMat * log_weight_div_det, CvMat * inv_eigen_values, CvMat** cov_rotate_mats);
|
||||
|
||||
virtual ~CvEM();
|
||||
|
||||
virtual bool train( const CvMat* samples, const CvMat* sample_idx=0,
|
||||
CvEMParams params=CvEMParams(), CvMat* labels=0 );
|
||||
|
||||
virtual float predict( const CvMat* sample, CvMat* probs ) const;
|
||||
virtual float predict( const CvMat* sample, CV_OUT CvMat* probs ) const;
|
||||
|
||||
#ifndef SWIG
|
||||
CvEM( const cv::Mat& samples, const cv::Mat& sample_idx=cv::Mat(),
|
||||
CV_WRAP CvEM( const cv::Mat& samples, const cv::Mat& sample_idx=cv::Mat(),
|
||||
CvEMParams params=CvEMParams(), cv::Mat* labels=0 );
|
||||
|
||||
virtual bool train( const cv::Mat& samples, const cv::Mat& sample_idx=cv::Mat(),
|
||||
CV_WRAP virtual bool train( const cv::Mat& samples, const cv::Mat& sample_idx=cv::Mat(),
|
||||
CvEMParams params=CvEMParams(), cv::Mat* labels=0 );
|
||||
|
||||
virtual float predict( const cv::Mat& sample, cv::Mat* probs ) const;
|
||||
CV_WRAP virtual float predict( const cv::Mat& sample, cv::Mat* probs ) const;
|
||||
#endif
|
||||
|
||||
virtual void clear();
|
||||
CV_WRAP virtual void clear();
|
||||
|
||||
int get_nclusters() const;
|
||||
const CvMat* get_means() const;
|
||||
const CvMat** get_covs() const;
|
||||
const CvMat* get_weights() const;
|
||||
const CvMat* get_probs() const;
|
||||
CV_WRAP int get_nclusters() const;
|
||||
CV_WRAP const CvMat* get_means() const;
|
||||
CV_WRAP const CvMat** get_covs() const;
|
||||
CV_WRAP const CvMat* get_weights() const;
|
||||
CV_WRAP const CvMat* get_probs() const;
|
||||
|
||||
inline double get_log_likelihood () const { return log_likelihood; };
|
||||
CV_WRAP inline double get_log_likelihood () const { return log_likelihood; };
|
||||
|
||||
// inline const CvMat * get_log_weight_div_det () const { return log_weight_div_det; };
|
||||
// inline const CvMat * get_inv_eigen_values () const { return inv_eigen_values; };
|
||||
@ -769,7 +772,7 @@ struct CvDTreeNode
|
||||
};
|
||||
|
||||
|
||||
struct CV_EXPORTS CvDTreeParams
|
||||
struct CV_EXPORTS_AS_MAP CvDTreeParams
|
||||
{
|
||||
int max_categories;
|
||||
int max_depth;
|
||||
@ -912,10 +915,10 @@ namespace cv
|
||||
struct ForestTreeBestSplitFinder;
|
||||
}
|
||||
|
||||
class CV_EXPORTS CvDTree : public CvStatModel
|
||||
class CV_EXPORTS_AS(DTree) CvDTree : public CvStatModel
|
||||
{
|
||||
public:
|
||||
CvDTree();
|
||||
CV_WRAP CvDTree();
|
||||
virtual ~CvDTree();
|
||||
|
||||
virtual bool train( const CvMat* _train_data, int _tflag,
|
||||
@ -934,18 +937,18 @@ public:
|
||||
bool preprocessed_input=false ) const;
|
||||
|
||||
#ifndef SWIG
|
||||
virtual bool train( const cv::Mat& _train_data, int _tflag,
|
||||
CV_WRAP virtual bool train( const cv::Mat& _train_data, int _tflag,
|
||||
const cv::Mat& _responses, const cv::Mat& _var_idx=cv::Mat(),
|
||||
const cv::Mat& _sample_idx=cv::Mat(), const cv::Mat& _var_type=cv::Mat(),
|
||||
const cv::Mat& _missing_mask=cv::Mat(),
|
||||
CvDTreeParams params=CvDTreeParams() );
|
||||
|
||||
virtual CvDTreeNode* predict( const cv::Mat& _sample, const cv::Mat& _missing_data_mask=cv::Mat(),
|
||||
CV_WRAP virtual CvDTreeNode* predict( const cv::Mat& _sample, const cv::Mat& _missing_data_mask=cv::Mat(),
|
||||
bool preprocessed_input=false ) const;
|
||||
#endif
|
||||
|
||||
virtual const CvMat* get_var_importance();
|
||||
virtual void clear();
|
||||
CV_WRAP virtual const CvMat* get_var_importance();
|
||||
CV_WRAP virtual void clear();
|
||||
|
||||
virtual void read( CvFileStorage* fs, CvFileNode* node );
|
||||
virtual void write( CvFileStorage* fs, const char* name ) const;
|
||||
@ -1044,7 +1047,7 @@ protected:
|
||||
};
|
||||
|
||||
|
||||
struct CV_EXPORTS CvRTParams : public CvDTreeParams
|
||||
struct CV_EXPORTS_AS_MAP CvRTParams : public CvDTreeParams
|
||||
{
|
||||
//Parameters for the forest
|
||||
bool calc_var_importance; // true <=> RF processes variable importance
|
||||
@ -1074,10 +1077,10 @@ struct CV_EXPORTS CvRTParams : public CvDTreeParams
|
||||
};
|
||||
|
||||
|
||||
class CV_EXPORTS CvRTrees : public CvStatModel
|
||||
class CV_EXPORTS_AS(RTrees) CvRTrees : public CvStatModel
|
||||
{
|
||||
public:
|
||||
CvRTrees();
|
||||
CV_WRAP CvRTrees();
|
||||
virtual ~CvRTrees();
|
||||
virtual bool train( const CvMat* _train_data, int _tflag,
|
||||
const CvMat* _responses, const CvMat* _var_idx=0,
|
||||
@ -1090,18 +1093,18 @@ public:
|
||||
virtual float predict_prob( const CvMat* sample, const CvMat* missing = 0 ) const;
|
||||
|
||||
#ifndef SWIG
|
||||
virtual bool train( const cv::Mat& _train_data, int _tflag,
|
||||
CV_WRAP virtual bool train( const cv::Mat& _train_data, int _tflag,
|
||||
const cv::Mat& _responses, const cv::Mat& _var_idx=cv::Mat(),
|
||||
const cv::Mat& _sample_idx=cv::Mat(), const cv::Mat& _var_type=cv::Mat(),
|
||||
const cv::Mat& _missing_mask=cv::Mat(),
|
||||
CvRTParams params=CvRTParams() );
|
||||
virtual float predict( const cv::Mat& sample, const cv::Mat& missing = cv::Mat() ) const;
|
||||
virtual float predict_prob( const cv::Mat& sample, const cv::Mat& missing = cv::Mat() ) const;
|
||||
CV_WRAP virtual float predict( const cv::Mat& sample, const cv::Mat& missing = cv::Mat() ) const;
|
||||
CV_WRAP virtual float predict_prob( const cv::Mat& sample, const cv::Mat& missing = cv::Mat() ) const;
|
||||
#endif
|
||||
|
||||
virtual void clear();
|
||||
CV_WRAP virtual void clear();
|
||||
|
||||
virtual const CvMat* get_var_importance();
|
||||
CV_WRAP virtual const CvMat* get_var_importance();
|
||||
virtual float get_proximity( const CvMat* sample1, const CvMat* sample2,
|
||||
const CvMat* missing1 = 0, const CvMat* missing2 = 0 ) const;
|
||||
|
||||
@ -1173,10 +1176,10 @@ protected:
|
||||
virtual void split_node_data( CvDTreeNode* n );
|
||||
};
|
||||
|
||||
class CV_EXPORTS CvERTrees : public CvRTrees
|
||||
class CV_EXPORTS_AS(ERTrees) CvERTrees : public CvRTrees
|
||||
{
|
||||
public:
|
||||
CvERTrees();
|
||||
CV_WRAP CvERTrees();
|
||||
virtual ~CvERTrees();
|
||||
virtual bool train( const CvMat* _train_data, int _tflag,
|
||||
const CvMat* _responses, const CvMat* _var_idx=0,
|
||||
@ -1184,7 +1187,7 @@ public:
|
||||
const CvMat* _missing_mask=0,
|
||||
CvRTParams params=CvRTParams());
|
||||
#ifndef SWIG
|
||||
virtual bool train( const cv::Mat& _train_data, int _tflag,
|
||||
CV_WRAP virtual bool train( const cv::Mat& _train_data, int _tflag,
|
||||
const cv::Mat& _responses, const cv::Mat& _var_idx=cv::Mat(),
|
||||
const cv::Mat& _sample_idx=cv::Mat(), const cv::Mat& _var_type=cv::Mat(),
|
||||
const cv::Mat& _missing_mask=cv::Mat(),
|
||||
@ -1200,7 +1203,7 @@ protected:
|
||||
* Boosted tree classifier *
|
||||
\****************************************************************************************/
|
||||
|
||||
struct CV_EXPORTS CvBoostParams : public CvDTreeParams
|
||||
struct CV_EXPORTS_AS_MAP CvBoostParams : public CvDTreeParams
|
||||
{
|
||||
int boost_type;
|
||||
int weak_count;
|
||||
@ -1262,7 +1265,7 @@ protected:
|
||||
};
|
||||
|
||||
|
||||
class CV_EXPORTS CvBoost : public CvStatModel
|
||||
class CV_EXPORTS_AS(Boost) CvBoost : public CvStatModel
|
||||
{
|
||||
public:
|
||||
// Boosting type
|
||||
@ -1271,7 +1274,7 @@ public:
|
||||
// Splitting criteria
|
||||
enum { DEFAULT=0, GINI=1, MISCLASS=3, SQERR=4 };
|
||||
|
||||
CvBoost();
|
||||
CV_WRAP CvBoost();
|
||||
virtual ~CvBoost();
|
||||
|
||||
CvBoost( const CvMat* _train_data, int _tflag,
|
||||
@ -1296,29 +1299,29 @@ public:
|
||||
bool raw_mode=false, bool return_sum=false ) const;
|
||||
|
||||
#ifndef SWIG
|
||||
CvBoost( const cv::Mat& _train_data, int _tflag,
|
||||
CV_WRAP CvBoost( const cv::Mat& _train_data, int _tflag,
|
||||
const cv::Mat& _responses, const cv::Mat& _var_idx=cv::Mat(),
|
||||
const cv::Mat& _sample_idx=cv::Mat(), const cv::Mat& _var_type=cv::Mat(),
|
||||
const cv::Mat& _missing_mask=cv::Mat(),
|
||||
CvBoostParams params=CvBoostParams() );
|
||||
|
||||
virtual bool train( const cv::Mat& _train_data, int _tflag,
|
||||
CV_WRAP virtual bool train( const cv::Mat& _train_data, int _tflag,
|
||||
const cv::Mat& _responses, const cv::Mat& _var_idx=cv::Mat(),
|
||||
const cv::Mat& _sample_idx=cv::Mat(), const cv::Mat& _var_type=cv::Mat(),
|
||||
const cv::Mat& _missing_mask=cv::Mat(),
|
||||
CvBoostParams params=CvBoostParams(),
|
||||
bool update=false );
|
||||
|
||||
virtual float predict( const cv::Mat& _sample, const cv::Mat& _missing=cv::Mat(),
|
||||
CV_WRAP virtual float predict( const cv::Mat& _sample, const cv::Mat& _missing=cv::Mat(),
|
||||
cv::Mat* weak_responses=0, CvSlice slice=CV_WHOLE_SEQ,
|
||||
bool raw_mode=false, bool return_sum=false ) const;
|
||||
#endif
|
||||
|
||||
virtual float calc_error( CvMLData* _data, int type , std::vector<float> *resp = 0 ); // type in {CV_TRAIN_ERROR, CV_TEST_ERROR}
|
||||
|
||||
virtual void prune( CvSlice slice );
|
||||
CV_WRAP virtual void prune( CvSlice slice );
|
||||
|
||||
virtual void clear();
|
||||
CV_WRAP virtual void clear();
|
||||
|
||||
virtual void write( CvFileStorage* storage, const char* name ) const;
|
||||
virtual void read( CvFileStorage* storage, CvFileNode* node );
|
||||
@ -1379,7 +1382,7 @@ protected:
|
||||
// Each tree prediction is multiplied on shrinkage value.
|
||||
|
||||
|
||||
struct CV_EXPORTS CvGBTreesParams : public CvDTreeParams
|
||||
struct CV_EXPORTS_AS_MAP CvGBTreesParams : public CvDTreeParams
|
||||
{
|
||||
int weak_count;
|
||||
int loss_function_type;
|
||||
@ -1439,7 +1442,7 @@ struct CV_EXPORTS CvGBTreesParams : public CvDTreeParams
|
||||
|
||||
|
||||
|
||||
class CV_EXPORTS CvGBTrees : public CvStatModel
|
||||
class CV_EXPORTS_AS(GBTrees) CvGBTrees : public CvStatModel
|
||||
{
|
||||
public:
|
||||
|
||||
@ -1480,7 +1483,7 @@ public:
|
||||
// OUTPUT
|
||||
// RESULT
|
||||
*/
|
||||
CvGBTrees();
|
||||
CV_WRAP CvGBTrees();
|
||||
|
||||
|
||||
/*
|
||||
@ -1520,7 +1523,7 @@ public:
|
||||
// OUTPUT
|
||||
// RESULT
|
||||
*/
|
||||
CvGBTrees( const CvMat* _train_data, int _tflag,
|
||||
CV_WRAP CvGBTrees( const CvMat* _train_data, int _tflag,
|
||||
const CvMat* _responses, const CvMat* _var_idx=0,
|
||||
const CvMat* _sample_idx=0, const CvMat* _var_type=0,
|
||||
const CvMat* _missing_mask=0,
|
||||
@ -1572,7 +1575,7 @@ public:
|
||||
// RESULT
|
||||
// Error state.
|
||||
*/
|
||||
virtual bool train( const CvMat* _train_data, int _tflag,
|
||||
CV_WRAP virtual bool train( const CvMat* _train_data, int _tflag,
|
||||
const CvMat* _responses, const CvMat* _var_idx=0,
|
||||
const CvMat* _sample_idx=0, const CvMat* _var_type=0,
|
||||
const CvMat* _missing_mask=0,
|
||||
@ -1628,7 +1631,7 @@ public:
|
||||
// RESULT
|
||||
// Predicted value.
|
||||
*/
|
||||
virtual float predict( const CvMat* _sample, const CvMat* _missing=0,
|
||||
CV_WRAP virtual float predict( const CvMat* _sample, const CvMat* _missing=0,
|
||||
CvMat* weak_responses=0, CvSlice slice = CV_WHOLE_SEQ,
|
||||
int k=-1 ) const;
|
||||
|
||||
@ -1646,7 +1649,7 @@ public:
|
||||
// delta = 0.0
|
||||
// RESULT
|
||||
*/
|
||||
virtual void clear();
|
||||
CV_WRAP virtual void clear();
|
||||
|
||||
/*
|
||||
// Compute error on the train/test set.
|
||||
@ -1890,7 +1893,7 @@ protected:
|
||||
|
||||
/////////////////////////////////// Multi-Layer Perceptrons //////////////////////////////
|
||||
|
||||
struct CV_EXPORTS CvANN_MLP_TrainParams
|
||||
struct CV_EXPORTS_AS_MAP CvANN_MLP_TrainParams
|
||||
{
|
||||
CvANN_MLP_TrainParams();
|
||||
CvANN_MLP_TrainParams( CvTermCriteria term_crit, int train_method,
|
||||
@ -1910,10 +1913,10 @@ struct CV_EXPORTS CvANN_MLP_TrainParams
|
||||
};
|
||||
|
||||
|
||||
class CV_EXPORTS CvANN_MLP : public CvStatModel
|
||||
class CV_EXPORTS_AS(ANN_MLP) CvANN_MLP : public CvStatModel
|
||||
{
|
||||
public:
|
||||
CvANN_MLP();
|
||||
CV_WRAP CvANN_MLP();
|
||||
CvANN_MLP( const CvMat* _layer_sizes,
|
||||
int _activ_func=SIGMOID_SYM,
|
||||
double _f_param1=0, double _f_param2=0 );
|
||||
@ -1928,26 +1931,26 @@ public:
|
||||
const CvMat* _sample_weights, const CvMat* _sample_idx=0,
|
||||
CvANN_MLP_TrainParams _params = CvANN_MLP_TrainParams(),
|
||||
int flags=0 );
|
||||
virtual float predict( const CvMat* _inputs, CvMat* _outputs ) const;
|
||||
virtual float predict( const CvMat* _inputs, CV_OUT CvMat* _outputs ) const;
|
||||
|
||||
#ifndef SWIG
|
||||
CvANN_MLP( const cv::Mat& _layer_sizes,
|
||||
CV_WRAP CvANN_MLP( const cv::Mat& _layer_sizes,
|
||||
int _activ_func=SIGMOID_SYM,
|
||||
double _f_param1=0, double _f_param2=0 );
|
||||
|
||||
virtual void create( const cv::Mat& _layer_sizes,
|
||||
CV_WRAP virtual void create( const cv::Mat& _layer_sizes,
|
||||
int _activ_func=SIGMOID_SYM,
|
||||
double _f_param1=0, double _f_param2=0 );
|
||||
|
||||
virtual int train( const cv::Mat& _inputs, const cv::Mat& _outputs,
|
||||
CV_WRAP virtual int train( const cv::Mat& _inputs, const cv::Mat& _outputs,
|
||||
const cv::Mat& _sample_weights, const cv::Mat& _sample_idx=cv::Mat(),
|
||||
CvANN_MLP_TrainParams _params = CvANN_MLP_TrainParams(),
|
||||
int flags=0 );
|
||||
|
||||
virtual float predict( const cv::Mat& _inputs, cv::Mat& _outputs ) const;
|
||||
CV_WRAP virtual float predict( const cv::Mat& _inputs, cv::Mat& _outputs ) const;
|
||||
#endif
|
||||
|
||||
virtual void clear();
|
||||
CV_WRAP virtual void clear();
|
||||
|
||||
// possible activation functions
|
||||
enum { IDENTITY = 0, SIGMOID_SYM = 1, GAUSSIAN = 2 };
|
||||
@ -2003,293 +2006,6 @@ protected:
|
||||
CvRNG rng;
|
||||
};
|
||||
|
||||
#if 0
|
||||
/****************************************************************************************\
|
||||
* Convolutional Neural Network *
|
||||
\****************************************************************************************/
|
||||
typedef struct CvCNNLayer CvCNNLayer;
|
||||
typedef struct CvCNNetwork CvCNNetwork;
|
||||
|
||||
#define CV_CNN_LEARN_RATE_DECREASE_HYPERBOLICALLY 1
|
||||
#define CV_CNN_LEARN_RATE_DECREASE_SQRT_INV 2
|
||||
#define CV_CNN_LEARN_RATE_DECREASE_LOG_INV 3
|
||||
|
||||
#define CV_CNN_GRAD_ESTIM_RANDOM 0
|
||||
#define CV_CNN_GRAD_ESTIM_BY_WORST_IMG 1
|
||||
|
||||
#define ICV_CNN_LAYER 0x55550000
|
||||
#define ICV_CNN_CONVOLUTION_LAYER 0x00001111
|
||||
#define ICV_CNN_SUBSAMPLING_LAYER 0x00002222
|
||||
#define ICV_CNN_FULLCONNECT_LAYER 0x00003333
|
||||
|
||||
#define ICV_IS_CNN_LAYER( layer ) \
|
||||
( ((layer) != NULL) && ((((CvCNNLayer*)(layer))->flags & CV_MAGIC_MASK)\
|
||||
== ICV_CNN_LAYER ))
|
||||
|
||||
#define ICV_IS_CNN_CONVOLUTION_LAYER( layer ) \
|
||||
( (ICV_IS_CNN_LAYER( layer )) && (((CvCNNLayer*) (layer))->flags \
|
||||
& ~CV_MAGIC_MASK) == ICV_CNN_CONVOLUTION_LAYER )
|
||||
|
||||
#define ICV_IS_CNN_SUBSAMPLING_LAYER( layer ) \
|
||||
( (ICV_IS_CNN_LAYER( layer )) && (((CvCNNLayer*) (layer))->flags \
|
||||
& ~CV_MAGIC_MASK) == ICV_CNN_SUBSAMPLING_LAYER )
|
||||
|
||||
#define ICV_IS_CNN_FULLCONNECT_LAYER( layer ) \
|
||||
( (ICV_IS_CNN_LAYER( layer )) && (((CvCNNLayer*) (layer))->flags \
|
||||
& ~CV_MAGIC_MASK) == ICV_CNN_FULLCONNECT_LAYER )
|
||||
|
||||
typedef void (CV_CDECL *CvCNNLayerForward)
|
||||
( CvCNNLayer* layer, const CvMat* input, CvMat* output );
|
||||
|
||||
typedef void (CV_CDECL *CvCNNLayerBackward)
|
||||
( CvCNNLayer* layer, int t, const CvMat* X, const CvMat* dE_dY, CvMat* dE_dX );
|
||||
|
||||
typedef void (CV_CDECL *CvCNNLayerRelease)
|
||||
(CvCNNLayer** layer);
|
||||
|
||||
typedef void (CV_CDECL *CvCNNetworkAddLayer)
|
||||
(CvCNNetwork* network, CvCNNLayer* layer);
|
||||
|
||||
typedef void (CV_CDECL *CvCNNetworkRelease)
|
||||
(CvCNNetwork** network);
|
||||
|
||||
#define CV_CNN_LAYER_FIELDS() \
|
||||
/* Indicator of the layer's type */ \
|
||||
int flags; \
|
||||
\
|
||||
/* Number of input images */ \
|
||||
int n_input_planes; \
|
||||
/* Height of each input image */ \
|
||||
int input_height; \
|
||||
/* Width of each input image */ \
|
||||
int input_width; \
|
||||
\
|
||||
/* Number of output images */ \
|
||||
int n_output_planes; \
|
||||
/* Height of each output image */ \
|
||||
int output_height; \
|
||||
/* Width of each output image */ \
|
||||
int output_width; \
|
||||
\
|
||||
/* Learning rate at the first iteration */ \
|
||||
float init_learn_rate; \
|
||||
/* Dynamics of learning rate decreasing */ \
|
||||
int learn_rate_decrease_type; \
|
||||
/* Trainable weights of the layer (including bias) */ \
|
||||
/* i-th row is a set of weights of the i-th output plane */ \
|
||||
CvMat* weights; \
|
||||
\
|
||||
CvCNNLayerForward forward; \
|
||||
CvCNNLayerBackward backward; \
|
||||
CvCNNLayerRelease release; \
|
||||
/* Pointers to the previous and next layers in the network */ \
|
||||
CvCNNLayer* prev_layer; \
|
||||
CvCNNLayer* next_layer
|
||||
|
||||
typedef struct CvCNNLayer
|
||||
{
|
||||
CV_CNN_LAYER_FIELDS();
|
||||
}CvCNNLayer;
|
||||
|
||||
typedef struct CvCNNConvolutionLayer
|
||||
{
|
||||
CV_CNN_LAYER_FIELDS();
|
||||
// Kernel size (height and width) for convolution.
|
||||
int K;
|
||||
// connections matrix, (i,j)-th element is 1 iff there is a connection between
|
||||
// i-th plane of the current layer and j-th plane of the previous layer;
|
||||
// (i,j)-th element is equal to 0 otherwise
|
||||
CvMat *connect_mask;
|
||||
// value of the learning rate for updating weights at the first iteration
|
||||
}CvCNNConvolutionLayer;
|
||||
|
||||
typedef struct CvCNNSubSamplingLayer
|
||||
{
|
||||
CV_CNN_LAYER_FIELDS();
|
||||
// ratio between the heights (or widths - ratios are supposed to be equal)
|
||||
// of the input and output planes
|
||||
int sub_samp_scale;
|
||||
// amplitude of sigmoid activation function
|
||||
float a;
|
||||
// scale parameter of sigmoid activation function
|
||||
float s;
|
||||
// exp2ssumWX = exp(2<s>*(bias+w*(x1+...+x4))), where x1,...x4 are some elements of X
|
||||
// - is the vector used in computing of the activation function in backward
|
||||
CvMat* exp2ssumWX;
|
||||
// (x1+x2+x3+x4), where x1,...x4 are some elements of X
|
||||
// - is the vector used in computing of the activation function in backward
|
||||
CvMat* sumX;
|
||||
}CvCNNSubSamplingLayer;
|
||||
|
||||
// Structure of the last layer.
|
||||
typedef struct CvCNNFullConnectLayer
|
||||
{
|
||||
CV_CNN_LAYER_FIELDS();
|
||||
// amplitude of sigmoid activation function
|
||||
float a;
|
||||
// scale parameter of sigmoid activation function
|
||||
float s;
|
||||
// exp2ssumWX = exp(2*<s>*(W*X)) - is the vector used in computing of the
|
||||
// activation function and it's derivative by the formulae
|
||||
// activ.func. = <a>(exp(2<s>WX)-1)/(exp(2<s>WX)+1) == <a> - 2<a>/(<exp2ssumWX> + 1)
|
||||
// (activ.func.)' = 4<a><s>exp(2<s>WX)/(exp(2<s>WX)+1)^2
|
||||
CvMat* exp2ssumWX;
|
||||
}CvCNNFullConnectLayer;
|
||||
|
||||
typedef struct CvCNNetwork
|
||||
{
|
||||
int n_layers;
|
||||
CvCNNLayer* layers;
|
||||
CvCNNetworkAddLayer add_layer;
|
||||
CvCNNetworkRelease release;
|
||||
}CvCNNetwork;
|
||||
|
||||
typedef struct CvCNNStatModel
|
||||
{
|
||||
CV_STAT_MODEL_FIELDS();
|
||||
CvCNNetwork* network;
|
||||
// etalons are allocated as rows, the i-th etalon has label cls_labeles[i]
|
||||
CvMat* etalons;
|
||||
// classes labels
|
||||
CvMat* cls_labels;
|
||||
}CvCNNStatModel;
|
||||
|
||||
typedef struct CvCNNStatModelParams
|
||||
{
|
||||
CV_STAT_MODEL_PARAM_FIELDS();
|
||||
// network must be created by the functions cvCreateCNNetwork and <add_layer>
|
||||
CvCNNetwork* network;
|
||||
CvMat* etalons;
|
||||
// termination criteria
|
||||
int max_iter;
|
||||
int start_iter;
|
||||
int grad_estim_type;
|
||||
}CvCNNStatModelParams;
|
||||
|
||||
CVAPI(CvCNNLayer*) cvCreateCNNConvolutionLayer(
|
||||
int n_input_planes, int input_height, int input_width,
|
||||
int n_output_planes, int K,
|
||||
float init_learn_rate, int learn_rate_decrease_type,
|
||||
CvMat* connect_mask CV_DEFAULT(0), CvMat* weights CV_DEFAULT(0) );
|
||||
|
||||
CVAPI(CvCNNLayer*) cvCreateCNNSubSamplingLayer(
|
||||
int n_input_planes, int input_height, int input_width,
|
||||
int sub_samp_scale, float a, float s,
|
||||
float init_learn_rate, int learn_rate_decrease_type, CvMat* weights CV_DEFAULT(0) );
|
||||
|
||||
CVAPI(CvCNNLayer*) cvCreateCNNFullConnectLayer(
|
||||
int n_inputs, int n_outputs, float a, float s,
|
||||
float init_learn_rate, int learning_type, CvMat* weights CV_DEFAULT(0) );
|
||||
|
||||
CVAPI(CvCNNetwork*) cvCreateCNNetwork( CvCNNLayer* first_layer );
|
||||
|
||||
CVAPI(CvStatModel*) cvTrainCNNClassifier(
|
||||
const CvMat* train_data, int tflag,
|
||||
const CvMat* responses,
|
||||
const CvStatModelParams* params,
|
||||
const CvMat* CV_DEFAULT(0),
|
||||
const CvMat* sample_idx CV_DEFAULT(0),
|
||||
const CvMat* CV_DEFAULT(0), const CvMat* CV_DEFAULT(0) );
|
||||
|
||||
/****************************************************************************************\
|
||||
* Estimate classifiers algorithms *
|
||||
\****************************************************************************************/
|
||||
typedef const CvMat* (CV_CDECL *CvStatModelEstimateGetMat)
|
||||
( const CvStatModel* estimateModel );
|
||||
|
||||
typedef int (CV_CDECL *CvStatModelEstimateNextStep)
|
||||
( CvStatModel* estimateModel );
|
||||
|
||||
typedef void (CV_CDECL *CvStatModelEstimateCheckClassifier)
|
||||
( CvStatModel* estimateModel,
|
||||
const CvStatModel* model,
|
||||
const CvMat* features,
|
||||
int sample_t_flag,
|
||||
const CvMat* responses );
|
||||
|
||||
typedef void (CV_CDECL *CvStatModelEstimateCheckClassifierEasy)
|
||||
( CvStatModel* estimateModel,
|
||||
const CvStatModel* model );
|
||||
|
||||
typedef float (CV_CDECL *CvStatModelEstimateGetCurrentResult)
|
||||
( const CvStatModel* estimateModel,
|
||||
float* correlation );
|
||||
|
||||
typedef void (CV_CDECL *CvStatModelEstimateReset)
|
||||
( CvStatModel* estimateModel );
|
||||
|
||||
//-------------------------------- Cross-validation --------------------------------------
|
||||
#define CV_CROSS_VALIDATION_ESTIMATE_CLASSIFIER_PARAM_FIELDS() \
|
||||
CV_STAT_MODEL_PARAM_FIELDS(); \
|
||||
int k_fold; \
|
||||
int is_regression; \
|
||||
CvRNG* rng
|
||||
|
||||
typedef struct CvCrossValidationParams
|
||||
{
|
||||
CV_CROSS_VALIDATION_ESTIMATE_CLASSIFIER_PARAM_FIELDS();
|
||||
} CvCrossValidationParams;
|
||||
|
||||
#define CV_CROSS_VALIDATION_ESTIMATE_CLASSIFIER_FIELDS() \
|
||||
CvStatModelEstimateGetMat getTrainIdxMat; \
|
||||
CvStatModelEstimateGetMat getCheckIdxMat; \
|
||||
CvStatModelEstimateNextStep nextStep; \
|
||||
CvStatModelEstimateCheckClassifier check; \
|
||||
CvStatModelEstimateGetCurrentResult getResult; \
|
||||
CvStatModelEstimateReset reset; \
|
||||
int is_regression; \
|
||||
int folds_all; \
|
||||
int samples_all; \
|
||||
int* sampleIdxAll; \
|
||||
int* folds; \
|
||||
int max_fold_size; \
|
||||
int current_fold; \
|
||||
int is_checked; \
|
||||
CvMat* sampleIdxTrain; \
|
||||
CvMat* sampleIdxEval; \
|
||||
CvMat* predict_results; \
|
||||
int correct_results; \
|
||||
int all_results; \
|
||||
double sq_error; \
|
||||
double sum_correct; \
|
||||
double sum_predict; \
|
||||
double sum_cc; \
|
||||
double sum_pp; \
|
||||
double sum_cp
|
||||
|
||||
typedef struct CvCrossValidationModel
|
||||
{
|
||||
CV_STAT_MODEL_FIELDS();
|
||||
CV_CROSS_VALIDATION_ESTIMATE_CLASSIFIER_FIELDS();
|
||||
} CvCrossValidationModel;
|
||||
|
||||
CVAPI(CvStatModel*)
|
||||
cvCreateCrossValidationEstimateModel
|
||||
( int samples_all,
|
||||
const CvStatModelParams* estimateParams CV_DEFAULT(0),
|
||||
const CvMat* sampleIdx CV_DEFAULT(0) );
|
||||
|
||||
CVAPI(float)
|
||||
cvCrossValidation( const CvMat* trueData,
|
||||
int tflag,
|
||||
const CvMat* trueClasses,
|
||||
CvStatModel* (*createClassifier)( const CvMat*,
|
||||
int,
|
||||
const CvMat*,
|
||||
const CvStatModelParams*,
|
||||
const CvMat*,
|
||||
const CvMat*,
|
||||
const CvMat*,
|
||||
const CvMat* ),
|
||||
const CvStatModelParams* estimateParams CV_DEFAULT(0),
|
||||
const CvStatModelParams* trainParams CV_DEFAULT(0),
|
||||
const CvMat* compIdx CV_DEFAULT(0),
|
||||
const CvMat* sampleIdx CV_DEFAULT(0),
|
||||
CvStatModel** pCrValModel CV_DEFAULT(0),
|
||||
const CvMat* typeMask CV_DEFAULT(0),
|
||||
const CvMat* missedMeasurementMask CV_DEFAULT(0) );
|
||||
#endif
|
||||
|
||||
/****************************************************************************************\
|
||||
* Auxilary functions declarations *
|
||||
\****************************************************************************************/
|
||||
@ -2461,7 +2177,7 @@ typedef CvBoostTree BoostTree;
|
||||
typedef CvBoost Boost;
|
||||
typedef CvANN_MLP_TrainParams ANN_MLP_TrainParams;
|
||||
typedef CvANN_MLP NeuralNet_MLP;
|
||||
typedef CvGBTreesParams GradientBoostingTreesParams;
|
||||
typedef CvGBTreesParams GradientBoostingTreeParams;
|
||||
typedef CvGBTrees GradientBoostingTrees;
|
||||
|
||||
}
|
||||
|
@ -1894,10 +1894,6 @@ float CvBoost::calc_error( CvMLData* _data, int type, std::vector<float> *resp )
|
||||
|
||||
void CvBoost::write_params( CvFileStorage* fs ) const
|
||||
{
|
||||
CV_FUNCNAME( "CvBoost::write_params" );
|
||||
|
||||
__BEGIN__;
|
||||
|
||||
const char* boost_type_str =
|
||||
params.boost_type == DISCRETE ? "DiscreteAdaboost" :
|
||||
params.boost_type == REAL ? "RealAdaboost" :
|
||||
@ -1924,8 +1920,6 @@ void CvBoost::write_params( CvFileStorage* fs ) const
|
||||
cvWriteReal( fs, "weight_trimming_rate", params.weight_trim_rate );
|
||||
|
||||
data->write_params( fs );
|
||||
|
||||
__END__;
|
||||
}
|
||||
|
||||
|
||||
|
@ -270,8 +270,8 @@ namespace cv
|
||||
|
||||
///////////////////////////// Object Detection ////////////////////////////
|
||||
|
||||
CV_EXPORTS void groupRectangles(vector<Rect>& rectList, int groupThreshold, double eps=0.2);
|
||||
CV_EXPORTS void groupRectangles(vector<Rect>& rectList, CV_OUT vector<int>& weights, int groupThreshold, double eps=0.2);
|
||||
CV_EXPORTS_W void groupRectangles(vector<Rect>& rectList, int groupThreshold, double eps=0.2);
|
||||
CV_EXPORTS_W void groupRectangles(vector<Rect>& rectList, CV_OUT vector<int>& weights, int groupThreshold, double eps=0.2);
|
||||
|
||||
class CV_EXPORTS FeatureEvaluator
|
||||
{
|
||||
@ -293,7 +293,7 @@ public:
|
||||
|
||||
template<> CV_EXPORTS void Ptr<CvHaarClassifierCascade>::delete_obj();
|
||||
|
||||
class CV_EXPORTS CascadeClassifier
|
||||
class CV_EXPORTS_W CascadeClassifier
|
||||
{
|
||||
public:
|
||||
struct CV_EXPORTS DTreeNode
|
||||
@ -320,14 +320,14 @@ public:
|
||||
enum { DO_CANNY_PRUNING = 1, SCALE_IMAGE = 2,
|
||||
FIND_BIGGEST_OBJECT = 4, DO_ROUGH_SEARCH = 8 };
|
||||
|
||||
CascadeClassifier();
|
||||
CascadeClassifier(const string& filename);
|
||||
CV_WRAP CascadeClassifier();
|
||||
CV_WRAP CascadeClassifier(const string& filename);
|
||||
~CascadeClassifier();
|
||||
|
||||
bool empty() const;
|
||||
bool load(const string& filename);
|
||||
CV_WRAP bool empty() const;
|
||||
CV_WRAP bool load(const string& filename);
|
||||
bool read(const FileNode& node);
|
||||
void detectMultiScale( const Mat& image,
|
||||
CV_WRAP void detectMultiScale( const Mat& image,
|
||||
CV_OUT vector<Rect>& objects,
|
||||
double scaleFactor=1.1,
|
||||
int minNeighbors=3, int flags=0,
|
||||
@ -356,17 +356,17 @@ public:
|
||||
|
||||
//////////////// HOG (Histogram-of-Oriented-Gradients) Descriptor and Object Detector //////////////
|
||||
|
||||
struct CV_EXPORTS HOGDescriptor
|
||||
struct CV_EXPORTS_W HOGDescriptor
|
||||
{
|
||||
public:
|
||||
enum { L2Hys=0 };
|
||||
|
||||
HOGDescriptor() : winSize(64,128), blockSize(16,16), blockStride(8,8),
|
||||
CV_WRAP HOGDescriptor() : winSize(64,128), blockSize(16,16), blockStride(8,8),
|
||||
cellSize(8,8), nbins(9), derivAperture(1), winSigma(-1),
|
||||
histogramNormType(L2Hys), L2HysThreshold(0.2), gammaCorrection(true)
|
||||
{}
|
||||
|
||||
HOGDescriptor(Size _winSize, Size _blockSize, Size _blockStride,
|
||||
CV_WRAP HOGDescriptor(Size _winSize, Size _blockSize, Size _blockStride,
|
||||
Size _cellSize, int _nbins, int _derivAperture=1, double _winSigma=-1,
|
||||
int _histogramNormType=L2Hys, double _L2HysThreshold=0.2, bool _gammaCorrection=false)
|
||||
: winSize(_winSize), blockSize(_blockSize), blockStride(_blockStride), cellSize(_cellSize),
|
||||
@ -375,7 +375,7 @@ public:
|
||||
gammaCorrection(_gammaCorrection)
|
||||
{}
|
||||
|
||||
HOGDescriptor(const String& filename)
|
||||
CV_WRAP HOGDescriptor(const String& filename)
|
||||
{
|
||||
load(filename);
|
||||
}
|
||||
@ -387,47 +387,47 @@ public:
|
||||
|
||||
virtual ~HOGDescriptor() {}
|
||||
|
||||
size_t getDescriptorSize() const;
|
||||
bool checkDetectorSize() const;
|
||||
double getWinSigma() const;
|
||||
CV_WRAP size_t getDescriptorSize() const;
|
||||
CV_WRAP bool checkDetectorSize() const;
|
||||
CV_WRAP double getWinSigma() const;
|
||||
|
||||
virtual void setSVMDetector(const vector<float>& _svmdetector);
|
||||
CV_WRAP virtual void setSVMDetector(const vector<float>& _svmdetector);
|
||||
|
||||
virtual bool read(FileNode& fn);
|
||||
virtual void write(FileStorage& fs, const String& objname) const;
|
||||
|
||||
virtual bool load(const String& filename, const String& objname=String());
|
||||
virtual void save(const String& filename, const String& objname=String()) const;
|
||||
CV_WRAP virtual bool load(const String& filename, const String& objname=String());
|
||||
CV_WRAP virtual void save(const String& filename, const String& objname=String()) const;
|
||||
virtual void copyTo(HOGDescriptor& c) const;
|
||||
|
||||
virtual void compute(const Mat& img,
|
||||
CV_WRAP virtual void compute(const Mat& img,
|
||||
CV_OUT vector<float>& descriptors,
|
||||
Size winStride=Size(), Size padding=Size(),
|
||||
const vector<Point>& locations=vector<Point>()) const;
|
||||
virtual void detect(const Mat& img, CV_OUT vector<Point>& foundLocations,
|
||||
CV_WRAP virtual void detect(const Mat& img, CV_OUT vector<Point>& foundLocations,
|
||||
double hitThreshold=0, Size winStride=Size(),
|
||||
Size padding=Size(),
|
||||
const vector<Point>& searchLocations=vector<Point>()) const;
|
||||
virtual void detectMultiScale(const Mat& img, CV_OUT vector<Rect>& foundLocations,
|
||||
CV_WRAP virtual void detectMultiScale(const Mat& img, CV_OUT vector<Rect>& foundLocations,
|
||||
double hitThreshold=0, Size winStride=Size(),
|
||||
Size padding=Size(), double scale=1.05,
|
||||
int groupThreshold=2) const;
|
||||
virtual void computeGradient(const Mat& img, CV_OUT Mat& grad, CV_OUT Mat& angleOfs,
|
||||
CV_WRAP virtual void computeGradient(const Mat& img, CV_OUT Mat& grad, CV_OUT Mat& angleOfs,
|
||||
Size paddingTL=Size(), Size paddingBR=Size()) const;
|
||||
|
||||
static vector<float> getDefaultPeopleDetector();
|
||||
|
||||
Size winSize;
|
||||
Size blockSize;
|
||||
Size blockStride;
|
||||
Size cellSize;
|
||||
int nbins;
|
||||
int derivAperture;
|
||||
double winSigma;
|
||||
int histogramNormType;
|
||||
double L2HysThreshold;
|
||||
bool gammaCorrection;
|
||||
vector<float> svmDetector;
|
||||
CV_PROP Size winSize;
|
||||
CV_PROP Size blockSize;
|
||||
CV_PROP Size blockStride;
|
||||
CV_PROP Size cellSize;
|
||||
CV_PROP int nbins;
|
||||
CV_PROP int derivAperture;
|
||||
CV_PROP double winSigma;
|
||||
CV_PROP int histogramNormType;
|
||||
CV_PROP double L2HysThreshold;
|
||||
CV_PROP bool gammaCorrection;
|
||||
CV_PROP vector<float> svmDetector;
|
||||
};
|
||||
|
||||
|
||||
|
@ -353,13 +353,13 @@ namespace cv
|
||||
The class is only used to define the common interface for
|
||||
the whole family of background/foreground segmentation algorithms.
|
||||
*/
|
||||
class CV_EXPORTS BackgroundSubtractor
|
||||
class CV_EXPORTS_W BackgroundSubtractor
|
||||
{
|
||||
public:
|
||||
//! the virtual destructor
|
||||
virtual ~BackgroundSubtractor();
|
||||
//! the update operator that takes the next video frame and returns the current foreground mask as 8-bit binary image.
|
||||
virtual CV_WRAP_AS(apply) void operator()(const Mat& image, CV_OUT Mat& fgmask,
|
||||
CV_WRAP_AS(apply) virtual void operator()(const Mat& image, CV_OUT Mat& fgmask,
|
||||
double learningRate=0);
|
||||
};
|
||||
|
||||
@ -374,13 +374,13 @@ public:
|
||||
http://personal.ee.surrey.ac.uk/Personal/R.Bowden/publications/avbs01/avbs01.pdf
|
||||
|
||||
*/
|
||||
class CV_EXPORTS BackgroundSubtractorMOG : public BackgroundSubtractor
|
||||
class CV_EXPORTS_W BackgroundSubtractorMOG : public BackgroundSubtractor
|
||||
{
|
||||
public:
|
||||
//! the default constructor
|
||||
BackgroundSubtractorMOG();
|
||||
CV_WRAP BackgroundSubtractorMOG();
|
||||
//! the full constructor that takes the length of the history, the number of gaussian mixtures, the background ratio parameter and the noise strength
|
||||
BackgroundSubtractorMOG(int history, int nmixtures, double backgroundRatio, double noiseSigma=0);
|
||||
CV_WRAP BackgroundSubtractorMOG(int history, int nmixtures, double backgroundRatio, double noiseSigma=0);
|
||||
//! the destructor
|
||||
virtual ~BackgroundSubtractorMOG();
|
||||
//! the update operator
|
||||
|
@ -244,28 +244,28 @@ namespace cv
|
||||
{
|
||||
|
||||
//! updates motion history image using the current silhouette
|
||||
CV_EXPORTS void updateMotionHistory( const Mat& silhouette, Mat& mhi,
|
||||
CV_EXPORTS_W void updateMotionHistory( const Mat& silhouette, Mat& mhi,
|
||||
double timestamp, double duration );
|
||||
|
||||
//! computes the motion gradient orientation image from the motion history image
|
||||
CV_EXPORTS void calcMotionGradient( const Mat& mhi, CV_OUT Mat& mask,
|
||||
CV_OUT Mat& orientation,
|
||||
double delta1, double delta2,
|
||||
int apertureSize=3 );
|
||||
CV_EXPORTS_W void calcMotionGradient( const Mat& mhi, CV_OUT Mat& mask,
|
||||
CV_OUT Mat& orientation,
|
||||
double delta1, double delta2,
|
||||
int apertureSize=3 );
|
||||
|
||||
//! computes the global orientation of the selected motion history image part
|
||||
CV_EXPORTS double calcGlobalOrientation( const Mat& orientation, const Mat& mask,
|
||||
const Mat& mhi, double timestamp,
|
||||
double duration );
|
||||
CV_EXPORTS_W double calcGlobalOrientation( const Mat& orientation, const Mat& mask,
|
||||
const Mat& mhi, double timestamp,
|
||||
double duration );
|
||||
// TODO: need good API for cvSegmentMotion
|
||||
|
||||
//! updates the object tracking window using CAMSHIFT algorithm
|
||||
CV_EXPORTS RotatedRect CamShift( const Mat& probImage, CV_OUT Rect& window,
|
||||
TermCriteria criteria );
|
||||
CV_EXPORTS_W RotatedRect CamShift( const Mat& probImage, CV_OUT Rect& window,
|
||||
TermCriteria criteria );
|
||||
|
||||
//! updates the object tracking window using meanshift algorithm
|
||||
CV_EXPORTS int meanShift( const Mat& probImage, CV_OUT Rect& window,
|
||||
TermCriteria criteria );
|
||||
CV_EXPORTS_W int meanShift( const Mat& probImage, CV_OUT Rect& window,
|
||||
TermCriteria criteria );
|
||||
|
||||
/*!
|
||||
Kalman filter.
|
||||
@ -274,20 +274,20 @@ CV_EXPORTS int meanShift( const Mat& probImage, CV_OUT Rect& window,
|
||||
However, you can modify KalmanFilter::transitionMatrix, KalmanFilter::controlMatrix and
|
||||
KalmanFilter::measurementMatrix to get the extended Kalman filter functionality.
|
||||
*/
|
||||
class CV_EXPORTS KalmanFilter
|
||||
class CV_EXPORTS_W KalmanFilter
|
||||
{
|
||||
public:
|
||||
//! the default constructor
|
||||
KalmanFilter();
|
||||
CV_WRAP KalmanFilter();
|
||||
//! the full constructor taking the dimensionality of the state, of the measurement and of the control vector
|
||||
KalmanFilter(int dynamParams, int measureParams, int controlParams=0);
|
||||
CV_WRAP KalmanFilter(int dynamParams, int measureParams, int controlParams=0);
|
||||
//! re-initializes Kalman filter. The previous content is destroyed.
|
||||
void init(int dynamParams, int measureParams, int controlParams=0);
|
||||
|
||||
//! computes predicted state
|
||||
const Mat& predict(const Mat& control=Mat());
|
||||
CV_WRAP const Mat& predict(const Mat& control=Mat());
|
||||
//! updates the predicted state from the measurement
|
||||
const Mat& correct(const Mat& measurement);
|
||||
CV_WRAP const Mat& correct(const Mat& measurement);
|
||||
|
||||
Mat statePre; //!< predicted state (x'(k)): x(k)=A*x(k-1)+B*u(k)
|
||||
Mat statePost; //!< corrected state (x(k)): x(k)=x'(k)+K(k)*(z(k)-H*x'(k))
|
||||
@ -312,7 +312,7 @@ public:
|
||||
enum { OPTFLOW_USE_INITIAL_FLOW=4, OPTFLOW_FARNEBACK_GAUSSIAN=256 };
|
||||
|
||||
//! computes sparse optical flow using multi-scale Lucas-Kanade algorithm
|
||||
CV_EXPORTS void calcOpticalFlowPyrLK( const Mat& prevImg, const Mat& nextImg,
|
||||
CV_EXPORTS_W void calcOpticalFlowPyrLK( const Mat& prevImg, const Mat& nextImg,
|
||||
const vector<Point2f>& prevPts, CV_OUT vector<Point2f>& nextPts,
|
||||
CV_OUT vector<uchar>& status, CV_OUT vector<float>& err,
|
||||
Size winSize=Size(15,15), int maxLevel=3,
|
||||
@ -323,7 +323,7 @@ CV_EXPORTS void calcOpticalFlowPyrLK( const Mat& prevImg, const Mat& nextImg,
|
||||
int flags=0 );
|
||||
|
||||
//! computes dense optical flow using Farneback algorithm
|
||||
CV_EXPORTS void calcOpticalFlowFarneback( const Mat& prev, const Mat& next,
|
||||
CV_EXPORTS_W void calcOpticalFlowFarneback( const Mat& prev, const Mat& next,
|
||||
CV_OUT Mat& flow, double pyr_scale, int levels, int winsize,
|
||||
int iterations, int poly_n, double poly_sigma, int flags );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user