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:
Vadim Pisarevsky
2010-10-27 18:26:39 +00:00
parent 4c29ffecc0
commit 83f6085773
18 changed files with 685 additions and 987 deletions

View File

@@ -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,

View File

@@ -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);