Merge branch '2.4'

This commit is contained in:
Andrey Kamaev
2013-02-01 14:58:52 +04:00
44 changed files with 475 additions and 159 deletions

View File

@@ -3360,7 +3360,11 @@ void cv::projectPoints( InputArray _opoints,
CvMat c_cameraMatrix = cameraMatrix;
CvMat c_rvec = rvec, c_tvec = tvec;
double dc0buf[5]={0};
Mat dc0(5,1,CV_64F,dc0buf);
Mat distCoeffs = _distCoeffs.getMat();
if( distCoeffs.empty() )
distCoeffs = dc0;
CvMat c_distCoeffs = distCoeffs;
int ndistCoeffs = distCoeffs.rows + distCoeffs.cols - 1;
@@ -3375,8 +3379,7 @@ void cv::projectPoints( InputArray _opoints,
pdpddist = &(dpddist = jacobian.colRange(10, 10+ndistCoeffs));
}
cvProjectPoints2( &c_objectPoints, &c_rvec, &c_tvec, &c_cameraMatrix,
(distCoeffs.empty())? 0: &c_distCoeffs,
cvProjectPoints2( &c_objectPoints, &c_rvec, &c_tvec, &c_cameraMatrix, &c_distCoeffs,
&c_imagePoints, pdpdrot, pdpdt, pdpdf, pdpdc, pdpddist, aspectRatio );
}

View File

@@ -472,23 +472,24 @@ int cv::estimateAffine3D(InputArray _from, InputArray _to,
double param1, double param2)
{
Mat from = _from.getMat(), to = _to.getMat();
int count = from.checkVector(3, CV_32F);
int count = from.checkVector(3);
CV_Assert( count >= 0 && to.checkVector(3, CV_32F) == count );
CV_Assert( count >= 0 && to.checkVector(3) == count );
_out.create(3, 4, CV_64F);
Mat out = _out.getMat();
_inliers.create(count, 1, CV_8U, -1, true);
Mat inliers = _inliers.getMat();
Mat inliers(1, count, CV_8U);
inliers = Scalar::all(1);
Mat dFrom, dTo;
from.convertTo(dFrom, CV_64F);
to.convertTo(dTo, CV_64F);
dFrom = dFrom.reshape(3, 1);
dTo = dTo.reshape(3, 1);
CvMat F3x4 = out;
CvMat mask = inliers;
CvMat mask = inliers;
CvMat m1 = dFrom;
CvMat m2 = dTo;
@@ -496,5 +497,9 @@ int cv::estimateAffine3D(InputArray _from, InputArray _to,
param1 = param1 <= 0 ? 3 : param1;
param2 = (param2 < epsilon) ? 0.99 : (param2 > 1 - epsilon) ? 0.99 : param2;
return Affine3DEstimator().runRANSAC(&m1, &m2, &F3x4, &mask, param1, param2 );
int ok = Affine3DEstimator().runRANSAC(&m1, &m2, &F3x4, &mask, param1, param2 );
if( _inliers.needed() )
transpose(inliers, _inliers);
return ok;
}