@@ -290,8 +290,8 @@ void CV_CameraCalibrationTest::run( int start_from )
290290 cv::String filepath;
291291 cv::String filename;
292292
293- CvSize imageSize;
294- CvSize etalonSize;
293+ Size imageSize;
294+ Size etalonSize;
295295 int numImages;
296296
297297 CvPoint2D64f* imagePoints;
@@ -531,7 +531,7 @@ void CV_CameraCalibrationTest::run( int start_from )
531531 /* Now we can calibrate camera */
532532 calibrate ( numImages,
533533 numbers,
534- imageSize,
534+ cvSize ( imageSize) ,
535535 imagePoints,
536536 objectPoints,
537537 distortion,
@@ -1009,9 +1009,9 @@ void CV_CalibrationMatrixValuesTest_C::calibMatrixValues( const Mat& _cameraMatr
10091009 double & fovx, double & fovy, double & focalLength,
10101010 Point2d& principalPoint, double & aspectRatio )
10111011{
1012- CvMat cameraMatrix = _cameraMatrix;
1013- CvPoint2D64f pp;
1014- cvCalibrationMatrixValues ( &cameraMatrix, imageSize, apertureWidth, apertureHeight,
1012+ CvMat cameraMatrix = cvMat ( _cameraMatrix) ;
1013+ CvPoint2D64f pp = { 0 , 0 } ;
1014+ cvCalibrationMatrixValues ( &cameraMatrix, cvSize ( imageSize) , apertureWidth, apertureHeight,
10151015 &fovx, &fovy, &focalLength, &pp, &aspectRatio );
10161016 principalPoint.x = pp.x ;
10171017 principalPoint.y = pp.y ;
@@ -1305,9 +1305,9 @@ void CV_ProjectPointsTest_C::project( const Mat& opoints, const Mat& rvec, const
13051305 dpdc.create (npoints*2 , 2 , CV_64F);
13061306 dpddist.create (npoints*2 , distCoeffs.rows + distCoeffs.cols - 1 , CV_64F);
13071307 Mat imagePoints (ipoints);
1308- CvMat _objectPoints = opoints, _imagePoints = imagePoints;
1309- CvMat _rvec = rvec, _tvec = tvec, _cameraMatrix = cameraMatrix, _distCoeffs = distCoeffs;
1310- CvMat _dpdrot = dpdrot, _dpdt = dpdt, _dpdf = dpdf, _dpdc = dpdc, _dpddist = dpddist;
1308+ CvMat _objectPoints = cvMat ( opoints) , _imagePoints = cvMat ( imagePoints) ;
1309+ CvMat _rvec = cvMat ( rvec) , _tvec = cvMat ( tvec) , _cameraMatrix = cvMat ( cameraMatrix) , _distCoeffs = cvMat ( distCoeffs) ;
1310+ CvMat _dpdrot = cvMat ( dpdrot) , _dpdt = cvMat ( dpdt) , _dpdf = cvMat ( dpdf) , _dpdc = cvMat ( dpdc) , _dpddist = cvMat ( dpddist) ;
13111311
13121312 cvProjectPoints2 ( &_objectPoints, &_rvec, &_tvec, &_cameraMatrix, &_distCoeffs,
13131313 &_imagePoints, &_dpdrot, &_dpdt, &_dpdf, &_dpdc, &_dpddist, aspectRatio );
@@ -1925,14 +1925,14 @@ double CV_StereoCalibrationTest_C::calibrateStereoCamera( const vector<vector<Po
19251925 std::copy (imagePoints1[i].begin (), imagePoints1[i].end (), imgPtData + j);
19261926 std::copy (imagePoints2[i].begin (), imagePoints2[i].end (), imgPtData2 + j);
19271927 }
1928- CvMat _objPt = objPt, _imgPt = imgPt, _imgPt2 = imgPt2, _npoints = npoints;
1929- CvMat _cameraMatrix1 = cameraMatrix1, _distCoeffs1 = distCoeffs1;
1930- CvMat _cameraMatrix2 = cameraMatrix2, _distCoeffs2 = distCoeffs2;
1931- CvMat matR = R , matT = T , matE = E , matF = F ;
1928+ CvMat _objPt = cvMat ( objPt) , _imgPt = cvMat ( imgPt) , _imgPt2 = cvMat ( imgPt2) , _npoints = cvMat ( npoints) ;
1929+ CvMat _cameraMatrix1 = cvMat ( cameraMatrix1) , _distCoeffs1 = cvMat ( distCoeffs1) ;
1930+ CvMat _cameraMatrix2 = cvMat ( cameraMatrix2) , _distCoeffs2 = cvMat ( distCoeffs2) ;
1931+ CvMat matR = cvMat (R) , matT = cvMat (T) , matE = cvMat (E) , matF = cvMat (F) ;
19321932
19331933 return cvStereoCalibrate (&_objPt, &_imgPt, &_imgPt2, &_npoints, &_cameraMatrix1,
1934- &_distCoeffs1, &_cameraMatrix2, &_distCoeffs2, imageSize,
1935- &matR, &matT, &matE, &matF, flags, criteria );
1934+ &_distCoeffs1, &_cameraMatrix2, &_distCoeffs2, cvSize ( imageSize) ,
1935+ &matR, &matT, &matE, &matF, flags, cvTermCriteria ( criteria) );
19361936}
19371937
19381938void CV_StereoCalibrationTest_C::rectify ( const Mat& cameraMatrix1, const Mat& distCoeffs1,
@@ -1948,43 +1948,43 @@ void CV_StereoCalibrationTest_C::rectify( const Mat& cameraMatrix1, const Mat& d
19481948 P1.create (3 , 4 , rtype);
19491949 P2.create (3 , 4 , rtype);
19501950 Q.create (4 , 4 , rtype);
1951- CvMat _cameraMatrix1 = cameraMatrix1, _distCoeffs1 = distCoeffs1;
1952- CvMat _cameraMatrix2 = cameraMatrix2, _distCoeffs2 = distCoeffs2;
1953- CvMat matR = R , matT = T , _R1 = R1 , _R2 = R2 , _P1 = P1 , _P2 = P2 , matQ = Q ;
1951+ CvMat _cameraMatrix1 = cvMat ( cameraMatrix1) , _distCoeffs1 = cvMat ( distCoeffs1) ;
1952+ CvMat _cameraMatrix2 = cvMat ( cameraMatrix2) , _distCoeffs2 = cvMat ( distCoeffs2) ;
1953+ CvMat matR = cvMat (R) , matT = cvMat (T) , _R1 = cvMat (R1) , _R2 = cvMat (R2) , _P1 = cvMat (P1) , _P2 = cvMat (P2) , matQ = cvMat (Q) ;
19541954 cvStereoRectify ( &_cameraMatrix1, &_cameraMatrix2, &_distCoeffs1, &_distCoeffs2,
1955- imageSize, &matR, &matT, &_R1, &_R2, &_P1, &_P2, &matQ, flags,
1956- alpha, newImageSize, (CvRect*)validPixROI1, (CvRect*)validPixROI2);
1955+ cvSize ( imageSize) , &matR, &matT, &_R1, &_R2, &_P1, &_P2, &matQ, flags,
1956+ alpha, cvSize ( newImageSize) , (CvRect*)validPixROI1, (CvRect*)validPixROI2);
19571957}
19581958
19591959bool CV_StereoCalibrationTest_C::rectifyUncalibrated ( const Mat& points1,
19601960 const Mat& points2, const Mat& F, Size imgSize, Mat& H1, Mat& H2, double threshold )
19611961{
19621962 H1.create (3 , 3 , CV_64F);
19631963 H2.create (3 , 3 , CV_64F);
1964- CvMat _pt1 = points1, _pt2 = points2, matF, *pF=0 , _H1 = H1 , _H2 = H2 ;
1964+ CvMat _pt1 = cvMat ( points1) , _pt2 = cvMat ( points2) , matF, *pF=0 , _H1 = cvMat (H1) , _H2 = cvMat (H2) ;
19651965 if ( F.size () == Size (3 , 3 ) )
1966- pF = &(matF = F );
1967- return cvStereoRectifyUncalibrated (&_pt1, &_pt2, pF, imgSize, &_H1, &_H2, threshold) > 0 ;
1966+ pF = &(matF = cvMat (F) );
1967+ return cvStereoRectifyUncalibrated (&_pt1, &_pt2, pF, cvSize ( imgSize) , &_H1, &_H2, threshold) > 0 ;
19681968}
19691969
19701970void CV_StereoCalibrationTest_C::triangulate ( const Mat& P1, const Mat& P2,
19711971 const Mat &points1, const Mat &points2,
19721972 Mat &points4D )
19731973{
1974- CvMat _P1 = P1 , _P2 = P2 , _points1 = points1, _points2 = points2;
1974+ CvMat _P1 = cvMat (P1) , _P2 = cvMat (P2) , _points1 = cvMat ( points1) , _points2 = cvMat ( points2) ;
19751975 points4D.create (4 , points1.cols , points1.type ());
1976- CvMat _points4D = points4D;
1976+ CvMat _points4D = cvMat ( points4D) ;
19771977 cvTriangulatePoints (&_P1, &_P2, &_points1, &_points2, &_points4D);
19781978}
19791979
19801980void CV_StereoCalibrationTest_C::correct ( const Mat& F,
19811981 const Mat &points1, const Mat &points2,
19821982 Mat &newPoints1, Mat &newPoints2 )
19831983{
1984- CvMat _F = F , _points1 = points1, _points2 = points2;
1984+ CvMat _F = cvMat (F) , _points1 = cvMat ( points1) , _points2 = cvMat ( points2) ;
19851985 newPoints1.create (1 , points1.cols , points1.type ());
19861986 newPoints2.create (1 , points2.cols , points2.type ());
1987- CvMat _newPoints1 = newPoints1, _newPoints2 = newPoints2;
1987+ CvMat _newPoints1 = cvMat ( newPoints1) , _newPoints2 = cvMat ( newPoints2) ;
19881988 cvCorrectMatches (&_F, &_points1, &_points2, &_newPoints1, &_newPoints2);
19891989}
19901990
0 commit comments