don't use constructors for C API structures

pull/11630/head
Alexander Alekhin 6 years ago
parent ad146e5a6b
commit 8a3c394d6a
  1. 2
      apps/traincascade/boost.cpp
  2. 8
      apps/traincascade/old_ml_boost.cpp
  3. 8
      apps/traincascade/old_ml_tree.cpp
  4. 200
      modules/calib3d/src/calibration.cpp
  5. 4
      modules/calib3d/src/compat_stereo.cpp
  6. 6
      modules/calib3d/src/solvepnp.cpp
  7. 14
      modules/calib3d/src/triangulate.cpp
  8. 54
      modules/calib3d/test/test_cameracalibration.cpp
  9. 136
      modules/calib3d/test/test_cameracalibration_badarg.cpp
  10. 8
      modules/calib3d/test/test_chesscorners_badarg.cpp
  11. 8
      modules/calib3d/test/test_chesscorners_timing.cpp
  12. 2
      modules/calib3d/test/test_cornerssubpix.cpp
  13. 18
      modules/calib3d/test/test_fundam.cpp
  14. 2
      modules/calib3d/test/test_reproject_image_to_3d.cpp
  15. 34
      modules/calib3d/test/test_undistort.cpp
  16. 2
      modules/core/include/opencv2/core/core_c.h
  17. 2
      modules/core/include/opencv2/core/types_c.h
  18. 24
      modules/core/src/array.cpp
  19. 2
      modules/core/src/matrix_c.cpp
  20. 4
      modules/core/src/persistence_cpp.cpp
  21. 8
      modules/core/src/persistence_types.cpp
  22. 4
      modules/core/src/stat_c.cpp
  23. 6
      modules/core/test/test_io.cpp
  24. 34
      modules/core/test/test_mat.cpp
  25. 38
      modules/core/test/test_math.cpp
  26. 2
      modules/core/test/test_operations.cpp
  27. 2
      modules/highgui/src/window.cpp
  28. 4
      modules/highgui/src/window_gtk.cpp
  29. 4
      modules/imgcodecs/src/loadsave.cpp
  30. 2
      modules/imgcodecs/src/utils.cpp
  31. 7
      modules/imgproc/include/opencv2/imgproc/imgproc_c.h
  32. 2
      modules/imgproc/src/approx.cpp
  33. 59
      modules/imgproc/src/contours.cpp
  34. 25
      modules/imgproc/src/drawing.cpp
  35. 8
      modules/imgproc/src/emd.cpp
  36. 2
      modules/imgproc/src/featureselect.cpp
  37. 7
      modules/imgproc/src/floodfill.cpp
  38. 4
      modules/imgproc/src/geometry.cpp
  39. 4
      modules/imgproc/src/histogram.cpp
  40. 2
      modules/imgproc/src/moments.cpp
  41. 2
      modules/imgproc/src/pyramids.cpp
  42. 2
      modules/imgproc/src/rotcalipers.cpp
  43. 24
      modules/imgproc/src/shapedescr.cpp
  44. 8
      modules/imgproc/src/undistort.cpp
  45. 10
      modules/imgproc/test/test_approxpoly.cpp
  46. 18
      modules/imgproc/test/test_contours.cpp
  47. 66
      modules/imgproc/test/test_convhull.cpp
  48. 2
      modules/imgproc/test/test_distancetransform.cpp
  49. 12
      modules/imgproc/test/test_drawing.cpp
  50. 14
      modules/imgproc/test/test_filter.cpp
  51. 20
      modules/imgproc/test/test_floodfill.cpp
  52. 6
      modules/imgproc/test/test_histograms.cpp
  53. 36
      modules/imgproc/test/test_imgwarp.cpp
  54. 13
      modules/imgproc/test/test_moments.cpp
  55. 10
      modules/imgproc/test/test_templmatch.cpp
  56. 4
      modules/imgproc/test/test_watershed.cpp
  57. 4
      modules/objdetect/src/cascadedetect.cpp
  58. 50
      modules/objdetect/src/haar.cpp
  59. 2
      modules/objdetect/test/test_cascadeandhog.cpp
  60. 18
      modules/photo/src/inpaint.cpp
  61. 8
      modules/stitching/src/motion_estimators.cpp
  62. 4
      modules/ts/src/ts_arrtest.cpp
  63. 6
      modules/video/src/compat_video.cpp
  64. 2
      modules/video/test/test_camshift.cpp
  65. 4
      modules/video/test/test_optflowpyrlk.cpp
  66. 2
      modules/videoio/src/cap.cpp
  67. 2
      modules/videoio/src/cap_openni.cpp
  68. 2
      modules/videoio/src/cap_openni2.cpp
  69. 4
      modules/videoio/src/cap_v4l.cpp
  70. 8
      modules/videoio/src/videoio_registry.cpp

@ -543,7 +543,7 @@ void CvCascadeBoostTrainData::setData( const CvFeatureEvaluator* _featureEvaluat
featureEvaluator = _featureEvaluator;
max_c_count = MAX( 2, featureEvaluator->getMaxCatCount() );
_resp = featureEvaluator->getCls();
_resp = cvMat(featureEvaluator->getCls());
responses = &_resp;
// TODO: check responses: elements must be 0 or 1

@ -2122,12 +2122,12 @@ CvBoost::train( const Mat& _train_data, int _tflag,
const Mat& _missing_mask,
CvBoostParams _params, bool _update )
{
train_data_hdr = _train_data;
train_data_hdr = cvMat(_train_data);
train_data_mat = _train_data;
responses_hdr = _responses;
responses_hdr = cvMat(_responses);
responses_mat = _responses;
CvMat vidx = _var_idx, sidx = _sample_idx, vtype = _var_type, mmask = _missing_mask;
CvMat vidx = cvMat(_var_idx), sidx = cvMat(_sample_idx), vtype = cvMat(_var_type), mmask = cvMat(_missing_mask);
return train(&train_data_hdr, _tflag, &responses_hdr, vidx.data.ptr ? &vidx : 0,
sidx.data.ptr ? &sidx : 0, vtype.data.ptr ? &vtype : 0,
@ -2138,7 +2138,7 @@ float
CvBoost::predict( const Mat& _sample, const Mat& _missing,
const Range& slice, bool raw_mode, bool return_sum ) const
{
CvMat sample = _sample, mmask = _missing;
CvMat sample = cvMat(_sample), mmask = cvMat(_missing);
/*if( weak_responses )
{
int weak_count = cvSliceLength( slice, weak );

@ -1592,12 +1592,12 @@ bool CvDTree::train( const Mat& _train_data, int _tflag,
const Mat& _sample_idx, const Mat& _var_type,
const Mat& _missing_mask, CvDTreeParams _params )
{
train_data_hdr = _train_data;
train_data_hdr = cvMat(_train_data);
train_data_mat = _train_data;
responses_hdr = _responses;
responses_hdr = cvMat(_responses);
responses_mat = _responses;
CvMat vidx=_var_idx, sidx=_sample_idx, vtype=_var_type, mmask=_missing_mask;
CvMat vidx=cvMat(_var_idx), sidx=cvMat(_sample_idx), vtype=cvMat(_var_type), mmask=cvMat(_missing_mask);
return train(&train_data_hdr, _tflag, &responses_hdr, vidx.data.ptr ? &vidx : 0, sidx.data.ptr ? &sidx : 0,
vtype.data.ptr ? &vtype : 0, mmask.data.ptr ? &mmask : 0, _params);
@ -3734,7 +3734,7 @@ CvDTreeNode* CvDTree::predict( const CvMat* _sample,
CvDTreeNode* CvDTree::predict( const Mat& _sample, const Mat& _missing, bool preprocessed_input ) const
{
CvMat sample = _sample, mmask = _missing;
CvMat sample = cvMat(_sample), mmask = cvMat(_missing);
return predict(&sample, mmask.data.ptr ? &mmask : 0, preprocessed_input);
}

@ -977,7 +977,7 @@ CV_IMPL void cvFindExtrinsicCameraParams2( const CvMat* objectPoints,
int i, count;
double a[9], ar[9]={1,0,0,0,1,0,0,0,1}, R[9];
double MM[9], U[9], V[9], W[3];
CvScalar Mc;
cv::Scalar Mc;
double param[6];
CvMat matA = cvMat( 3, 3, CV_64F, a );
CvMat _Ar = cvMat( 3, 3, CV_64F, ar );
@ -1478,7 +1478,7 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints,
CV_Error( CV_StsOutOfRange,
"The specified aspect ratio (= cameraMatrix[0][0] / cameraMatrix[1][1]) is incorrect" );
}
CvMat _matM(matM), m(_m);
CvMat _matM = cvMat(matM), m = cvMat(_m);
cvInitIntrinsicParams2D( &_matM, &m, npoints, imageSize, &matA, aspectRatio );
}
@ -1550,8 +1550,8 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints,
cvGetRows( solver.param, &_ri, NINTRINSIC + i*6, NINTRINSIC + i*6 + 3 );
cvGetRows( solver.param, &_ti, NINTRINSIC + i*6 + 3, NINTRINSIC + i*6 + 6 );
CvMat _Mi(matM.colRange(pos, pos + ni));
CvMat _mi(_m.colRange(pos, pos + ni));
CvMat _Mi = cvMat(matM.colRange(pos, pos + ni));
CvMat _mi = cvMat(_m.colRange(pos, pos + ni));
cvFindExtrinsicCameraParams2( &_Mi, &_mi, &matA, &_k, &_ri, &_ti );
}
@ -1590,17 +1590,17 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints,
cvGetRows( solver.param, &_ri, NINTRINSIC + i*6, NINTRINSIC + i*6 + 3 );
cvGetRows( solver.param, &_ti, NINTRINSIC + i*6 + 3, NINTRINSIC + i*6 + 6 );
CvMat _Mi(matM.colRange(pos, pos + ni));
CvMat _mi(_m.colRange(pos, pos + ni));
CvMat _me(allErrors.colRange(pos, pos + ni));
CvMat _Mi = cvMat(matM.colRange(pos, pos + ni));
CvMat _mi = cvMat(_m.colRange(pos, pos + ni));
CvMat _me = cvMat(allErrors.colRange(pos, pos + ni));
_Je.resize(ni*2); _Ji.resize(ni*2); _err.resize(ni*2);
CvMat _dpdr(_Je.colRange(0, 3));
CvMat _dpdt(_Je.colRange(3, 6));
CvMat _dpdf(_Ji.colRange(0, 2));
CvMat _dpdc(_Ji.colRange(2, 4));
CvMat _dpdk(_Ji.colRange(4, NINTRINSIC));
CvMat _mp(_err.reshape(2, 1));
CvMat _dpdr = cvMat(_Je.colRange(0, 3));
CvMat _dpdt = cvMat(_Je.colRange(3, 6));
CvMat _dpdf = cvMat(_Ji.colRange(0, 2));
CvMat _dpdc = cvMat(_Ji.colRange(2, 4));
CvMat _dpdk = cvMat(_Ji.colRange(4, NINTRINSIC));
CvMat _mp = cvMat(_err.reshape(2, 1));
if( calcJ )
{
@ -2081,7 +2081,7 @@ static double cvStereoCalibrateImpl( const CvMat* _objectPoints, const CvMat* _i
for( i = ofs = 0; i < nimages; ofs += ni, i++ )
{
ni = npoints->data.i[i];
CvMat objpt_i, _part;
CvMat objpt_i;
om[0] = cvMat(3,1,CV_64F,solver.param->data.db+(i+1)*6);
T[0] = cvMat(3,1,CV_64F,solver.param->data.db+(i+1)*6+3);
@ -2095,12 +2095,12 @@ static double cvStereoCalibrateImpl( const CvMat* _objectPoints, const CvMat* _i
objpt_i = cvMat(1, ni, CV_64FC3, objectPoints->data.db + ofs*3);
err.resize(ni*2); Je.resize(ni*2); J_LR.resize(ni*2); Ji.resize(ni*2);
CvMat tmpimagePoints(err.reshape(2, 1));
CvMat dpdf(Ji.colRange(0, 2));
CvMat dpdc(Ji.colRange(2, 4));
CvMat dpdk(Ji.colRange(4, NINTRINSIC));
CvMat dpdrot(Je.colRange(0, 3));
CvMat dpdt(Je.colRange(3, 6));
CvMat tmpimagePoints = cvMat(err.reshape(2, 1));
CvMat dpdf = cvMat(Ji.colRange(0, 2));
CvMat dpdc = cvMat(Ji.colRange(2, 4));
CvMat dpdk = cvMat(Ji.colRange(4, NINTRINSIC));
CvMat dpdrot = cvMat(Je.colRange(0, 3));
CvMat dpdt = cvMat(Je.colRange(3, 6));
for( k = 0; k < 2; k++ )
{
@ -2363,7 +2363,7 @@ void cvStereoRectify( const CvMat* _cameraMatrix1, const CvMat* _cameraMatrix2,
// calculate projection/camera matrices
// these contain the relevant rectified image internal params (fx, fy=fx, cx, cy)
double fc_new = DBL_MAX;
CvPoint2D64f cc_new[2] = {{0,0}, {0,0}};
CvPoint2D64f cc_new[2] = {};
newImgSize = newImgSize.width * newImgSize.height != 0 ? newImgSize : imageSize;
const double ratio_x = (double)newImgSize.width / imageSize.width / 2;
@ -2375,8 +2375,8 @@ void cvStereoRectify( const CvMat* _cameraMatrix1, const CvMat* _cameraMatrix2,
{
const CvMat* A = k == 0 ? _cameraMatrix1 : _cameraMatrix2;
const CvMat* Dk = k == 0 ? _distCoeffs1 : _distCoeffs2;
CvPoint2D32f _pts[4];
CvPoint3D32f _pts_3[4];
CvPoint2D32f _pts[4] = {};
CvPoint3D32f _pts_3[4] = {};
CvMat pts = cvMat(1, 4, CV_32FC2, _pts);
CvMat pts_3 = cvMat(1, 4, CV_32FC3, _pts_3);
@ -2485,18 +2485,22 @@ void cvStereoRectify( const CvMat* _cameraMatrix1, const CvMat* _cameraMatrix2,
if(roi1)
{
*roi1 = cv::Rect(cvCeil((inner1.x - cx1_0)*s + cx1),
*roi1 = cvRect(
cv::Rect(cvCeil((inner1.x - cx1_0)*s + cx1),
cvCeil((inner1.y - cy1_0)*s + cy1),
cvFloor(inner1.width*s), cvFloor(inner1.height*s))
& cv::Rect(0, 0, newImgSize.width, newImgSize.height);
& cv::Rect(0, 0, newImgSize.width, newImgSize.height)
);
}
if(roi2)
{
*roi2 = cv::Rect(cvCeil((inner2.x - cx2_0)*s + cx2),
*roi2 = cvRect(
cv::Rect(cvCeil((inner2.x - cx2_0)*s + cx2),
cvCeil((inner2.y - cy2_0)*s + cy2),
cvFloor(inner2.width*s), cvFloor(inner2.height*s))
& cv::Rect(0, 0, newImgSize.width, newImgSize.height);
& cv::Rect(0, 0, newImgSize.width, newImgSize.height)
);
}
}
@ -2557,7 +2561,7 @@ void cvGetOptimalNewCameraMatrix( const CvMat* cameraMatrix, const CvMat* distCo
(float)(inner.height*s));
cv::Rect r(cvCeil(inner.x), cvCeil(inner.y), cvFloor(inner.width), cvFloor(inner.height));
r &= cv::Rect(0, 0, newImgSize.width, newImgSize.height);
*validPixROI = r;
*validPixROI = cvRect(r);
}
}
else
@ -2589,7 +2593,7 @@ void cvGetOptimalNewCameraMatrix( const CvMat* cameraMatrix, const CvMat* distCo
icvGetRectangles( cameraMatrix, distCoeffs, 0, &matM, imgSize, inner, outer );
cv::Rect r = inner;
r &= cv::Rect(0, 0, newImgSize.width, newImgSize.height);
*validPixROI = r;
*validPixROI = cvRect(r);
}
}
@ -3162,30 +3166,29 @@ static void collectCalibrationData( InputArrayOfArrays objectPoints,
Point3f* objPtData = objPtMat.ptr<Point3f>();
Point2f* imgPtData1 = imgPtMat1.ptr<Point2f>();
#if defined __GNUC__ && __GNUC__ >= 8
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wclass-memaccess"
#endif
for( i = 0; i < nimages; i++, j += ni )
{
Mat objpt = objectPoints.getMat(i);
Mat imgpt1 = imagePoints1.getMat(i);
ni = objpt.checkVector(3, CV_32F);
npoints.at<int>(i) = ni;
memcpy( objPtData + j, objpt.ptr(), ni*sizeof(objPtData[0]) );
memcpy( imgPtData1 + j, imgpt1.ptr(), ni*sizeof(imgPtData1[0]) );
for (int n = 0; n < ni; ++n)
{
objPtData[j + n] = objpt.ptr<Point3f>()[n];
imgPtData1[j + n] = imgpt1.ptr<Point2f>()[n];
}
if( imgPtData2 )
{
Mat imgpt2 = imagePoints2.getMat(i);
int ni2 = imgpt2.checkVector(2, CV_32F);
CV_Assert( ni == ni2 );
memcpy( imgPtData2 + j, imgpt2.ptr(), ni*sizeof(imgPtData2[0]) );
for (int n = 0; n < ni2; ++n)
{
imgPtData2[j + n] = imgpt2.ptr<Point2f>()[n];
}
}
}
#if defined __GNUC__ && __GNUC__ >= 8
#pragma GCC diagnostic pop
#endif
}
static Mat prepareCameraMatrix(Mat& cameraMatrix0, int rtype)
@ -3228,11 +3231,11 @@ void cv::Rodrigues(InputArray _src, OutputArray _dst, OutputArray _jacobian)
bool v2m = src.cols == 1 || src.rows == 1;
_dst.create(3, v2m ? 3 : 1, src.depth());
Mat dst = _dst.getMat();
CvMat _csrc = src, _cdst = dst, _cjacobian;
CvMat _csrc = cvMat(src), _cdst = cvMat(dst), _cjacobian;
if( _jacobian.needed() )
{
_jacobian.create(v2m ? Size(9, 3) : Size(3, 9), src.depth());
_cjacobian = _jacobian.getMat();
_cjacobian = cvMat(_jacobian.getMat());
}
bool ok = cvRodrigues2(&_csrc, &_cdst, _jacobian.needed() ? &_cjacobian : 0) > 0;
if( !ok )
@ -3247,7 +3250,8 @@ void cv::matMulDeriv( InputArray _Amat, InputArray _Bmat,
Mat A = _Amat.getMat(), B = _Bmat.getMat();
_dABdA.create(A.rows*B.cols, A.rows*A.cols, A.type());
_dABdB.create(A.rows*B.cols, B.rows*B.cols, A.type());
CvMat matA = A, matB = B, c_dABdA = _dABdA.getMat(), c_dABdB = _dABdB.getMat();
Mat dABdA = _dABdA.getMat(), dABdB = _dABdB.getMat();
CvMat matA = cvMat(A), matB = cvMat(B), c_dABdA = cvMat(dABdA), c_dABdB = cvMat(dABdB);
cvCalcMatMulDeriv(&matA, &matB, &c_dABdA, &c_dABdB);
}
@ -3267,8 +3271,8 @@ void cv::composeRT( InputArray _rvec1, InputArray _tvec1,
_tvec3.create(tvec1.size(), rtype);
Mat rvec3 = _rvec3.getMat(), tvec3 = _tvec3.getMat();
CvMat c_rvec1 = rvec1, c_tvec1 = tvec1, c_rvec2 = rvec2,
c_tvec2 = tvec2, c_rvec3 = rvec3, c_tvec3 = tvec3;
CvMat c_rvec1 = cvMat(rvec1), c_tvec1 = cvMat(tvec1), c_rvec2 = cvMat(rvec2),
c_tvec2 = cvMat(tvec2), c_rvec3 = cvMat(rvec3), c_tvec3 = cvMat(tvec3);
CvMat c_dr3dr1, c_dr3dt1, c_dr3dr2, c_dr3dt2, c_dt3dr1, c_dt3dt1, c_dt3dr2, c_dt3dt2;
CvMat *p_dr3dr1=0, *p_dr3dt1=0, *p_dr3dr2=0, *p_dr3dt2=0, *p_dt3dr1=0, *p_dt3dt1=0, *p_dt3dr2=0, *p_dt3dt2=0;
#define CV_COMPOSE_RT_PARAM(name) \
@ -3277,7 +3281,7 @@ void cv::composeRT( InputArray _rvec1, InputArray _tvec1,
{ \
_ ## name.create(3, 3, rtype); \
name = _ ## name.getMat(); \
p_ ## name = &(c_ ## name = name); \
p_ ## name = &(c_ ## name = cvMat(name)); \
}
CV_COMPOSE_RT_PARAM(dr3dr1); CV_COMPOSE_RT_PARAM(dr3dt1);
@ -3310,31 +3314,32 @@ void cv::projectPoints( InputArray _opoints,
_ipoints.create(npoints, 1, CV_MAKETYPE(depth, 2), -1, true);
Mat imagePoints = _ipoints.getMat();
CvMat c_imagePoints(imagePoints);
CvMat c_objectPoints = opoints;
CvMat c_imagePoints = cvMat(imagePoints);
CvMat c_objectPoints = cvMat(opoints);
Mat cameraMatrix = _cameraMatrix.getMat();
Mat rvec = _rvec.getMat(), tvec = _tvec.getMat();
CvMat c_cameraMatrix = cameraMatrix;
CvMat c_rvec = rvec, c_tvec = tvec;
CvMat c_cameraMatrix = cvMat(cameraMatrix);
CvMat c_rvec = cvMat(rvec), c_tvec = cvMat(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;
CvMat c_distCoeffs = cvMat(distCoeffs);
int ndistCoeffs = distCoeffs.rows + distCoeffs.cols - 1;
Mat jacobian;
if( _jacobian.needed() )
{
_jacobian.create(npoints*2, 3+3+2+2+ndistCoeffs, CV_64F);
Mat jacobian = _jacobian.getMat();
pdpdrot = &(dpdrot = jacobian.colRange(0, 3));
pdpdt = &(dpdt = jacobian.colRange(3, 6));
pdpdf = &(dpdf = jacobian.colRange(6, 8));
pdpdc = &(dpdc = jacobian.colRange(8, 10));
pdpddist = &(dpddist = jacobian.colRange(10, 10+ndistCoeffs));
jacobian = _jacobian.getMat();
pdpdrot = &(dpdrot = cvMat(jacobian.colRange(0, 3)));
pdpdt = &(dpdt = cvMat(jacobian.colRange(3, 6)));
pdpdf = &(dpdf = cvMat(jacobian.colRange(6, 8)));
pdpdc = &(dpdc = cvMat(jacobian.colRange(8, 10)));
pdpddist = &(dpddist = cvMat(jacobian.colRange(10, 10+ndistCoeffs)));
}
cvProjectPoints2( &c_objectPoints, &c_rvec, &c_tvec, &c_cameraMatrix, &c_distCoeffs,
@ -3350,9 +3355,9 @@ cv::Mat cv::initCameraMatrix2D( InputArrayOfArrays objectPoints,
Mat objPt, imgPt, npoints, cameraMatrix(3, 3, CV_64F);
collectCalibrationData( objectPoints, imagePoints, noArray(),
objPt, imgPt, 0, npoints );
CvMat _objPt = objPt, _imgPt = imgPt, _npoints = npoints, _cameraMatrix = cameraMatrix;
CvMat _objPt = cvMat(objPt), _imgPt = cvMat(imgPt), _npoints = cvMat(npoints), _cameraMatrix = cvMat(cameraMatrix);
cvInitIntrinsicParams2D( &_objPt, &_imgPt, &_npoints,
imageSize, &_cameraMatrix, aspectRatio );
cvSize(imageSize), &_cameraMatrix, aspectRatio );
return cameraMatrix;
}
@ -3434,16 +3439,16 @@ double cv::calibrateCamera(InputArrayOfArrays _objectPoints,
collectCalibrationData( _objectPoints, _imagePoints, noArray(),
objPt, imgPt, 0, npoints );
CvMat c_objPt = objPt, c_imgPt = imgPt, c_npoints = npoints;
CvMat c_cameraMatrix = cameraMatrix, c_distCoeffs = distCoeffs;
CvMat c_rvecM = rvecM, c_tvecM = tvecM, c_stdDev = stdDeviationsM, c_errors = errorsM;
CvMat c_objPt = cvMat(objPt), c_imgPt = cvMat(imgPt), c_npoints = cvMat(npoints);
CvMat c_cameraMatrix = cvMat(cameraMatrix), c_distCoeffs = cvMat(distCoeffs);
CvMat c_rvecM = cvMat(rvecM), c_tvecM = cvMat(tvecM), c_stdDev = cvMat(stdDeviationsM), c_errors = cvMat(errorsM);
double reprojErr = cvCalibrateCamera2Internal(&c_objPt, &c_imgPt, &c_npoints, imageSize,
double reprojErr = cvCalibrateCamera2Internal(&c_objPt, &c_imgPt, &c_npoints, cvSize(imageSize),
&c_cameraMatrix, &c_distCoeffs,
rvecs_needed ? &c_rvecM : NULL,
tvecs_needed ? &c_tvecM : NULL,
stddev_needed ? &c_stdDev : NULL,
errors_needed ? &c_errors : NULL, flags, criteria );
errors_needed ? &c_errors : NULL, flags, cvTermCriteria(criteria));
if( stddev_needed )
{
@ -3582,35 +3587,40 @@ double cv::stereoCalibrate( InputArrayOfArrays _objectPoints,
collectCalibrationData( _objectPoints, _imagePoints1, _imagePoints2,
objPt, imgPt, &imgPt2, npoints );
CvMat c_objPt = objPt, c_imgPt = imgPt, c_imgPt2 = imgPt2, c_npoints = npoints;
CvMat c_cameraMatrix1 = cameraMatrix1, c_distCoeffs1 = distCoeffs1;
CvMat c_cameraMatrix2 = cameraMatrix2, c_distCoeffs2 = distCoeffs2;
CvMat c_matR = _Rmat.getMat(), c_matT = _Tmat.getMat(), c_matE, c_matF, c_matErr;
CvMat c_objPt = cvMat(objPt), c_imgPt = cvMat(imgPt), c_imgPt2 = cvMat(imgPt2), c_npoints = cvMat(npoints);
CvMat c_cameraMatrix1 = cvMat(cameraMatrix1), c_distCoeffs1 = cvMat(distCoeffs1);
CvMat c_cameraMatrix2 = cvMat(cameraMatrix2), c_distCoeffs2 = cvMat(distCoeffs2);
Mat matR_ = _Rmat.getMat(), matT_ = _Tmat.getMat();
CvMat c_matR = cvMat(matR_), c_matT = cvMat(matT_), c_matE, c_matF, c_matErr;
bool E_needed = _Emat.needed(), F_needed = _Fmat.needed(), errors_needed = _perViewErrors.needed();
Mat matE_, matF_, matErr_;
if( E_needed )
{
_Emat.create(3, 3, rtype);
c_matE = _Emat.getMat();
matE_ = _Emat.getMat();
c_matE = cvMat(matE_);
}
if( F_needed )
{
_Fmat.create(3, 3, rtype);
c_matF = _Fmat.getMat();
matF_ = _Fmat.getMat();
c_matF = cvMat(matF_);
}
if( errors_needed )
{
int nimages = int(_objectPoints.total());
_perViewErrors.create(nimages, 2, CV_64F);
c_matErr = _perViewErrors.getMat();
matErr_ = _perViewErrors.getMat();
c_matErr = cvMat(matErr_);
}
double err = cvStereoCalibrateImpl(&c_objPt, &c_imgPt, &c_imgPt2, &c_npoints, &c_cameraMatrix1,
&c_distCoeffs1, &c_cameraMatrix2, &c_distCoeffs2, imageSize, &c_matR,
&c_distCoeffs1, &c_cameraMatrix2, &c_distCoeffs2, cvSize(imageSize), &c_matR,
&c_matT, E_needed ? &c_matE : NULL, F_needed ? &c_matF : NULL,
errors_needed ? &c_matErr : NULL, flags, criteria);
errors_needed ? &c_matErr : NULL, flags, cvTermCriteria(criteria));
cameraMatrix1.copyTo(_cameraMatrix1);
cameraMatrix2.copyTo(_cameraMatrix2);
@ -3633,31 +3643,32 @@ void cv::stereoRectify( InputArray _cameraMatrix1, InputArray _distCoeffs1,
Mat cameraMatrix1 = _cameraMatrix1.getMat(), cameraMatrix2 = _cameraMatrix2.getMat();
Mat distCoeffs1 = _distCoeffs1.getMat(), distCoeffs2 = _distCoeffs2.getMat();
Mat Rmat = _Rmat.getMat(), Tmat = _Tmat.getMat();
CvMat c_cameraMatrix1 = cameraMatrix1;
CvMat c_cameraMatrix2 = cameraMatrix2;
CvMat c_distCoeffs1 = distCoeffs1;
CvMat c_distCoeffs2 = distCoeffs2;
CvMat c_R = Rmat, c_T = Tmat;
CvMat c_cameraMatrix1 = cvMat(cameraMatrix1);
CvMat c_cameraMatrix2 = cvMat(cameraMatrix2);
CvMat c_distCoeffs1 = cvMat(distCoeffs1);
CvMat c_distCoeffs2 = cvMat(distCoeffs2);
CvMat c_R = cvMat(Rmat), c_T = cvMat(Tmat);
int rtype = CV_64F;
_Rmat1.create(3, 3, rtype);
_Rmat2.create(3, 3, rtype);
_Pmat1.create(3, 4, rtype);
_Pmat2.create(3, 4, rtype);
CvMat c_R1 = _Rmat1.getMat(), c_R2 = _Rmat2.getMat(), c_P1 = _Pmat1.getMat(), c_P2 = _Pmat2.getMat();
Mat R1 = _Rmat1.getMat(), R2 = _Rmat2.getMat(), P1 = _Pmat1.getMat(), P2 = _Pmat2.getMat(), Q;
CvMat c_R1 = cvMat(R1), c_R2 = cvMat(R2), c_P1 = cvMat(P1), c_P2 = cvMat(P2);
CvMat c_Q, *p_Q = 0;
if( _Qmat.needed() )
{
_Qmat.create(4, 4, rtype);
p_Q = &(c_Q = _Qmat.getMat());
p_Q = &(c_Q = cvMat(Q = _Qmat.getMat()));
}
CvMat *p_distCoeffs1 = distCoeffs1.empty() ? NULL : &c_distCoeffs1;
CvMat *p_distCoeffs2 = distCoeffs2.empty() ? NULL : &c_distCoeffs2;
cvStereoRectify( &c_cameraMatrix1, &c_cameraMatrix2, p_distCoeffs1, p_distCoeffs2,
imageSize, &c_R, &c_T, &c_R1, &c_R2, &c_P1, &c_P2, p_Q, flags, alpha,
newImageSize, (CvRect*)validPixROI1, (CvRect*)validPixROI2);
cvSize(imageSize), &c_R, &c_T, &c_R1, &c_R2, &c_P1, &c_P2, p_Q, flags, alpha,
cvSize(newImageSize), (CvRect*)validPixROI1, (CvRect*)validPixROI2);
}
bool cv::stereoRectifyUncalibrated( InputArray _points1, InputArray _points2,
@ -3671,11 +3682,12 @@ bool cv::stereoRectifyUncalibrated( InputArray _points1, InputArray _points2,
_Hmat2.create(3, 3, rtype);
Mat F = _Fmat.getMat();
Mat points1 = _points1.getMat(), points2 = _points2.getMat();
CvMat c_pt1 = points1, c_pt2 = points2;
CvMat c_F, *p_F=0, c_H1 = _Hmat1.getMat(), c_H2 = _Hmat2.getMat();
CvMat c_pt1 = cvMat(points1), c_pt2 = cvMat(points2);
Mat H1 = _Hmat1.getMat(), H2 = _Hmat2.getMat();
CvMat c_F, *p_F=0, c_H1 = cvMat(H1), c_H2 = cvMat(H2);
if( F.size() == Size(3, 3) )
p_F = &(c_F = F);
return cvStereoRectifyUncalibrated(&c_pt1, &c_pt2, p_F, imgSize, &c_H1, &c_H2, threshold) > 0;
p_F = &(c_F = cvMat(F));
return cvStereoRectifyUncalibrated(&c_pt1, &c_pt2, p_F, cvSize(imgSize), &c_H1, &c_H2, threshold) > 0;
}
cv::Mat cv::getOptimalNewCameraMatrix( InputArray _cameraMatrix,
@ -3686,14 +3698,14 @@ cv::Mat cv::getOptimalNewCameraMatrix( InputArray _cameraMatrix,
CV_INSTRUMENT_REGION()
Mat cameraMatrix = _cameraMatrix.getMat(), distCoeffs = _distCoeffs.getMat();
CvMat c_cameraMatrix = cameraMatrix, c_distCoeffs = distCoeffs;
CvMat c_cameraMatrix = cvMat(cameraMatrix), c_distCoeffs = cvMat(distCoeffs);
Mat newCameraMatrix(3, 3, CV_MAT_TYPE(c_cameraMatrix.type));
CvMat c_newCameraMatrix = newCameraMatrix;
CvMat c_newCameraMatrix = cvMat(newCameraMatrix);
cvGetOptimalNewCameraMatrix(&c_cameraMatrix, &c_distCoeffs, imgSize,
cvGetOptimalNewCameraMatrix(&c_cameraMatrix, &c_distCoeffs, cvSize(imgSize),
alpha, &c_newCameraMatrix,
newImgSize, (CvRect*)validPixROI, (int)centerPrincipalPoint);
cvSize(newImgSize), (CvRect*)validPixROI, (int)centerPrincipalPoint);
return newCameraMatrix;
}
@ -3714,7 +3726,7 @@ cv::Vec3d cv::RQDecomp3x3( InputArray _Mmat,
Mat Qmat = _Qmat.getMat();
Vec3d eulerAngles;
CvMat matM = M, matR = Rmat, matQ = Qmat;
CvMat matM = cvMat(M), matR = cvMat(Rmat), matQ = cvMat(Qmat);
#define CV_RQDecomp3x3_PARAM(name) \
Mat name; \
CvMat c_ ## name, *p ## name = NULL; \
@ -3722,7 +3734,7 @@ cv::Vec3d cv::RQDecomp3x3( InputArray _Mmat,
{ \
_ ## name.create(3, 3, M.type()); \
name = _ ## name.getMat(); \
c_ ## name = name; p ## name = &c_ ## name; \
c_ ## name = cvMat(name); p ## name = &c_ ## name; \
}
CV_RQDecomp3x3_PARAM(Qx);
@ -3749,8 +3761,8 @@ void cv::decomposeProjectionMatrix( InputArray _projMatrix, OutputArray _cameraM
Mat cameraMatrix = _cameraMatrix.getMat();
Mat rotMatrix = _rotMatrix.getMat();
Mat transVect = _transVect.getMat();
CvMat c_projMatrix = projMatrix, c_cameraMatrix = cameraMatrix;
CvMat c_rotMatrix = rotMatrix, c_transVect = transVect;
CvMat c_projMatrix = cvMat(projMatrix), c_cameraMatrix = cvMat(cameraMatrix);
CvMat c_rotMatrix = cvMat(rotMatrix), c_transVect = cvMat(transVect);
CvPoint3D64f *p_eulerAngles = 0;
#define CV_decomposeProjectionMatrix_PARAM(name) \
@ -3760,7 +3772,7 @@ void cv::decomposeProjectionMatrix( InputArray _projMatrix, OutputArray _cameraM
{ \
_ ## name.create(3, 3, type); \
name = _ ## name.getMat(); \
c_ ## name = name; p_ ## name = &c_ ## name; \
c_ ## name = cvMat(name); p_ ## name = &c_ ## name; \
}
CV_decomposeProjectionMatrix_PARAM(rotMatrixX);

@ -111,8 +111,8 @@ void cvFindStereoCorrespondenceBM( const CvArr* leftarr, const CvArr* rightarr,
CvRect cvGetValidDisparityROI( CvRect roi1, CvRect roi2, int minDisparity,
int numberOfDisparities, int SADWindowSize )
{
return (CvRect)cv::getValidDisparityROI( roi1, roi2, minDisparity,
numberOfDisparities, SADWindowSize );
return cvRect(cv::getValidDisparityROI( roi1, roi2, minDisparity,
numberOfDisparities, SADWindowSize));
}
void cvValidateDisparity( CvArr* _disp, const CvArr* _cost, int minDisparity,

@ -134,9 +134,9 @@ bool solvePnP( InputArray _opoints, InputArray _ipoints,
}
else if (flags == SOLVEPNP_ITERATIVE)
{
CvMat c_objectPoints = opoints, c_imagePoints = ipoints;
CvMat c_cameraMatrix = cameraMatrix, c_distCoeffs = distCoeffs;
CvMat c_rvec = rvec, c_tvec = tvec;
CvMat c_objectPoints = cvMat(opoints), c_imagePoints = cvMat(ipoints);
CvMat c_cameraMatrix = cvMat(cameraMatrix), c_distCoeffs = cvMat(distCoeffs);
CvMat c_rvec = cvMat(rvec), c_tvec = cvMat(tvec);
cvFindExtrinsicCameraParams2(&c_objectPoints, &c_imagePoints, &c_cameraMatrix,
(c_distCoeffs.rows && c_distCoeffs.cols) ? &c_distCoeffs : 0,
&c_rvec, &c_tvec, useExtrinsicGuess );

@ -358,11 +358,12 @@ void cv::triangulatePoints( InputArray _projMatr1, InputArray _projMatr2,
if((points2.rows == 1 || points2.cols == 1) && points2.channels() == 2)
points2 = points2.reshape(1, static_cast<int>(points2.total())).t();
CvMat cvMatr1 = matr1, cvMatr2 = matr2;
CvMat cvPoints1 = points1, cvPoints2 = points2;
CvMat cvMatr1 = cvMat(matr1), cvMatr2 = cvMat(matr2);
CvMat cvPoints1 = cvMat(points1), cvPoints2 = cvMat(points2);
_points4D.create(4, points1.cols, points1.type());
CvMat cvPoints4D = _points4D.getMat();
Mat cvPoints4D_ = _points4D.getMat();
CvMat cvPoints4D = cvMat(cvPoints4D_);
cvTriangulatePoints(&cvMatr1, &cvMatr2, &cvPoints1, &cvPoints2, &cvPoints4D);
}
@ -375,12 +376,13 @@ void cv::correctMatches( InputArray _F, InputArray _points1, InputArray _points2
Mat F = _F.getMat();
Mat points1 = _points1.getMat(), points2 = _points2.getMat();
CvMat cvPoints1 = points1, cvPoints2 = points2;
CvMat cvF = F;
CvMat cvPoints1 = cvMat(points1), cvPoints2 = cvMat(points2);
CvMat cvF = cvMat(F);
_newPoints1.create(points1.size(), points1.type());
_newPoints2.create(points2.size(), points2.type());
CvMat cvNewPoints1 = _newPoints1.getMat(), cvNewPoints2 = _newPoints2.getMat();
Mat cvNewPoints1_ = _newPoints1.getMat(), cvNewPoints2_ = _newPoints2.getMat();
CvMat cvNewPoints1 = cvMat(cvNewPoints1_), cvNewPoints2 = cvMat(cvNewPoints2_);
cvCorrectMatches(&cvF, &cvPoints1, &cvPoints2, &cvNewPoints1, &cvNewPoints2);
}

@ -290,8 +290,8 @@ void CV_CameraCalibrationTest::run( int start_from )
cv::String filepath;
cv::String filename;
CvSize imageSize;
CvSize etalonSize;
Size imageSize;
Size etalonSize;
int numImages;
CvPoint2D64f* imagePoints;
@ -531,7 +531,7 @@ void CV_CameraCalibrationTest::run( int start_from )
/* Now we can calibrate camera */
calibrate( numImages,
numbers,
imageSize,
cvSize(imageSize),
imagePoints,
objectPoints,
distortion,
@ -1009,9 +1009,9 @@ void CV_CalibrationMatrixValuesTest_C::calibMatrixValues( const Mat& _cameraMatr
double& fovx, double& fovy, double& focalLength,
Point2d& principalPoint, double& aspectRatio )
{
CvMat cameraMatrix = _cameraMatrix;
CvPoint2D64f pp;
cvCalibrationMatrixValues( &cameraMatrix, imageSize, apertureWidth, apertureHeight,
CvMat cameraMatrix = cvMat(_cameraMatrix);
CvPoint2D64f pp = {0, 0};
cvCalibrationMatrixValues( &cameraMatrix, cvSize(imageSize), apertureWidth, apertureHeight,
&fovx, &fovy, &focalLength, &pp, &aspectRatio );
principalPoint.x = pp.x;
principalPoint.y = pp.y;
@ -1305,9 +1305,9 @@ void CV_ProjectPointsTest_C::project( const Mat& opoints, const Mat& rvec, const
dpdc.create(npoints*2, 2, CV_64F);
dpddist.create(npoints*2, distCoeffs.rows + distCoeffs.cols - 1, CV_64F);
Mat imagePoints(ipoints);
CvMat _objectPoints = opoints, _imagePoints = imagePoints;
CvMat _rvec = rvec, _tvec = tvec, _cameraMatrix = cameraMatrix, _distCoeffs = distCoeffs;
CvMat _dpdrot = dpdrot, _dpdt = dpdt, _dpdf = dpdf, _dpdc = dpdc, _dpddist = dpddist;
CvMat _objectPoints = cvMat(opoints), _imagePoints = cvMat(imagePoints);
CvMat _rvec = cvMat(rvec), _tvec = cvMat(tvec), _cameraMatrix = cvMat(cameraMatrix), _distCoeffs = cvMat(distCoeffs);
CvMat _dpdrot = cvMat(dpdrot), _dpdt = cvMat(dpdt), _dpdf = cvMat(dpdf), _dpdc = cvMat(dpdc), _dpddist = cvMat(dpddist);
cvProjectPoints2( &_objectPoints, &_rvec, &_tvec, &_cameraMatrix, &_distCoeffs,
&_imagePoints, &_dpdrot, &_dpdt, &_dpdf, &_dpdc, &_dpddist, aspectRatio );
@ -1925,14 +1925,14 @@ double CV_StereoCalibrationTest_C::calibrateStereoCamera( const vector<vector<Po
std::copy(imagePoints1[i].begin(), imagePoints1[i].end(), imgPtData + j);
std::copy(imagePoints2[i].begin(), imagePoints2[i].end(), imgPtData2 + j);
}
CvMat _objPt = objPt, _imgPt = imgPt, _imgPt2 = imgPt2, _npoints = npoints;
CvMat _cameraMatrix1 = cameraMatrix1, _distCoeffs1 = distCoeffs1;
CvMat _cameraMatrix2 = cameraMatrix2, _distCoeffs2 = distCoeffs2;
CvMat matR = R, matT = T, matE = E, matF = F;
CvMat _objPt = cvMat(objPt), _imgPt = cvMat(imgPt), _imgPt2 = cvMat(imgPt2), _npoints = cvMat(npoints);
CvMat _cameraMatrix1 = cvMat(cameraMatrix1), _distCoeffs1 = cvMat(distCoeffs1);
CvMat _cameraMatrix2 = cvMat(cameraMatrix2), _distCoeffs2 = cvMat(distCoeffs2);
CvMat matR = cvMat(R), matT = cvMat(T), matE = cvMat(E), matF = cvMat(F);
return cvStereoCalibrate(&_objPt, &_imgPt, &_imgPt2, &_npoints, &_cameraMatrix1,
&_distCoeffs1, &_cameraMatrix2, &_distCoeffs2, imageSize,
&matR, &matT, &matE, &matF, flags, criteria );
&_distCoeffs1, &_cameraMatrix2, &_distCoeffs2, cvSize(imageSize),
&matR, &matT, &matE, &matF, flags, cvTermCriteria(criteria));
}
void CV_StereoCalibrationTest_C::rectify( const Mat& cameraMatrix1, const Mat& distCoeffs1,
@ -1948,12 +1948,12 @@ void CV_StereoCalibrationTest_C::rectify( const Mat& cameraMatrix1, const Mat& d
P1.create(3, 4, rtype);
P2.create(3, 4, rtype);
Q.create(4, 4, rtype);
CvMat _cameraMatrix1 = cameraMatrix1, _distCoeffs1 = distCoeffs1;
CvMat _cameraMatrix2 = cameraMatrix2, _distCoeffs2 = distCoeffs2;
CvMat matR = R, matT = T, _R1 = R1, _R2 = R2, _P1 = P1, _P2 = P2, matQ = Q;
CvMat _cameraMatrix1 = cvMat(cameraMatrix1), _distCoeffs1 = cvMat(distCoeffs1);
CvMat _cameraMatrix2 = cvMat(cameraMatrix2), _distCoeffs2 = cvMat(distCoeffs2);
CvMat matR = cvMat(R), matT = cvMat(T), _R1 = cvMat(R1), _R2 = cvMat(R2), _P1 = cvMat(P1), _P2 = cvMat(P2), matQ = cvMat(Q);
cvStereoRectify( &_cameraMatrix1, &_cameraMatrix2, &_distCoeffs1, &_distCoeffs2,
imageSize, &matR, &matT, &_R1, &_R2, &_P1, &_P2, &matQ, flags,
alpha, newImageSize, (CvRect*)validPixROI1, (CvRect*)validPixROI2);
cvSize(imageSize), &matR, &matT, &_R1, &_R2, &_P1, &_P2, &matQ, flags,
alpha, cvSize(newImageSize), (CvRect*)validPixROI1, (CvRect*)validPixROI2);
}
bool CV_StereoCalibrationTest_C::rectifyUncalibrated( const Mat& points1,
@ -1961,19 +1961,19 @@ bool CV_StereoCalibrationTest_C::rectifyUncalibrated( const Mat& points1,
{
H1.create(3, 3, CV_64F);
H2.create(3, 3, CV_64F);
CvMat _pt1 = points1, _pt2 = points2, matF, *pF=0, _H1 = H1, _H2 = H2;
CvMat _pt1 = cvMat(points1), _pt2 = cvMat(points2), matF, *pF=0, _H1 = cvMat(H1), _H2 = cvMat(H2);
if( F.size() == Size(3, 3) )
pF = &(matF = F);
return cvStereoRectifyUncalibrated(&_pt1, &_pt2, pF, imgSize, &_H1, &_H2, threshold) > 0;
pF = &(matF = cvMat(F));
return cvStereoRectifyUncalibrated(&_pt1, &_pt2, pF, cvSize(imgSize), &_H1, &_H2, threshold) > 0;
}
void CV_StereoCalibrationTest_C::triangulate( const Mat& P1, const Mat& P2,
const Mat &points1, const Mat &points2,
Mat &points4D )
{
CvMat _P1 = P1, _P2 = P2, _points1 = points1, _points2 = points2;
CvMat _P1 = cvMat(P1), _P2 = cvMat(P2), _points1 = cvMat(points1), _points2 = cvMat(points2);
points4D.create(4, points1.cols, points1.type());
CvMat _points4D = points4D;
CvMat _points4D = cvMat(points4D);
cvTriangulatePoints(&_P1, &_P2, &_points1, &_points2, &_points4D);
}
@ -1981,10 +1981,10 @@ void CV_StereoCalibrationTest_C::correct( const Mat& F,
const Mat &points1, const Mat &points2,
Mat &newPoints1, Mat &newPoints2 )
{
CvMat _F = F, _points1 = points1, _points2 = points2;
CvMat _F = cvMat(F), _points1 = cvMat(points1), _points2 = cvMat(points2);
newPoints1.create(1, points1.cols, points1.type());
newPoints2.create(1, points2.cols, points2.type());
CvMat _newPoints1 = newPoints1, _newPoints2 = newPoints2;
CvMat _newPoints1 = cvMat(newPoints1), _newPoints2 = cvMat(newPoints2);
cvCorrectMatches(&_F, &_points1, &_points2, &_newPoints1, &_newPoints2);
}

@ -75,7 +75,7 @@ protected:
void operator()() const
{
cvCalibrateCamera2(objPts, imgPts, npoints, imageSize,
cvCalibrateCamera2(objPts, imgPts, npoints, cvSize(imageSize),
cameraMatrix, distCoeffs, rvecs, tvecs, flags );
}
};
@ -137,13 +137,13 @@ void CV_CameraCalibrationBadArgTest::run( int /* start_from */ )
//CV_CALIB_FIX_PRINCIPAL_POINT //CV_CALIB_ZERO_TANGENT_DIST
//CV_CALIB_FIX_FOCAL_LENGTH //CV_CALIB_FIX_K1 //CV_CALIB_FIX_K2 //CV_CALIB_FIX_K3
objPts = objPts_cpp;
imgPts = imgPts_cpp;
npoints = npoints_cpp;
cameraMatrix = cameraMatrix_cpp;
distCoeffs = distCoeffs_cpp;
rvecs = rvecs_cpp;
tvecs = tvecs_cpp;
objPts = cvMat(objPts_cpp);
imgPts = cvMat(imgPts_cpp);
npoints = cvMat(npoints_cpp);
cameraMatrix = cvMat(cameraMatrix_cpp);
distCoeffs = cvMat(distCoeffs_cpp);
rvecs = cvMat(rvecs_cpp);
tvecs = cvMat(tvecs_cpp);
/* /*//*/ */
int errors = 0;
@ -178,8 +178,8 @@ void CV_CameraCalibrationBadArgTest::run( int /* start_from */ )
Mat bad_nts_cpp1 = Mat_<float>(M, 1, 1.f);
Mat bad_nts_cpp2 = Mat_<int>(3, 3, corSize.width * corSize.height);
CvMat bad_npts_c1 = bad_nts_cpp1;
CvMat bad_npts_c2 = bad_nts_cpp2;
CvMat bad_npts_c1 = cvMat(bad_nts_cpp1);
CvMat bad_npts_c2 = cvMat(bad_nts_cpp2);
bad_caller = caller;
bad_caller.npoints = &bad_npts_c1;
@ -197,13 +197,13 @@ void CV_CameraCalibrationBadArgTest::run( int /* start_from */ )
bad_caller.tvecs = (CvMat*)zeros.ptr();
errors += run_test_case( CV_StsBadArg, "Bad tvecs header", bad_caller );
Mat bad_rvecs_cpp1(M+1, 1, CV_32FC3); CvMat bad_rvecs_c1 = bad_rvecs_cpp1;
Mat bad_tvecs_cpp1(M+1, 1, CV_32FC3); CvMat bad_tvecs_c1 = bad_tvecs_cpp1;
Mat bad_rvecs_cpp1(M+1, 1, CV_32FC3); CvMat bad_rvecs_c1 = cvMat(bad_rvecs_cpp1);
Mat bad_tvecs_cpp1(M+1, 1, CV_32FC3); CvMat bad_tvecs_c1 = cvMat(bad_tvecs_cpp1);
Mat bad_rvecs_cpp2(M, 2, CV_32FC3); CvMat bad_rvecs_c2 = bad_rvecs_cpp2;
Mat bad_tvecs_cpp2(M, 2, CV_32FC3); CvMat bad_tvecs_c2 = bad_tvecs_cpp2;
Mat bad_rvecs_cpp2(M, 2, CV_32FC3); CvMat bad_rvecs_c2 = cvMat(bad_rvecs_cpp2);
Mat bad_tvecs_cpp2(M, 2, CV_32FC3); CvMat bad_tvecs_c2 = cvMat(bad_tvecs_cpp2);
bad_caller = caller;
bad_caller.rvecs = &bad_rvecs_c1;
@ -221,9 +221,9 @@ void CV_CameraCalibrationBadArgTest::run( int /* start_from */ )
bad_caller.tvecs = &bad_tvecs_c2;
errors += run_test_case( CV_StsBadArg, "Bad tvecs header", bad_caller );
Mat bad_cameraMatrix_cpp1(3, 3, CV_32S); CvMat bad_cameraMatrix_c1 = bad_cameraMatrix_cpp1;
Mat bad_cameraMatrix_cpp2(2, 3, CV_32F); CvMat bad_cameraMatrix_c2 = bad_cameraMatrix_cpp2;
Mat bad_cameraMatrix_cpp3(3, 2, CV_64F); CvMat bad_cameraMatrix_c3 = bad_cameraMatrix_cpp3;
Mat bad_cameraMatrix_cpp1(3, 3, CV_32S); CvMat bad_cameraMatrix_c1 = cvMat(bad_cameraMatrix_cpp1);
Mat bad_cameraMatrix_cpp2(2, 3, CV_32F); CvMat bad_cameraMatrix_c2 = cvMat(bad_cameraMatrix_cpp2);
Mat bad_cameraMatrix_cpp3(3, 2, CV_64F); CvMat bad_cameraMatrix_c3 = cvMat(bad_cameraMatrix_cpp3);
@ -239,9 +239,9 @@ void CV_CameraCalibrationBadArgTest::run( int /* start_from */ )
bad_caller.cameraMatrix = &bad_cameraMatrix_c3;
errors += run_test_case( CV_StsBadArg, "Bad camearaMatrix header", bad_caller );
Mat bad_distCoeffs_cpp1(1, 5, CV_32S); CvMat bad_distCoeffs_c1 = bad_distCoeffs_cpp1;
Mat bad_distCoeffs_cpp2(2, 2, CV_64F); CvMat bad_distCoeffs_c2 = bad_distCoeffs_cpp2;
Mat bad_distCoeffs_cpp3(1, 6, CV_64F); CvMat bad_distCoeffs_c3 = bad_distCoeffs_cpp3;
Mat bad_distCoeffs_cpp1(1, 5, CV_32S); CvMat bad_distCoeffs_c1 = cvMat(bad_distCoeffs_cpp1);
Mat bad_distCoeffs_cpp2(2, 2, CV_64F); CvMat bad_distCoeffs_c2 = cvMat(bad_distCoeffs_cpp2);
Mat bad_distCoeffs_cpp3(1, 6, CV_64F); CvMat bad_distCoeffs_c3 = cvMat(bad_distCoeffs_cpp3);
@ -259,7 +259,7 @@ void CV_CameraCalibrationBadArgTest::run( int /* start_from */ )
errors += run_test_case( CV_StsBadArg, "Bad distCoeffs header", bad_caller );
double CM[] = {0, 0, 0, /**/0, 0, 0, /**/0, 0, 0};
Mat bad_cameraMatrix_cpp4(3, 3, CV_64F, CM); CvMat bad_cameraMatrix_c4 = bad_cameraMatrix_cpp4;
Mat bad_cameraMatrix_cpp4(3, 3, CV_64F, CM); CvMat bad_cameraMatrix_c4 = cvMat(bad_cameraMatrix_cpp4);
bad_caller = caller;
bad_caller.flags |= CV_CALIB_USE_INTRINSIC_GUESS;
@ -302,7 +302,7 @@ void CV_CameraCalibrationBadArgTest::run( int /* start_from */ )
/////////////////////////////////////////////////////////////////////////////////////
bad_caller = caller;
Mat bad_objPts_cpp5 = objPts_cpp.clone(); CvMat bad_objPts_c5 = bad_objPts_cpp5;
Mat bad_objPts_cpp5 = objPts_cpp.clone(); CvMat bad_objPts_c5 = cvMat(bad_objPts_cpp5);
bad_caller.objPts = &bad_objPts_c5;
cv::RNG& rng = theRNG();
@ -347,9 +347,9 @@ protected:
Mat zeros(1, sizeof(CvMat), CV_8U, Scalar(0));
CvMat src_c, dst_c, jacobian_c;
Mat src_cpp(3, 1, CV_32F); src_c = src_cpp;
Mat dst_cpp(3, 3, CV_32F); dst_c = dst_cpp;
Mat jacobian_cpp(3, 9, CV_32F); jacobian_c = jacobian_cpp;
Mat src_cpp(3, 1, CV_32F); src_c = cvMat(src_cpp);
Mat dst_cpp(3, 3, CV_32F); dst_c = cvMat(dst_cpp);
Mat jacobian_cpp(3, 9, CV_32F); jacobian_c = cvMat(jacobian_cpp);
C_Caller caller, bad_caller;
caller.src = &src_c;
@ -373,11 +373,11 @@ protected:
bad_caller.dst = 0;
errors += run_test_case( CV_StsNullPtr, "Dst is zero pointer", bad_caller );
Mat bad_src_cpp1(3, 1, CV_8U); CvMat bad_src_c1 = bad_src_cpp1;
Mat bad_dst_cpp1(3, 1, CV_8U); CvMat bad_dst_c1 = bad_dst_cpp1;
Mat bad_jac_cpp1(3, 1, CV_8U); CvMat bad_jac_c1 = bad_jac_cpp1;
Mat bad_jac_cpp2(3, 1, CV_32FC2); CvMat bad_jac_c2 = bad_jac_cpp2;
Mat bad_jac_cpp3(3, 1, CV_32F); CvMat bad_jac_c3 = bad_jac_cpp3;
Mat bad_src_cpp1(3, 1, CV_8U); CvMat bad_src_c1 = cvMat(bad_src_cpp1);
Mat bad_dst_cpp1(3, 1, CV_8U); CvMat bad_dst_c1 = cvMat(bad_dst_cpp1);
Mat bad_jac_cpp1(3, 1, CV_8U); CvMat bad_jac_c1 = cvMat(bad_jac_cpp1);
Mat bad_jac_cpp2(3, 1, CV_32FC2); CvMat bad_jac_c2 = cvMat(bad_jac_cpp2);
Mat bad_jac_cpp3(3, 1, CV_32F); CvMat bad_jac_c3 = cvMat(bad_jac_cpp3);
bad_caller = caller;
bad_caller.src = &bad_src_c1;
@ -403,15 +403,15 @@ protected:
bad_caller.jacobian = &bad_jac_c3;
errors += run_test_case( CV_StsBadSize, "Bad jacobian format", bad_caller );
Mat bad_src_cpp2(1, 1, CV_32F); CvMat bad_src_c2 = bad_src_cpp2;
Mat bad_src_cpp2(1, 1, CV_32F); CvMat bad_src_c2 = cvMat(bad_src_cpp2);
bad_caller = caller;
bad_caller.src = &bad_src_c2;
errors += run_test_case( CV_StsBadSize, "Bad src format", bad_caller );
Mat bad_dst_cpp2(2, 1, CV_32F); CvMat bad_dst_c2 = bad_dst_cpp2;
Mat bad_dst_cpp3(3, 2, CV_32F); CvMat bad_dst_c3 = bad_dst_cpp3;
Mat bad_dst_cpp4(3, 3, CV_32FC2); CvMat bad_dst_c4 = bad_dst_cpp4;
Mat bad_dst_cpp2(2, 1, CV_32F); CvMat bad_dst_c2 = cvMat(bad_dst_cpp2);
Mat bad_dst_cpp3(3, 2, CV_32F); CvMat bad_dst_c3 = cvMat(bad_dst_cpp3);
Mat bad_dst_cpp4(3, 3, CV_32FC2); CvMat bad_dst_c4 = cvMat(bad_dst_cpp4);
bad_caller = caller;
bad_caller.dst = &bad_dst_c2;
@ -427,11 +427,11 @@ protected:
/********/
src_cpp.create(3, 3, CV_32F); src_c = src_cpp;
dst_cpp.create(3, 1, CV_32F); dst_c = dst_cpp;
src_cpp.create(3, 3, CV_32F); src_c = cvMat(src_cpp);
dst_cpp.create(3, 1, CV_32F); dst_c = cvMat(dst_cpp);
Mat bad_dst_cpp5(5, 5, CV_32F); CvMat bad_dst_c5 = bad_dst_cpp5;
Mat bad_dst_cpp5(5, 5, CV_32F); CvMat bad_dst_c5 = cvMat(bad_dst_cpp5);
bad_caller = caller;
bad_caller.dst = &bad_dst_c5;
@ -488,15 +488,7 @@ protected:
void run(int /* start_from */ )
{
CvMat zeros;
#if defined __GNUC__ && __GNUC__ >= 8
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wclass-memaccess"
#endif
memset(&zeros, 0, sizeof(zeros));
#if defined __GNUC__ && __GNUC__ >= 8
#pragma GCC diagnostic pop
#endif
CvMat zeros = CvMat();
C_Caller caller, bad_caller;
CvMat objectPoints_c, r_vec_c, t_vec_c, A_c, distCoeffs_c, imagePoints_c,
@ -504,24 +496,24 @@ protected:
const int n = 10;
Mat imagePoints_cpp(1, n, CV_32FC2); imagePoints_c = imagePoints_cpp;
Mat imagePoints_cpp(1, n, CV_32FC2); imagePoints_c = cvMat(imagePoints_cpp);
Mat objectPoints_cpp(1, n, CV_32FC3);
randu(objectPoints_cpp, Scalar::all(1), Scalar::all(10));
objectPoints_c = objectPoints_cpp;
objectPoints_c = cvMat(objectPoints_cpp);
Mat t_vec_cpp(Mat::zeros(1, 3, CV_32F)); t_vec_c = t_vec_cpp;
Mat t_vec_cpp(Mat::zeros(1, 3, CV_32F)); t_vec_c = cvMat(t_vec_cpp);
Mat r_vec_cpp(3, 1, CV_32F);
cvtest::Rodrigues(Mat::eye(3, 3, CV_32F), r_vec_cpp); r_vec_c = r_vec_cpp;
cvtest::Rodrigues(Mat::eye(3, 3, CV_32F), r_vec_cpp); r_vec_c = cvMat(r_vec_cpp);
Mat A_cpp = camMat.clone(); A_c = A_cpp;
Mat distCoeffs_cpp = distCoeffs.clone(); distCoeffs_c = distCoeffs_cpp;
Mat A_cpp = camMat.clone(); A_c = cvMat(A_cpp);
Mat distCoeffs_cpp = distCoeffs.clone(); distCoeffs_c = cvMat(distCoeffs_cpp);
Mat dpdr_cpp(2*n, 3, CV_32F); dpdr_c = dpdr_cpp;
Mat dpdt_cpp(2*n, 3, CV_32F); dpdt_c = dpdt_cpp;
Mat dpdf_cpp(2*n, 2, CV_32F); dpdf_c = dpdf_cpp;
Mat dpdc_cpp(2*n, 2, CV_32F); dpdc_c = dpdc_cpp;
Mat dpdk_cpp(2*n, 4, CV_32F); dpdk_c = dpdk_cpp;
Mat dpdr_cpp(2*n, 3, CV_32F); dpdr_c = cvMat(dpdr_cpp);
Mat dpdt_cpp(2*n, 3, CV_32F); dpdt_c = cvMat(dpdt_cpp);
Mat dpdf_cpp(2*n, 2, CV_32F); dpdf_c = cvMat(dpdf_cpp);
Mat dpdc_cpp(2*n, 2, CV_32F); dpdc_c = cvMat(dpdc_cpp);
Mat dpdk_cpp(2*n, 4, CV_32F); dpdk_c = cvMat(dpdk_cpp);
caller.aspectRatio = 1.0;
caller.objectPoints = &objectPoints_c;
@ -561,9 +553,9 @@ protected:
errors += run_test_case( CV_StsBadArg, "Zero imagePoints", bad_caller );
/****************************/
Mat bad_r_vec_cpp1(r_vec_cpp.size(), CV_32S); CvMat bad_r_vec_c1 = bad_r_vec_cpp1;
Mat bad_r_vec_cpp2(2, 2, CV_32F); CvMat bad_r_vec_c2 = bad_r_vec_cpp2;
Mat bad_r_vec_cpp3(r_vec_cpp.size(), CV_32FC2); CvMat bad_r_vec_c3 = bad_r_vec_cpp3;
Mat bad_r_vec_cpp1(r_vec_cpp.size(), CV_32S); CvMat bad_r_vec_c1 = cvMat(bad_r_vec_cpp1);
Mat bad_r_vec_cpp2(2, 2, CV_32F); CvMat bad_r_vec_c2 = cvMat(bad_r_vec_cpp2);
Mat bad_r_vec_cpp3(r_vec_cpp.size(), CV_32FC2); CvMat bad_r_vec_c3 = cvMat(bad_r_vec_cpp3);
bad_caller = caller;
bad_caller.r_vec = &bad_r_vec_c1;
@ -578,9 +570,9 @@ protected:
errors += run_test_case( CV_StsBadArg, "Bad rvec format", bad_caller );
/****************************/
Mat bad_t_vec_cpp1(t_vec_cpp.size(), CV_32S); CvMat bad_t_vec_c1 = bad_t_vec_cpp1;
Mat bad_t_vec_cpp2(2, 2, CV_32F); CvMat bad_t_vec_c2 = bad_t_vec_cpp2;
Mat bad_t_vec_cpp3(1, 1, CV_32FC2); CvMat bad_t_vec_c3 = bad_t_vec_cpp3;
Mat bad_t_vec_cpp1(t_vec_cpp.size(), CV_32S); CvMat bad_t_vec_c1 = cvMat(bad_t_vec_cpp1);
Mat bad_t_vec_cpp2(2, 2, CV_32F); CvMat bad_t_vec_c2 = cvMat(bad_t_vec_cpp2);
Mat bad_t_vec_cpp3(1, 1, CV_32FC2); CvMat bad_t_vec_c3 = cvMat(bad_t_vec_cpp3);
bad_caller = caller;
bad_caller.t_vec = &bad_t_vec_c1;
@ -595,8 +587,8 @@ protected:
errors += run_test_case( CV_StsBadArg, "Bad tvec format", bad_caller );
/****************************/
Mat bad_A_cpp1(A_cpp.size(), CV_32S); CvMat bad_A_c1 = bad_A_cpp1;
Mat bad_A_cpp2(2, 2, CV_32F); CvMat bad_A_c2 = bad_A_cpp2;
Mat bad_A_cpp1(A_cpp.size(), CV_32S); CvMat bad_A_c1 = cvMat(bad_A_cpp1);
Mat bad_A_cpp2(2, 2, CV_32F); CvMat bad_A_c2 = cvMat(bad_A_cpp2);
bad_caller = caller;
bad_caller.A = &bad_A_c1;
@ -607,9 +599,9 @@ protected:
errors += run_test_case( CV_StsBadArg, "Bad A format", bad_caller );
/****************************/
Mat bad_distCoeffs_cpp1(distCoeffs_cpp.size(), CV_32S); CvMat bad_distCoeffs_c1 = bad_distCoeffs_cpp1;
Mat bad_distCoeffs_cpp2(2, 2, CV_32F); CvMat bad_distCoeffs_c2 = bad_distCoeffs_cpp2;
Mat bad_distCoeffs_cpp3(1, 7, CV_32F); CvMat bad_distCoeffs_c3 = bad_distCoeffs_cpp3;
Mat bad_distCoeffs_cpp1(distCoeffs_cpp.size(), CV_32S); CvMat bad_distCoeffs_c1 = cvMat(bad_distCoeffs_cpp1);
Mat bad_distCoeffs_cpp2(2, 2, CV_32F); CvMat bad_distCoeffs_c2 = cvMat(bad_distCoeffs_cpp2);
Mat bad_distCoeffs_cpp3(1, 7, CV_32F); CvMat bad_distCoeffs_c3 = cvMat(bad_distCoeffs_cpp3);
bad_caller = caller;
bad_caller.distCoeffs = &zeros;
@ -629,9 +621,9 @@ protected:
/****************************/
Mat bad_dpdr_cpp1(dpdr_cpp.size(), CV_32S); CvMat bad_dpdr_c1 = bad_dpdr_cpp1;
Mat bad_dpdr_cpp2(dpdr_cpp.cols+1, 3, CV_32F); CvMat bad_dpdr_c2 = bad_dpdr_cpp2;
Mat bad_dpdr_cpp3(dpdr_cpp.cols, 7, CV_32F); CvMat bad_dpdr_c3 = bad_dpdr_cpp3;
Mat bad_dpdr_cpp1(dpdr_cpp.size(), CV_32S); CvMat bad_dpdr_c1 = cvMat(bad_dpdr_cpp1);
Mat bad_dpdr_cpp2(dpdr_cpp.cols+1, 3, CV_32F); CvMat bad_dpdr_c2 = cvMat(bad_dpdr_cpp2);
Mat bad_dpdr_cpp3(dpdr_cpp.cols, 7, CV_32F); CvMat bad_dpdr_c3 = cvMat(bad_dpdr_cpp3);
bad_caller = caller;
bad_caller.dpdr = &zeros;
@ -669,7 +661,7 @@ protected:
/****************************/
Mat bad_dpdf_cpp2(dpdr_cpp.cols+1, 2, CV_32F); CvMat bad_dpdf_c2 = bad_dpdf_cpp2;
Mat bad_dpdf_cpp2(dpdr_cpp.cols+1, 2, CV_32F); CvMat bad_dpdf_c2 = cvMat(bad_dpdf_cpp2);
bad_caller = caller;
bad_caller.dpdf = &zeros;

@ -78,9 +78,9 @@ protected:
findChessboardCorners(img, pattern_size, corners, flags);
else
if (!drawCorners)
cvFindChessboardCorners( &arr, pattern_size, out_corners, out_corner_count, flags );
cvFindChessboardCorners( &arr, cvSize(pattern_size), out_corners, out_corner_count, flags );
else
cvDrawChessboardCorners( &drawCorImg, pattern_size,
cvDrawChessboardCorners( &drawCorImg, cvSize(pattern_size),
(CvPoint2D32f*)(corners.empty() ? 0 : &corners[0]),
(int)corners.size(), was_found);
}
@ -128,14 +128,14 @@ void CV_ChessboardDetectorBadArgTest::run( int /*start_from */)
drawCorners = false;
img = cb.clone();
arr = img;
arr = cvMat(img);
out_corner_count = 0;
out_corners = 0;
errors += run_test_case( CV_StsNullPtr, "Null pointer to corners" );
drawCorners = true;
Mat cvdrawCornImg(img.size(), CV_8UC2);
drawCorImg = cvdrawCornImg;
drawCorImg = cvMat(cvdrawCornImg);
was_found = true;
errors += run_test_case( CV_StsUnsupportedFormat, "2 channel image" );

@ -96,7 +96,7 @@ void CV_ChessboardDetectorTimingTest::run( int start_from )
{
int count0 = -1;
int count = 0;
CvSize pattern_size;
Size pattern_size;
int result, result1 = 0;
const char* imgname = cvReadString((CvFileNode*)cvGetSeqElem(board_list->data.seq,idx*4), "dummy.txt");
@ -110,7 +110,7 @@ void CV_ChessboardDetectorTimingTest::run( int start_from )
filename = cv::format("%s%s", filepath.c_str(), imgname );
cv::Mat img2 = cv::imread( filename );
img = img2;
img = cvIplImage(img2);
if( img2.empty() )
{
@ -135,11 +135,11 @@ void CV_ChessboardDetectorTimingTest::run( int start_from )
v = (CvPoint2D32f*)_v->data.fl;
int64 _time0 = cvGetTickCount();
result = cvCheckChessboard(gray, pattern_size);
result = cvCheckChessboard(gray, cvSize(pattern_size));
int64 _time01 = cvGetTickCount();
OPENCV_CALL( result1 = cvFindChessboardCorners(
gray, pattern_size, v, &count, 15 ));
gray, cvSize(pattern_size), v, &count, 15 ));
int64 _time1 = cvGetTickCount();
if( result != is_chessboard )

@ -180,7 +180,7 @@ void CV_ChessboardSubpixelTest::run( int )
break;
}
IplImage chessboard_image_header = chessboard_image;
IplImage chessboard_image_header = cvIplImage(chessboard_image);
cvFindCornerSubPix(&chessboard_image_header, (CvPoint2D32f*)&test_corners[0],
(int)test_corners.size(), cvSize(3, 3), cvSize(1, 1), cvTermCriteria(CV_TERMCRIT_EPS|CV_TERMCRIT_ITER,300,0.1));
find4QuadCornerSubpix(chessboard_image, test_corners, Size(5, 5));

@ -351,9 +351,9 @@ static int cvTsRodrigues( const CvMat* src, CvMat* dst, CvMat* jacobian )
{
CV_Assert(src.data != dst.data && "Inplace is not supported");
CV_Assert(!dst.empty() && "'dst' must be allocated");
CvMat _src = src, _dst = dst, _jac;
CvMat _src = cvMat(src), _dst = cvMat(dst), _jac;
if( jac )
_jac = *jac;
_jac = cvMat(*jac);
cvTsRodrigues(&_src, &_dst, jac ? &_jac : 0);
}
@ -667,13 +667,13 @@ void CV_RodriguesTest::run_func()
if( calc_jacobians )
{
v2m_jac = test_mat[OUTPUT][1];
m2v_jac = test_mat[OUTPUT][3];
v2m_jac = cvMat(test_mat[OUTPUT][1]);
m2v_jac = cvMat(test_mat[OUTPUT][3]);
}
if( !test_cpp )
{
CvMat _input = test_mat[INPUT][0], _output = test_mat[OUTPUT][0], _output2 = test_mat[OUTPUT][2];
CvMat _input = cvMat(test_mat[INPUT][0]), _output = cvMat(test_mat[OUTPUT][0]), _output2 = cvMat(test_mat[OUTPUT][2]);
cvRodrigues2( &_input, &_output, calc_jacobians ? &v2m_jac : 0 );
cvRodrigues2( &_output, &_output2, calc_jacobians ? &m2v_jac : 0 );
}
@ -980,8 +980,8 @@ int CV_FundamentalMatTest::prepare_test_case( int test_case_idx )
void CV_FundamentalMatTest::run_func()
{
// cvFindFundamentalMat calls cv::findFundamentalMat
CvMat _input0 = test_mat[INPUT][0], _input1 = test_mat[INPUT][1];
CvMat F = test_mat[TEMP][0], mask = test_mat[TEMP][1];
CvMat _input0 = cvMat(test_mat[INPUT][0]), _input1 = cvMat(test_mat[INPUT][1]);
CvMat F = cvMat(test_mat[TEMP][0]), mask = cvMat(test_mat[TEMP][1]);
f_result = cvFindFundamentalMat( &_input0, &_input1, &F, method, MAX(sigma*3, 0.01), 0, &mask );
}
@ -1543,7 +1543,7 @@ void CV_ConvertHomogeneousTest::fill_array( int /*test_case_idx*/, int /*i*/, in
void CV_ConvertHomogeneousTest::run_func()
{
CvMat _input = test_mat[INPUT][0], _output = test_mat[OUTPUT][0];
CvMat _input = cvMat(test_mat[INPUT][0]), _output = cvMat(test_mat[OUTPUT][0]);
cvConvertPointsHomogeneous( &_input, &_output );
}
@ -1678,7 +1678,7 @@ void CV_ComputeEpilinesTest::fill_array( int test_case_idx, int i, int j, Mat& a
void CV_ComputeEpilinesTest::run_func()
{
CvMat _points = test_mat[INPUT][0], _F = test_mat[INPUT][1], _lines = test_mat[OUTPUT][0];
CvMat _points = cvMat(test_mat[INPUT][0]), _F = cvMat(test_mat[INPUT][1]), _lines = cvMat(test_mat[OUTPUT][0]);
cvComputeCorrespondEpilines( &_points, which_image, &_F, &_lines );
}

@ -124,7 +124,7 @@ protected:
Mat_<out3d_t> _3dImg(disp.size());
CvMat cvdisp = disp; CvMat cv_3dImg = _3dImg; CvMat cvQ = Q;
CvMat cvdisp = cvMat(disp); CvMat cv_3dImg = cvMat(_3dImg); CvMat cvQ = cvMat(Q);
cvReprojectImageTo3D( &cvdisp, &cv_3dImg, &cvQ, handleMissingValues );
if (std::numeric_limits<OutT>::max() == std::numeric_limits<float>::max())

@ -410,7 +410,7 @@ void CV_UndistortPointsTest::prepare_to_validation(int /*test_case_idx*/)
{
if (useDstMat)
{
CvMat temp = dst_points_mat;
CvMat temp = cvMat(dst_points_mat);
for (int i=0;i<N_POINTS*2;i++)
{
points[i] = temp.data.fl[i];
@ -469,14 +469,14 @@ void CV_UndistortPointsTest::run_func()
}
else
{
CvMat _input0 = test_mat[INPUT][0], _input1 = test_mat[INPUT][1], _input2, _input3, _input4;
CvMat _output = test_mat[TEMP][0];
CvMat _input0 = cvMat(test_mat[INPUT][0]), _input1 = cvMat(test_mat[INPUT][1]), _input2, _input3, _input4;
CvMat _output = cvMat(test_mat[TEMP][0]);
if(!zero_distortion)
_input2 = test_mat[INPUT][2];
_input2 = cvMat(test_mat[INPUT][2]);
if(!zero_R)
_input3 = test_mat[INPUT][3];
_input3 = cvMat(test_mat[INPUT][3]);
if(!zero_new_cam)
_input4 = test_mat[INPUT][4];
_input4 = cvMat(test_mat[INPUT][4]);
cvUndistortPoints(&_input0, &_output, &_input1,
zero_distortion ? 0 : &_input2,
zero_R ? 0 : &_input3,
@ -853,10 +853,10 @@ void CV_InitUndistortRectifyMapTest::prepare_to_validation(int/* test_case_idx*/
CvMat _new_cam = cvMat(test_mat[INPUT][4].rows,test_mat[INPUT][4].cols,CV_64F,new_cam);
CvMat _points= cvMat(test_mat[INPUT][0].rows,test_mat[INPUT][0].cols,CV_64FC2,points);
CvMat _input1 = test_mat[INPUT][1];
CvMat _input2 = test_mat[INPUT][2];
CvMat _input3 = test_mat[INPUT][3];
CvMat _input4 = test_mat[INPUT][4];
CvMat _input1 = cvMat(test_mat[INPUT][1]);
CvMat _input2 = cvMat(test_mat[INPUT][2]);
CvMat _input3 = cvMat(test_mat[INPUT][3]);
CvMat _input4 = cvMat(test_mat[INPUT][4]);
cvtest::convert(cvarrToMat(&_input1), cvarrToMat(&_camera), -1);
cvtest::convert(cvarrToMat(&_input2), cvarrToMat(&_distort), -1);
@ -871,8 +871,8 @@ void CV_InitUndistortRectifyMapTest::prepare_to_validation(int/* test_case_idx*/
}
cv::Mat map1,map2;
cv::convertMaps(mapx,mapy,map1,map2,CV_32FC1);
CvMat _map1 = map1;
CvMat _map2 = map2;
CvMat _map1 = cvMat(map1);
CvMat _map2 = cvMat(map2);
for (int i=0;i<N_POINTS;i++)
{
double u = test_mat[INPUT][0].ptr<double>()[2*i];
@ -886,7 +886,7 @@ void CV_InitUndistortRectifyMapTest::prepare_to_validation(int/* test_case_idx*/
cvUndistortPoints(&_points,&ref_points,&_camera,
zero_distortion ? 0 : &_distort, zero_R ? 0 : &_rot, zero_new_cam ? &_camera : &_new_cam);
//cvTsDistortPoints(&_points,&ref_points,&_camera,&_distort,&_rot,&_new_cam);
CvMat dst = test_mat[REF_OUTPUT][0];
CvMat dst = cvMat(test_mat[REF_OUTPUT][0]);
cvtest::convert(cvarrToMat(&ref_points), cvarrToMat(&dst), -1);
cvtest::copy(test_mat[INPUT][0],test_mat[OUTPUT][0]);
@ -912,13 +912,13 @@ void CV_InitUndistortRectifyMapTest::run_func()
}
else
{
CvMat input1 = test_mat[INPUT][1], input2, input3, input4;
CvMat input1 = cvMat(test_mat[INPUT][1]), input2, input3, input4;
if( !zero_distortion )
input2 = test_mat[INPUT][2];
input2 = cvMat(test_mat[INPUT][2]);
if( !zero_R )
input3 = test_mat[INPUT][3];
input3 = cvMat(test_mat[INPUT][3]);
if( !zero_new_cam )
input4 = test_mat[INPUT][4];
input4 = cvMat(test_mat[INPUT][4]);
cvInitUndistortRectifyMap(&input1,
zero_distortion ? 0 : &input2,
zero_R ? 0 : &input3,

@ -3064,7 +3064,7 @@ template<typename _Tp> inline void Seq<_Tp>::copyTo(std::vector<_Tp>& vec, const
size_t len = !seq ? 0 : range == Range::all() ? seq->total : range.end - range.start;
vec.resize(len);
if( seq && len )
cvCvtSeqToArray(seq, &vec[0], range);
cvCvtSeqToArray(seq, &vec[0], cvSlice(range));
}
template<typename _Tp> inline Seq<_Tp>::operator std::vector<_Tp>() const

@ -44,7 +44,9 @@
#ifndef OPENCV_CORE_TYPES_H
#define OPENCV_CORE_TYPES_H
#if !defined(__OPENCV_BUILD) && !defined(CV__DISABLE_C_API_CTORS)
#define CV__ENABLE_C_API_CTORS // enable C API ctors (must be removed)
#endif
//#define CV__VALIDATE_UNUNITIALIZED_VARS 1 // C++11 & GCC only

@ -1017,7 +1017,7 @@ cvGetRawData( const CvArr* arr, uchar** data, int* step, CvSize* roi_size )
*data = mat->data.ptr;
if( roi_size )
*roi_size = cvGetMatSize( mat );
*roi_size = cvSize(cvGetMatSize( mat ));
}
else if( CV_IS_IMAGE( arr ))
{
@ -1218,7 +1218,7 @@ cvGetDimSize( const CvArr* arr, int index )
CV_IMPL CvSize
cvGetSize( const CvArr* arr )
{
CvSize size;
CvSize size = {0, 0};
if( CV_IS_MAT_HDR_Z( arr ))
{
@ -1918,7 +1918,7 @@ cvPtrND( const CvArr* arr, const int* idx, int* _type,
CV_IMPL CvScalar
cvGet1D( const CvArr* arr, int idx )
{
CvScalar scalar(0);
CvScalar scalar = cvScalar();
int type = 0;
uchar* ptr;
@ -1953,7 +1953,7 @@ cvGet1D( const CvArr* arr, int idx )
CV_IMPL CvScalar
cvGet2D( const CvArr* arr, int y, int x )
{
CvScalar scalar(0);
CvScalar scalar = cvScalar();
int type = 0;
uchar* ptr;
@ -1987,7 +1987,7 @@ cvGet2D( const CvArr* arr, int y, int x )
CV_IMPL CvScalar
cvGet3D( const CvArr* arr, int z, int y, int x )
{
CvScalar scalar(0);
CvScalar scalar = cvScalar();
int type = 0;
uchar* ptr;
@ -2009,7 +2009,7 @@ cvGet3D( const CvArr* arr, int z, int y, int x )
CV_IMPL CvScalar
cvGetND( const CvArr* arr, const int* idx )
{
CvScalar scalar(0);
CvScalar scalar = cvScalar();
int type = 0;
uchar* ptr;
@ -2916,15 +2916,7 @@ cvInitImageHeader( IplImage * image, CvSize size, int depth,
if( !image )
CV_Error( CV_HeaderIsNull, "null pointer to header" );
#if defined __GNUC__ && __GNUC__ >= 8
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wclass-memaccess"
#endif
memset( image, 0, sizeof( *image ));
#if defined __GNUC__ && __GNUC__ >= 8
#pragma GCC diagnostic pop
#endif
image->nSize = sizeof( *image );
*image = cvIplImage();
icvGetColorModel( channels, &colorModel, &channelSeq );
for (int i = 0; i < 4; i++)
@ -3081,7 +3073,7 @@ cvResetImageROI( IplImage* image )
CV_IMPL CvRect
cvGetImageROI( const IplImage* img )
{
CvRect rect;
CvRect rect = {0, 0, 0, 0};
if( !img )
CV_Error( CV_StsNullPtr, "Null pointer to image" );

@ -226,7 +226,7 @@ CV_IMPL void cvSetIdentity( CvArr* arr, CvScalar value )
CV_IMPL CvScalar cvTrace( const CvArr* arr )
{
return cv::trace(cv::cvarrToMat(arr));
return cvScalar(cv::trace(cv::cvarrToMat(arr)));
}

@ -452,12 +452,12 @@ void write( FileStorage& fs, const String& name, const Mat& value )
{
if( value.dims <= 2 )
{
CvMat mat = value;
CvMat mat = cvMat(value);
cvWrite( *fs, name.size() ? name.c_str() : 0, &mat );
}
else
{
CvMatND mat = value;
CvMatND mat = cvMatND(value);
cvWrite( *fs, name.size() ? name.c_str() : 0, &mat );
}
}

@ -31,7 +31,7 @@ static void icvWriteMat( CvFileStorage* fs, const char* name, const void* struct
{
const CvMat* mat = (const CvMat*)struct_ptr;
char dt[16];
CvSize size;
cv::Size size;
int y;
assert( CV_IS_MAT_HDR_Z(mat) );
@ -380,7 +380,7 @@ static void icvWriteImage( CvFileStorage* fs, const char* name, const void* stru
{
const IplImage* image = (const IplImage*)struct_ptr;
char dt_buf[16], *dt;
CvSize size;
cv::Size size;
int y, depth;
assert( CV_IS_IMAGE(image) );
@ -435,7 +435,7 @@ static void* icvReadImage( CvFileStorage* fs, CvFileNode* node )
CvFileNode* data;
CvFileNode* roi_node;
CvSeqReader reader;
CvRect roi;
cv::Rect roi;
int y, width, height, elem_type, coi, depth;
const char* origin, *data_order;
@ -472,7 +472,7 @@ static void* icvReadImage( CvFileStorage* fs, CvFileNode* node )
roi.height = cvReadIntByName( fs, roi_node, "height", 0 );
coi = cvReadIntByName( fs, roi_node, "coi", 0 );
cvSetImageROI( image, roi );
cvSetImageROI( image, cvRect(roi) );
cvSetImageCOI( image, coi );
}

@ -17,7 +17,7 @@ CV_IMPL CvScalar cvSum( const CvArr* srcarr )
sum = cv::Scalar(sum[coi-1]);
}
}
return sum;
return cvScalar(sum);
}
CV_IMPL int cvCountNonZero( const CvArr* imgarr )
@ -43,7 +43,7 @@ cvAvg( const void* imgarr, const void* maskarr )
mean = cv::Scalar(mean[coi-1]);
}
}
return mean;
return cvScalar(mean);
}

@ -214,7 +214,7 @@ protected:
}
CvMat* m = (CvMat*)fs["test_mat"].readObj();
CvMat _test_mat = test_mat;
CvMat _test_mat = cvMat(test_mat);
double max_diff = 0;
CvMat stub1, _test_stub1;
cvReshape(m, &stub1, 1, 0);
@ -234,7 +234,7 @@ protected:
cvReleaseMat(&m);
CvMatND* m_nd = (CvMatND*)fs["test_mat_nd"].readObj();
CvMatND _test_mat_nd = test_mat_nd;
CvMatND _test_mat_nd = cvMatND(test_mat_nd);
if( !m_nd || !CV_IS_MATND(m_nd) )
{
@ -263,7 +263,7 @@ protected:
MatND mat_nd2;
fs["test_mat_nd"] >> mat_nd2;
CvMatND m_nd2 = mat_nd2;
CvMatND m_nd2 = cvMatND(mat_nd2);
cvGetMat(&m_nd2, &stub, 0, 1);
cvReshape(&stub, &stub1, 1, 0);

@ -415,15 +415,15 @@ TEST(Core_PCA, accuracy)
#ifdef CHECK_C
// 4. check C PCA & ROW
_points = rPoints;
_testPoints = rTestPoints;
_avg = avg;
_eval = eval;
_evec = evec;
_points = cvMat(rPoints);
_testPoints = cvMat(rTestPoints);
_avg = cvMat(avg);
_eval = cvMat(eval);
_evec = cvMat(evec);
prjTestPoints.create(rTestPoints.rows, maxComponents, rTestPoints.type() );
backPrjTestPoints.create(rPoints.size(), rPoints.type() );
_prjTestPoints = prjTestPoints;
_backPrjTestPoints = backPrjTestPoints;
_prjTestPoints = cvMat(prjTestPoints);
_backPrjTestPoints = cvMat(backPrjTestPoints);
cvCalcPCA( &_points, &_avg, &_eval, &_evec, CV_PCA_DATA_AS_ROW );
cvProjectPCA( &_testPoints, &_avg, &_evec, &_prjTestPoints );
@ -435,13 +435,13 @@ TEST(Core_PCA, accuracy)
ASSERT_LE(err, diffBackPrjEps) << "bad accuracy of cvBackProjectPCA() (CV_PCA_DATA_AS_ROW)";
// 5. check C PCA & COL
_points = cPoints;
_testPoints = cTestPoints;
avg = avg.t(); _avg = avg;
eval = eval.t(); _eval = eval;
evec = evec.t(); _evec = evec;
prjTestPoints = prjTestPoints.t(); _prjTestPoints = prjTestPoints;
backPrjTestPoints = backPrjTestPoints.t(); _backPrjTestPoints = backPrjTestPoints;
_points = cvMat(cPoints);
_testPoints = cvMat(cTestPoints);
avg = avg.t(); _avg = cvMat(avg);
eval = eval.t(); _eval = cvMat(eval);
evec = evec.t(); _evec = cvMat(evec);
prjTestPoints = prjTestPoints.t(); _prjTestPoints = cvMat(prjTestPoints);
backPrjTestPoints = backPrjTestPoints.t(); _backPrjTestPoints = cvMat(backPrjTestPoints);
cvCalcPCA( &_points, &_avg, &_eval, &_evec, CV_PCA_DATA_AS_COL );
cvProjectPCA( &_testPoints, &_avg, &_evec, &_prjTestPoints );
@ -615,7 +615,7 @@ void Core_ArrayOpTest::run( int /* start_from */)
{
int sz3[] = {5, 10, 15};
MatND A(3, sz3, CV_32F), B(3, sz3, CV_16SC4);
CvMatND matA = A, matB = B;
CvMatND matA = cvMatND(A), matB = cvMatND(B);
RNG rng;
rng.fill(A, CV_RAND_UNI, Scalar::all(-10), Scalar::all(10));
rng.fill(B, CV_RAND_UNI, Scalar::all(-10), Scalar::all(10));
@ -625,8 +625,8 @@ void Core_ArrayOpTest::run( int /* start_from */)
Scalar val1(-1000, 30, 3, 8);
cvSetRealND(&matA, idx0, val0);
cvSetReal3D(&matA, idx1[0], idx1[1], idx1[2], -val0);
cvSetND(&matB, idx0, val1);
cvSet3D(&matB, idx1[0], idx1[1], idx1[2], -val1);
cvSetND(&matB, idx0, cvScalar(val1));
cvSet3D(&matB, idx1[0], idx1[1], idx1[2], cvScalar(-val1));
Ptr<CvMatND> matC(cvCloneMatND(&matB));
if( A.at<float>(idx0[0], idx0[1], idx0[2]) != val0 ||

@ -526,7 +526,7 @@ void Core_CrossProductTest::get_test_array_types_and_sizes( int,
RNG& rng = ts->get_rng();
int depth = cvtest::randInt(rng) % 2 + CV_32F;
int cn = cvtest::randInt(rng) & 1 ? 3 : 1, type = CV_MAKETYPE(depth, cn);
CvSize sz;
Size sz;
types[INPUT][0] = types[INPUT][1] = types[OUTPUT][0] = types[REF_OUTPUT][0] = type;
@ -549,7 +549,7 @@ void Core_CrossProductTest::run_func()
void Core_CrossProductTest::prepare_to_validation( int )
{
CvScalar a(0), b(0), c(0);
cv::Scalar a, b, c;
if( test_mat[INPUT][0].rows > 1 )
{
@ -595,7 +595,7 @@ void Core_CrossProductTest::prepare_to_validation( int )
}
else
{
cvSet1D( test_array[REF_OUTPUT][0], 0, c );
cvSet1D( test_array[REF_OUTPUT][0], 0, cvScalar(c) );
}
}
@ -896,7 +896,7 @@ double Core_TransformTest::get_success_error_level( int test_case_idx, int i, in
void Core_TransformTest::run_func()
{
CvMat _m = test_mat[INPUT][1], _shift = test_mat[INPUT][2];
CvMat _m = cvMat(test_mat[INPUT][1]), _shift = cvMat(test_mat[INPUT][2]);
cvTransform( test_array[INPUT][0], test_array[OUTPUT][0], &_m, _shift.data.ptr ? &_shift : 0);
}
@ -1010,7 +1010,7 @@ double Core_PerspectiveTransformTest::get_success_error_level( int test_case_idx
void Core_PerspectiveTransformTest::run_func()
{
CvMat _m = test_mat[INPUT][1];
CvMat _m = cvMat(test_mat[INPUT][1]);
cvPerspectiveTransform( test_array[INPUT][0], test_array[OUTPUT][0], &_m );
}
@ -1117,7 +1117,7 @@ static void cvTsPerspectiveTransform( const CvArr* _src, CvArr* _dst, const CvMa
void Core_PerspectiveTransformTest::prepare_to_validation( int )
{
CvMat transmat = test_mat[INPUT][1];
CvMat transmat = cvMat(test_mat[INPUT][1]);
cvTsPerspectiveTransform( test_array[INPUT][0], test_array[REF_OUTPUT][0], &transmat );
}
@ -1287,9 +1287,9 @@ int Core_CovarMatrixTest::prepare_test_case( int test_case_idx )
if( single_matrix )
{
if( !are_images )
*((CvMat*)_hdr_data) = test_mat[INPUT][0];
*((CvMat*)_hdr_data) = cvMat(test_mat[INPUT][0]);
else
*((IplImage*)_hdr_data) = test_mat[INPUT][0];
*((IplImage*)_hdr_data) = cvIplImage(test_mat[INPUT][0]);
temp_hdrs[0] = _hdr_data;
}
else
@ -1304,9 +1304,9 @@ int Core_CovarMatrixTest::prepare_test_case( int test_case_idx )
part = test_mat[INPUT][0].col(i);
if( !are_images )
*((CvMat*)ptr) = part;
*((CvMat*)ptr) = cvMat(part);
else
*((IplImage*)ptr) = part;
*((IplImage*)ptr) = cvIplImage(part);
temp_hdrs[i] = ptr;
}
@ -1539,7 +1539,7 @@ static double cvTsLU( CvMat* a, CvMat* b=NULL, CvMat* x=NULL, int* rank=0 )
void Core_DetTest::prepare_to_validation( int )
{
test_mat[INPUT][0].convertTo(test_mat[TEMP][0], test_mat[TEMP][0].type());
CvMat temp0 = test_mat[TEMP][0];
CvMat temp0 = cvMat(test_mat[TEMP][0]);
test_mat[REF_OUTPUT][0].at<Scalar>(0,0) = cvRealScalar(cvTsLU(&temp0, 0, 0));
}
@ -1676,7 +1676,7 @@ void Core_InvertTest::prepare_to_validation( int )
Mat& temp1 = test_mat[TEMP][1];
Mat& dst0 = test_mat[REF_OUTPUT][0];
Mat& dst = test_mat[OUTPUT][0];
CvMat _input = input;
CvMat _input = cvMat(input);
double ratio = 0, det = cvTsSVDet( &_input, &ratio );
double threshold = (input.depth() == CV_32F ? FLT_EPSILON : DBL_EPSILON)*1000;
@ -1733,7 +1733,7 @@ void Core_SolveTest::get_test_array_types_and_sizes( int test_case_idx, vector<v
RNG& rng = ts->get_rng();
int bits = cvtest::randInt(rng);
Base::get_test_array_types_and_sizes( test_case_idx, sizes, types );
CvSize in_sz = sizes[INPUT][0];
CvSize in_sz = cvSize(sizes[INPUT][0]);
if( in_sz.width > in_sz.height )
in_sz = cvSize(in_sz.height, in_sz.width);
Base::get_test_array_types_and_sizes( test_case_idx, sizes, types );
@ -1813,14 +1813,14 @@ void Core_SolveTest::prepare_to_validation( int )
Mat& temp1 = test_mat[TEMP][1];
cvtest::convert(input, temp1, temp1.type());
dst = Scalar::all(0);
CvMat _temp1 = temp1;
CvMat _temp1 = cvMat(temp1);
double det = cvTsLU( &_temp1, 0, 0 );
dst0 = Scalar::all(det != 0);
return;
}
double threshold = (input.type() == CV_32F ? FLT_EPSILON : DBL_EPSILON)*1000;
CvMat _input = input;
CvMat _input = cvMat(input);
double ratio = 0, det = cvTsSVDet( &_input, &ratio );
if( det < threshold || ratio < threshold )
{
@ -2105,7 +2105,7 @@ void Core_SVBkSbTest::get_test_array_types_and_sizes( int test_case_idx, vector<
int bits = cvtest::randInt(rng);
Base::get_test_array_types_and_sizes( test_case_idx, sizes, types );
int min_size, i, m, n;
CvSize b_size;
cv::Size b_size;
min_size = MIN( sizes[INPUT][0].width, sizes[INPUT][0].height );
@ -2122,7 +2122,7 @@ void Core_SVBkSbTest::get_test_array_types_and_sizes( int test_case_idx, vector<
n = sizes[INPUT][0].width;
sizes[INPUT][1] = Size(0,0);
b_size = Size(m,m);
b_size = cvSize(m, m);
if( have_b )
{
sizes[INPUT][1].height = sizes[INPUT][0].height;
@ -2174,7 +2174,7 @@ int Core_SVBkSbTest::prepare_test_case( int test_case_idx )
cvtest::copy( temp, input );
}
CvMat _input = input;
CvMat _input = cvMat(input);
cvSVD( &_input, test_array[TEMP][0], test_array[TEMP][1], test_array[TEMP][2], flags );
}
@ -2210,7 +2210,7 @@ void Core_SVBkSbTest::prepare_to_validation( int )
Size w_size = compact ? Size(min_size,min_size) : Size(m,n);
Mat& w = test_mat[TEMP][0];
Mat wdb( w_size.height, w_size.width, CV_64FC1 );
CvMat _w = w, _wdb = wdb;
CvMat _w = cvMat(w), _wdb = cvMat(wdb);
// use exactly the same threshold as in icvSVD... ,
// so the changes in the library and here should be synchronized.
double threshold = cv::sum(w)[0]*(DBL_EPSILON*2);//(is_float ? FLT_EPSILON*10 : DBL_EPSILON*2);

@ -970,7 +970,7 @@ bool CV_OperationsTest::operations1()
Size sz(10, 20);
if (sz.area() != 200) throw test_excep();
if (sz.width != 10 || sz.height != 20) throw test_excep();
if (((CvSize)sz).width != 10 || ((CvSize)sz).height != 20) throw test_excep();
if (cvSize(sz).width != 10 || cvSize(sz).height != 20) throw test_excep();
Vec<double, 5> v5d(1, 1, 1, 1, 1);
Vec<double, 6> v6d(1, 1, 1, 1, 1, 1);

@ -356,7 +356,7 @@ void cv::imshow( const String& winname, InputArray _img )
CV_Assert(size.width>0 && size.height>0);
{
Mat img = _img.getMat();
CvMat c_img = img;
CvMat c_img = cvMat(img);
cvShowImage(winname.c_str(), &c_img);
}
#else

@ -1755,8 +1755,8 @@ static gboolean icvOnMouse( GtkWidget *widget, GdkEvent *event, gpointer user_da
{
// TODO move this logic to CvImageWidget
CvWindow* window = (CvWindow*)user_data;
CvPoint2D32f pt32f(-1., -1.);
CvPoint pt(-1,-1);
CvPoint2D32f pt32f = {-1., -1.};
CvPoint pt = {-1,-1};
int cv_event = -1, state = 0, flags = 0;
CvImageWidget * image_widget = CV_IMAGE_WIDGET( widget );

@ -487,7 +487,7 @@ imread_( const String& filename, int flags, int hdrtype, Mat* mat=0 )
}
else
{
image = cvCreateImage( size, cvIplDepth(type), CV_MAT_CN(type) );
image = cvCreateImage(cvSize(size), cvIplDepth(type), CV_MAT_CN(type));
temp = cvarrToMat( image );
}
@ -834,7 +834,7 @@ imdecode_( const Mat& buf, int flags, int hdrtype, Mat* mat=0 )
}
else
{
image = cvCreateImage( size, cvIplDepth(type), CV_MAT_CN(type) );
image = cvCreateImage(cvSize(size), cvIplDepth(type), CV_MAT_CN(type));
temp = cvarrToMat(image);
}

@ -652,7 +652,7 @@ cvConvertImage( const CvArr* srcarr, CvArr* dstarr, int flags )
uchar *s = src->data.ptr, *d = dst->data.ptr;
int s_step = src->step, d_step = dst->step;
int code = src_cn*10 + dst_cn;
CvSize size(src->cols, src->rows);
CvSize size = {src->cols, src->rows};
if( CV_IS_MAT_CONT(src->type & dst->type) )
{

@ -1036,9 +1036,10 @@ CV_INLINE void cvEllipseBox( CvArr* img, CvBox2D box, CvScalar color,
int thickness CV_DEFAULT(1),
int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) )
{
CvSize axes;
axes.width = cvRound(box.size.width*0.5);
axes.height = cvRound(box.size.height*0.5);
CvSize axes = cvSize(
cvRound(box.size.width*0.5),
cvRound(box.size.height*0.5)
);
cvEllipse( img, cvPointFrom32f( box.center ), axes, box.angle,
0, 360, color, thickness, line_type, shift );

@ -135,7 +135,7 @@ CvSeq* icvApproximateChainTC89( CvChain* chain, int header_size,
Determines support region for all the remained points */
do
{
CvPoint pt0;
cv::Point2i pt0;
int k, l = 0, d_num = 0;
i = (int)(current - array);

@ -49,7 +49,7 @@
(deltas)[6] = (step), (deltas)[7] = (step) + (nch))
static const CvPoint icvCodeDeltas[8] =
{ CvPoint(1, 0), CvPoint(1, -1), CvPoint(0, -1), CvPoint(-1, -1), CvPoint(-1, 0), CvPoint(-1, 1), CvPoint(0, 1), CvPoint(1, 1) };
{ {1, 0}, {1, -1}, {0, -1}, {-1, -1}, {-1, 0}, {-1, 1}, {0, 1}, {1, 1} };
CV_IMPL void
cvStartReadChainPoints( CvChain * chain, CvChainPtReader * reader )
@ -77,19 +77,15 @@ cvStartReadChainPoints( CvChain * chain, CvChainPtReader * reader )
CV_IMPL CvPoint
cvReadChainPoint( CvChainPtReader * reader )
{
schar *ptr;
int code;
CvPoint pt;
if( !reader )
CV_Error( CV_StsNullPtr, "" );
pt = reader->pt;
cv::Point2i pt = reader->pt;
ptr = reader->ptr;
if( ptr )
schar *ptr = reader->ptr;
if (ptr)
{
code = *ptr++;
int code = *ptr++;
if( ptr >= reader->block_max )
{
@ -104,7 +100,7 @@ cvReadChainPoint( CvChainPtReader * reader )
reader->pt.y = pt.y + icvCodeDeltas[code].y;
}
return pt;
return cvPoint(pt);
}
@ -209,14 +205,7 @@ cvStartFindContours_Impl( void* _img, CvMemStorage* storage,
CV_Error( CV_StsBadSize, "" );
CvContourScanner scanner = (CvContourScanner)cvAlloc( sizeof( *scanner ));
#if defined __GNUC__ && __GNUC__ >= 8
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wclass-memaccess"
#endif
memset( scanner, 0, sizeof(*scanner) );
#if defined __GNUC__ && __GNUC__ >= 8
#pragma GCC diagnostic pop
#endif
scanner->storage1 = scanner->storage2 = storage;
scanner->img0 = (schar *) img;
@ -700,7 +689,7 @@ icvFetchContourEx( schar* ptr,
int deltas[MAX_SIZE];
CvSeqWriter writer;
schar *i0 = ptr, *i1, *i3, *i4 = NULL;
CvRect rect;
cv::Rect rect;
int prev_s = -1, s, s_end;
int method = _method - 1;
@ -810,14 +799,14 @@ icvFetchContourEx( schar* ptr,
cvEndWriteSeq( &writer );
if( _method != CV_CHAIN_CODE )
((CvContour*)contour)->rect = rect;
((CvContour*)contour)->rect = cvRect(rect);
CV_DbgAssert( (writer.seq->total == 0 && writer.seq->first == 0) ||
writer.seq->total > writer.seq->first->count ||
(writer.seq->first->prev == writer.seq->first &&
writer.seq->first->next == writer.seq->first) );
if( _rect ) *_rect = rect;
if( _rect ) *_rect = cvRect(rect);
}
@ -888,7 +877,7 @@ icvFetchContourEx_32s( int* ptr,
int deltas[MAX_SIZE];
CvSeqWriter writer;
int *i0 = ptr, *i1, *i3, *i4;
CvRect rect;
cv::Rect rect;
int prev_s = -1, s, s_end;
int method = _method - 1;
const int right_flag = INT_MIN;
@ -1000,14 +989,14 @@ icvFetchContourEx_32s( int* ptr,
cvEndWriteSeq( &writer );
if( _method != CV_CHAIN_CODE )
((CvContour*)contour)->rect = rect;
((CvContour*)contour)->rect = cvRect(rect);
CV_DbgAssert( (writer.seq->total == 0 && writer.seq->first == 0) ||
writer.seq->total > writer.seq->first->count ||
(writer.seq->first->prev == writer.seq->first &&
writer.seq->first->next == writer.seq->first) );
if( _rect ) *_rect = rect;
if (_rect) *_rect = cvRect(rect);
}
@ -1035,7 +1024,7 @@ cvFindNextContour( CvContourScanner scanner )
int width = scanner->img_size.width;
int height = scanner->img_size.height;
int mode = scanner->mode;
CvPoint lnbd = scanner->lnbd;
cv::Point2i lnbd = scanner->lnbd;
int nbd = scanner->nbd;
int prev = img[x - 1];
int new_mask = -2;
@ -1125,7 +1114,7 @@ cvFindNextContour( CvContourScanner scanner )
_CvContourInfo *par_info = 0;
CvSeq *seq = 0;
int is_hole = 0;
CvPoint origin;
cv::Point2i origin;
/* if not external contour */
if( (!img_i && !(prev == 0 && p == 1)) ||
@ -1259,7 +1248,7 @@ cvFindNextContour( CvContourScanner scanner )
l_cinfo->is_hole = is_hole;
l_cinfo->contour = seq;
l_cinfo->origin = origin;
l_cinfo->origin = cvPoint(origin);
l_cinfo->parent = par_info;
if( scanner->approx_method1 != scanner->approx_method2 )
@ -1292,7 +1281,7 @@ cvFindNextContour( CvContourScanner scanner )
scanner->l_cinfo = l_cinfo;
scanner->pt.x = !img_i ? x + 1 : x + 1 - is_hole;
scanner->pt.y = y;
scanner->lnbd = lnbd;
scanner->lnbd = cvPoint(lnbd);
scanner->img = (schar *) img;
scanner->nbd = nbd;
return l_cinfo->contour;
@ -1480,7 +1469,7 @@ icvFindContoursInInterval( const CvArr* src,
uchar* src_data = 0;
int img_step = 0;
CvSize img_size;
cv::Size img_size;
int connect_flag;
int lower_total;
@ -1529,7 +1518,7 @@ icvFindContoursInInterval( const CvArr* src,
CV_Error( CV_StsBadArg, "Input array must be 8uC1 or 8sC1" );
src_data = mat->data.ptr;
img_step = mat->step;
img_size = cvGetMatSize( mat );
img_size = cvGetMatSize(mat);
// Create temporary sequences
runs = cvCreateSeq(0, sizeof(CvSeq), sizeof(CvLinkedRunPoint), storage00 );
@ -1550,7 +1539,7 @@ icvFindContoursInInterval( const CvArr* src,
tmp_prev = upper_line;
for( j = 0; j < img_size.width; )
{
j = findStartContourPoint(src_data, img_size, j, haveSIMD);
j = findStartContourPoint(src_data, cvSize(img_size), j, haveSIMD);
if( j == img_size.width )
break;
@ -1560,7 +1549,7 @@ icvFindContoursInInterval( const CvArr* src,
tmp_prev->next = (CvLinkedRunPoint*)CV_GET_WRITTEN_ELEM( writer );
tmp_prev = tmp_prev->next;
j = findEndContourPoint(src_data, img_size, j + 1, haveSIMD);
j = findEndContourPoint(src_data, cvSize(img_size), j + 1, haveSIMD);
tmp.pt.x = j - 1;
CV_WRITE_SEQ_ELEM( tmp, writer );
@ -1584,7 +1573,7 @@ icvFindContoursInInterval( const CvArr* src,
all_total = runs->total;
for( j = 0; j < img_size.width; )
{
j = findStartContourPoint(src_data, img_size, j, haveSIMD);
j = findStartContourPoint(src_data, cvSize(img_size), j, haveSIMD);
if( j == img_size.width ) break;
@ -1593,7 +1582,7 @@ icvFindContoursInInterval( const CvArr* src,
tmp_prev->next = (CvLinkedRunPoint*)CV_GET_WRITTEN_ELEM( writer );
tmp_prev = tmp_prev->next;
j = findEndContourPoint(src_data, img_size, j + 1, haveSIMD);
j = findEndContourPoint(src_data, cvSize(img_size), j + 1, haveSIMD);
tmp.pt.x = j - 1;
CV_WRITE_SEQ_ELEM( tmp, writer );
@ -1908,11 +1897,11 @@ void cv::findContours( InputOutputArray _image, OutputArrayOfArrays _contours,
image = image0;
}
MemStorage storage(cvCreateMemStorage());
CvMat _cimage = image;
CvMat _cimage = cvMat(image);
CvSeq* _ccontours = 0;
if( _hierarchy.needed() )
_hierarchy.clear();
cvFindContours_Impl(&_cimage, storage, &_ccontours, sizeof(CvContour), mode, method, offset + offset0, 0);
cvFindContours_Impl(&_cimage, storage, &_ccontours, sizeof(CvContour), mode, method, cvPoint(offset0 + offset), 0);
if( !_ccontours )
{
_contours.clear();

@ -2479,7 +2479,7 @@ void cv::drawContours( InputOutputArray _image, InputArrayOfArrays _contours,
CV_INSTRUMENT_REGION()
Mat image = _image.getMat(), hierarchy = _hierarchy.getMat();
CvMat _cimage = image;
CvMat _cimage = cvMat(image);
size_t ncontours = _contours.total();
size_t i = 0, first = 0, last = ncontours;
@ -2548,8 +2548,8 @@ void cv::drawContours( InputOutputArray _image, InputArrayOfArrays _contours,
}
}
cvDrawContours( &_cimage, &seq[first], color, color, contourIdx >= 0 ?
-maxLevel : maxLevel, thickness, lineType, offset );
cvDrawContours( &_cimage, &seq[first], cvScalar(color), cvScalar(color), contourIdx >= 0 ?
-maxLevel : maxLevel, thickness, lineType, cvPoint(offset) );
}
@ -2560,11 +2560,6 @@ static const int CodeDeltas[8][2] =
#define CV_ADJUST_EDGE_COUNT( count, seq ) \
((count) -= ((count) == (seq)->total && !CV_IS_SEQ_CLOSED(seq)))
#if defined __GNUC__ && __GNUC__ >= 8
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wclass-memaccess"
#endif
CV_IMPL void
cvDrawContours( void* _img, CvSeq* contour,
CvScalar _externalColor, CvScalar _holeColor,
@ -2658,14 +2653,14 @@ cvDrawContours( void* _img, CvSeq* contour,
int shift = 0;
count -= !CV_IS_SEQ_CLOSED(contour);
CV_READ_SEQ_ELEM( pt1, reader );
{ CvPoint pt_ = CV_STRUCT_INITIALIZER; CV_READ_SEQ_ELEM(pt_, reader); pt1 = pt_; }
pt1 += offset;
if( thickness < 0 )
pts.push_back(pt1);
for( i = 0; i < count; i++ )
{
CV_READ_SEQ_ELEM( pt2, reader );
{ CvPoint pt_ = CV_STRUCT_INITIALIZER; CV_READ_SEQ_ELEM(pt_, reader); pt2 = pt_; }
pt2 += offset;
if( thickness >= 0 )
cv::ThickLine( img, pt1, pt2, clr, thickness, line_type, 2, shift );
@ -2707,7 +2702,7 @@ cvEllipse2Poly( CvPoint center, CvSize axes, int angle,
CV_IMPL CvScalar
cvColorToScalar( double packed_color, int type )
{
CvScalar scalar;
cv::Scalar scalar;
if( CV_MAT_DEPTH( type ) == CV_8U )
{
@ -2765,7 +2760,7 @@ cvColorToScalar( double packed_color, int type )
}
}
return scalar;
return cvScalar(scalar);
}
CV_IMPL int
@ -2893,11 +2888,7 @@ cvGetTextSize( const char *text, const CvFont *_font, CvSize *_size, int *_base_
cv::Size size = cv::getTextSize( text, _font->font_face, (_font->hscale + _font->vscale)*0.5,
_font->thickness, _base_line );
if( _size )
*_size = size;
*_size = cvSize(size);
}
#if defined __GNUC__ && __GNUC__ >= 8
#pragma GCC diagnostic pop // "-Wclass-memaccess"
#endif
/* End of file. */

@ -1156,15 +1156,15 @@ float cv::EMD( InputArray _signature1, InputArray _signature2,
Mat signature1 = _signature1.getMat(), signature2 = _signature2.getMat();
Mat cost = _cost.getMat(), flow;
CvMat _csignature1 = signature1;
CvMat _csignature2 = signature2;
CvMat _ccost = cost, _cflow;
CvMat _csignature1 = cvMat(signature1);
CvMat _csignature2 = cvMat(signature2);
CvMat _ccost = cvMat(cost), _cflow;
if( _flow.needed() )
{
_flow.create(signature1.rows, signature2.rows, CV_32F);
flow = _flow.getMat();
flow = Scalar::all(0);
_cflow = flow;
_cflow = cvMat(flow);
}
return cvCalcEMD2( &_csignature1, &_csignature2, distType, 0, cost.empty() ? 0 : &_ccost,

@ -534,7 +534,7 @@ cvGoodFeaturesToTrack( const void* _image, void*, void*,
size_t i, ncorners = corners.size();
for( i = 0; i < ncorners; i++ )
_corners[i] = corners[i];
_corners[i] = cvPoint2D32f(corners[i]);
*_corner_count = (int)ncorners;
}

@ -641,15 +641,8 @@ cvFloodFill( CvArr* arr, CvPoint seed_point,
CvScalar newVal, CvScalar lo_diff, CvScalar up_diff,
CvConnectedComp* comp, int flags, CvArr* maskarr )
{
#if defined __GNUC__ && __GNUC__ >= 8
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wclass-memaccess"
#endif
if( comp )
memset( comp, 0, sizeof(*comp) );
#if defined __GNUC__ && __GNUC__ >= 8
#pragma GCC diagnostic pop
#endif
cv::Mat img = cv::cvarrToMat(arr), mask = cv::cvarrToMat(maskarr);
int area = cv::floodFill(img, mask, seed_point, newVal,

@ -46,7 +46,7 @@ cvMaxRect( const CvRect* rect1, const CvRect* rect2 )
{
if( rect1 && rect2 )
{
CvRect max_rect;
cv::Rect max_rect;
int a, b;
max_rect.x = a = rect1->x;
@ -72,7 +72,7 @@ cvMaxRect( const CvRect* rect1, const CvRect* rect2 )
if( max_rect.height < b )
max_rect.height = b;
max_rect.height -= max_rect.y;
return max_rect;
return cvRect(max_rect);
}
else if( rect1 )
return *rect1;

@ -2445,7 +2445,7 @@ cvGetMinMaxHistValue( const CvHistogram* hist,
if( !CV_IS_SPARSE_HIST(hist) )
{
CvMat mat;
CvPoint minPt, maxPt;
CvPoint minPt = {0, 0}, maxPt = {0, 0};
cvGetMat( hist->bins, &mat, 0, 1 );
cvMinMaxLoc( &mat, &minVal, &maxVal, &minPt, &maxPt );
@ -2969,7 +2969,7 @@ cvCalcArrBackProjectPatch( CvArr** arr, CvArr* dst, CvSize patch_size, CvHistogr
CvMat dststub, *dstmat;
int i, dims;
int x, y;
CvSize size;
cv::Size size;
if( !CV_IS_HIST(hist))
CV_Error( CV_StsBadArg, "Bad histogram pointer" );

@ -815,7 +815,7 @@ CV_IMPL void cvMoments( const CvArr* arr, CvMoments* moments, int binary )
src = cv::cvarrToMat(arr);
cv::Moments m = cv::moments(src, binary != 0);
CV_Assert( moments != 0 );
*moments = m;
*moments = cvMoments(m);
}

@ -1683,7 +1683,7 @@ cvCreatePyramid( const CvArr* srcarr, int extra_layers, double rate,
CV_Error( CV_StsOutOfRange, "The number of extra layers must be non negative" );
int i, layer_step, elem_size = CV_ELEM_SIZE(src->type);
CvSize layer_size, size = cvGetMatSize(src);
cv::Size layer_size, size = cvGetMatSize(src);
if( bufarr )
{

@ -401,7 +401,7 @@ cvMinAreaRect2( const CvArr* array, CvMemStorage* /*storage*/ )
cv::Mat points = cv::cvarrToMat(array, false, false, 0, &abuf);
cv::RotatedRect rr = cv::minAreaRect(points);
return (CvBox2D)rr;
return cvBox2D(rr);
}
void cv::boxPoints(cv::RotatedRect box, OutputArray _pts)

@ -969,7 +969,7 @@ cvMinEnclosingCircle( const void* array, CvPoint2D32f * _center, float *_radius
cv::minEnclosingCircle(points, center, radius);
if(_center)
*_center = center;
*_center = cvPoint2D32f(center);
if(_radius)
*_radius = radius;
return 1;
@ -1009,8 +1009,8 @@ icvMemCopy( double **buf1, double **buf2, double **buf3, int *b_max )
/* area of a contour sector */
static double icvContourSecArea( CvSeq * contour, CvSlice slice )
{
CvPoint pt; /* pointer to points */
CvPoint pt_s, pt_e; /* first and last points */
cv::Point pt; /* pointer to points */
cv::Point pt_s, pt_e; /* first and last points */
CvSeqReader reader; /* points reader of contour */
int p_max = 2, p_ind;
@ -1044,10 +1044,10 @@ static double icvContourSecArea( CvSeq * contour, CvSlice slice )
cvStartReadSeq( contour, &reader, 0 );
cvSetSeqReaderPos( &reader, slice.start_index );
CV_READ_SEQ_ELEM( pt_s, reader );
{ CvPoint pt_s_ = CV_STRUCT_INITIALIZER; CV_READ_SEQ_ELEM(pt_s_, reader); pt_s = pt_s_; }
p_ind = 0;
cvSetSeqReaderPos( &reader, slice.end_index );
CV_READ_SEQ_ELEM( pt_e, reader );
{ CvPoint pt_e_ = CV_STRUCT_INITIALIZER; CV_READ_SEQ_ELEM(pt_e_, reader); pt_e = pt_e_; }
/* normal coefficients */
nx = pt_s.y - pt_e.y;
@ -1056,7 +1056,7 @@ static double icvContourSecArea( CvSeq * contour, CvSlice slice )
while( lpt-- > 0 )
{
CV_READ_SEQ_ELEM( pt, reader );
{ CvPoint pt_ = CV_STRUCT_INITIALIZER; CV_READ_SEQ_ELEM(pt_, reader); pt = pt_; }
if( flag == 0 )
{
@ -1294,14 +1294,14 @@ cvFitEllipse2( const CvArr* array )
{
cv::AutoBuffer<double> abuf;
cv::Mat points = cv::cvarrToMat(array, false, false, 0, &abuf);
return cv::fitEllipse(points);
return cvBox2D(cv::fitEllipse(points));
}
/* Calculates bounding rectagnle of a point set or retrieves already calculated */
CV_IMPL CvRect
cvBoundingRect( CvArr* array, int update )
{
CvRect rect;
cv::Rect rect;
CvContour contour_header;
CvSeq* ptseq = 0;
CvSeqBlock block;
@ -1343,16 +1343,16 @@ cvBoundingRect( CvArr* array, int update )
if( mat )
{
rect = cv::maskBoundingRect(cv::cvarrToMat(mat));
rect = cvRect(cv::maskBoundingRect(cv::cvarrToMat(mat)));
}
else if( ptseq->total )
{
cv::AutoBuffer<double> abuf;
rect = cv::pointSetBoundingRect(cv::cvarrToMat(ptseq, false, false, 0, &abuf));
rect = cvRect(cv::pointSetBoundingRect(cv::cvarrToMat(ptseq, false, false, 0, &abuf)));
}
if( update )
((CvContour*)ptseq)->rect = rect;
return rect;
((CvContour*)ptseq)->rect = cvRect(rect);
return cvRect(rect);
}
/* End of file. */

@ -567,14 +567,14 @@ void cv::undistortPoints( InputArray _src, OutputArray _dst,
_dst.create(src.size(), src.type(), -1, true);
Mat dst = _dst.getMat();
CvMat _csrc = src, _cdst = dst, _ccameraMatrix = cameraMatrix;
CvMat _csrc = cvMat(src), _cdst = cvMat(dst), _ccameraMatrix = cvMat(cameraMatrix);
CvMat matR, matP, _cdistCoeffs, *pR=0, *pP=0, *pD=0;
if( !R.empty() )
pR = &(matR = R);
pR = &(matR = cvMat(R));
if( !P.empty() )
pP = &(matP = P);
pP = &(matP = cvMat(P));
if( !distCoeffs.empty() )
pD = &(_cdistCoeffs = distCoeffs);
pD = &(_cdistCoeffs = cvMat(distCoeffs));
cvUndistortPointsInternal(&_csrc, &_cdst, &_ccameraMatrix, pD, pR, pP, criteria);
}

@ -126,10 +126,10 @@ bool CV_ApproxPolyTest::get_contour( int /*type*/, CvSeq** Seq, int* d,
int i;
CvSeq* seq;
int total = cvtest::randInt(rng) % 1000 + 1;
CvPoint center;
Point center;
int radius, angle;
double deg_to_rad = CV_PI/180.;
CvPoint pt;
Point pt;
center.x = cvtest::randInt( rng ) % 1000;
center.y = cvtest::randInt( rng ) % 1000;
@ -166,7 +166,7 @@ int CV_ApproxPolyTest::check_slice( CvPoint StartPt, CvPoint EndPt,
int* _j, int Count )
{
///////////
CvPoint Pt;
Point Pt;
///////////
bool flag;
double dy,dx;
@ -208,7 +208,7 @@ int CV_ApproxPolyTest::check_slice( CvPoint StartPt, CvPoint EndPt,
/////// find start point and check distance ////////
for( j = *_j; j < Count; j++ )
{
CV_READ_SEQ_ELEM( Pt, *SrcReader );
{ CvPoint pt_ = CV_STRUCT_INITIALIZER; CV_READ_SEQ_ELEM(pt_, *SrcReader); Pt = pt_; }
if( StartPt.x == Pt.x && StartPt.y == Pt.y ) break;
else
{
@ -230,7 +230,7 @@ int CV_ApproxPolyTest::check( CvSeq* SrcSeq, CvSeq* DstSeq, float Eps )
//////////
CvSeqReader DstReader;
CvSeqReader SrcReader;
CvPoint StartPt, EndPt;
CvPoint StartPt = {0, 0}, EndPt = {0, 0};
///////////
int TotalErrors = 0;
///////////

@ -65,7 +65,7 @@ protected:
int min_log_img_width, max_log_img_width;
int min_log_img_height, max_log_img_height;
CvSize img_size;
Size img_size;
int count, count2;
IplImage* img[NUM_IMG];
@ -170,9 +170,9 @@ cvTsGenerateBlobImage( IplImage* img, int min_blob_size, int max_blob_size,
RNG& rng )
{
int i;
CvSize size;
Size size;
assert( img->depth == IPL_DEPTH_8U && img->nChannels == 1 );
CV_Assert(img->depth == IPL_DEPTH_8U && img->nChannels == 1);
cvZero( img );
@ -182,8 +182,8 @@ cvTsGenerateBlobImage( IplImage* img, int min_blob_size, int max_blob_size,
for( i = 0; i < blob_count; i++ )
{
CvPoint center;
CvSize axes;
Point center;
Size axes;
int angle = cvtest::randInt(rng) % 180;
int brightness = cvtest::randInt(rng) %
(max_brightness - min_brightness) + min_brightness;
@ -195,7 +195,7 @@ cvTsGenerateBlobImage( IplImage* img, int min_blob_size, int max_blob_size,
axes.height = (cvtest::randInt(rng) %
(max_blob_size - min_blob_size) + min_blob_size + 1)/2;
cvEllipse( img, center, axes, angle, 0, 360, cvScalar(brightness), CV_FILLED );
cvEllipse( img, cvPoint(center), cvSize(axes), angle, 0, 360, cvScalar(brightness), CV_FILLED );
}
cvResetImageROI( img );
@ -246,7 +246,7 @@ int CV_FindContourTest::prepare_test_case( int test_case_idx )
storage = cvCreateMemStorage( 1 << 10 );
for( i = 0; i < NUM_IMG; i++ )
img[i] = cvCreateImage( img_size, 8, 1 );
img[i] = cvCreateImage( cvSize(img_size), 8, 1 );
cvTsGenerateBlobImage( img[0], min_blob_size, max_blob_size,
blob_count, min_brightness, max_brightness, rng );
@ -376,8 +376,8 @@ int CV_FindContourTest::validate_test_results( int /*test_case_idx*/ )
for(int i = 0; i < seq1->total; i++ )
{
CvPoint pt1;
CvPoint pt2;
CvPoint pt1 = {0, 0};
CvPoint pt2 = {0, 0};
CV_READ_SEQ_ELEM( pt1, reader1 );
CV_READ_SEQ_ELEM( pt2, reader2 );

@ -77,6 +77,13 @@ cvTsDist( CvPoint2D32f a, CvPoint2D32f b )
double dy = a.y - b.y;
return sqrt(dx*dx + dy*dy);
}
CV_INLINE double
cvTsDist( const Point2f& a, const Point2f& b )
{
double dx = a.x - b.x;
double dy = a.y - b.y;
return sqrt(dx*dx + dy*dy);
}
CV_INLINE double
cvTsPtLineDist( CvPoint2D32f pt, CvPoint2D32f a, CvPoint2D32f b )
@ -95,7 +102,7 @@ static double
cvTsPointPolygonTest( CvPoint2D32f pt, const CvPoint2D32f* vv, int n, int* _idx=0, int* _on_edge=0 )
{
int i;
CvPoint2D32f v = vv[n-1], v0;
Point2f v = vv[n-1], v0;
double min_dist_num = FLT_MAX, min_dist_denom = 1;
int min_dist_idx = -1, min_on_edge = 0;
int counter = 0;
@ -169,9 +176,9 @@ cvTsMiddlePoint(const cv::Point2f &a, const cv::Point2f &b)
static bool
cvTsIsPointOnLineSegment(const cv::Point2f &x, const cv::Point2f &a, const cv::Point2f &b)
{
double d1 = cvTsDist(CvPoint2D32f(x.x, x.y), CvPoint2D32f(a.x, a.y));
double d2 = cvTsDist(CvPoint2D32f(x.x, x.y), CvPoint2D32f(b.x, b.y));
double d3 = cvTsDist(CvPoint2D32f(a.x, a.y), CvPoint2D32f(b.x, b.y));
double d1 = cvTsDist(cvPoint2D32f(x.x, x.y), cvPoint2D32f(a.x, a.y));
double d2 = cvTsDist(cvPoint2D32f(x.x, x.y), cvPoint2D32f(b.x, b.y));
double d3 = cvTsDist(cvPoint2D32f(a.x, a.y), cvPoint2D32f(b.x, b.y));
return (abs(d1 + d2 - d3) <= (1E-5));
}
@ -207,7 +214,7 @@ protected:
void* points;
void* result;
double low_high_range;
CvScalar low, high;
Scalar low, high;
bool test_cpp;
};
@ -694,7 +701,7 @@ void CV_MinAreaRectTest::run_func()
else
{
cv::RotatedRect r = cv::minAreaRect(cv::cvarrToMat(points));
box = (CvBox2D)r;
box = cvBox2D(r);
r.points((cv::Point2f*)box_pt);
}
}
@ -938,7 +945,7 @@ protected:
void run_func(void);
int validate_test_results( int test_case_idx );
CvPoint2D32f center;
Point2f center;
float radius;
};
@ -951,7 +958,11 @@ CV_MinCircleTest::CV_MinCircleTest()
void CV_MinCircleTest::run_func()
{
if(!test_cpp)
cvMinEnclosingCircle( points, &center, &radius );
{
CvPoint2D32f c_center = cvPoint2D32f(center);
cvMinEnclosingCircle( points, &c_center, &radius );
center = c_center;
}
else
{
cv::Point2f tmpcenter;
@ -966,8 +977,8 @@ int CV_MinCircleTest::validate_test_results( int test_case_idx )
double eps = 1.03;
int code = CV_BaseShapeDescrTest::validate_test_results( test_case_idx );
int i, j = 0, point_count = points2->rows + points2->cols - 1;
CvPoint2D32f *p = (CvPoint2D32f*)(points2->data.ptr);
CvPoint2D32f v[3];
Point2f *p = (Point2f*)(points2->data.ptr);
Point2f v[3];
#if 0
{
@ -989,7 +1000,7 @@ int CV_MinCircleTest::validate_test_results( int test_case_idx )
// remember at most 3 points that are close to the boundary
for( i = 0; i < point_count; i++ )
{
double d = cvTsDist( p[i], center );
double d = cvTsDist(p[i], center);
if( d > radius )
{
ts->printf( cvtest::TS::LOG, "The point #%d is outside of the circle\n", i );
@ -1145,7 +1156,8 @@ int CV_PerimeterTest::validate_test_results( int test_case_idx )
int code = CV_BaseShapeDescrTest::validate_test_results( test_case_idx );
int i, len = slice.end_index - slice.start_index, total = points2->cols + points2->rows - 1;
double result0 = 0;
CvPoint2D32f prev_pt, pt, *ptr;
Point2f prev_pt, pt;
CvPoint2D32f *ptr;
if( len < 0 )
len += total;
@ -1195,7 +1207,7 @@ protected:
void generate_point_set( void* points );
void run_func(void);
int validate_test_results( int test_case_idx );
CvBox2D box0, box;
RotatedRect box0, box;
double min_ellipse_size, max_noise;
};
@ -1248,12 +1260,12 @@ void CV_FitEllipseTest::generate_point_set( void* pointsSet )
data = ptm->data.ptr;
}
assert( point_type == CV_32SC2 || point_type == CV_32FC2 );
CV_Assert(point_type == CV_32SC2 || point_type == CV_32FC2);
for( i = 0; i < total; i++ )
{
CvPoint* pp;
CvPoint2D32f p;
CvPoint2D32f p = {0, 0};
double angle = cvtest::randReal(rng)*CV_PI*2;
double x = box0.size.height*0.5*(cos(angle) + (cvtest::randReal(rng)-0.5)*2*max_noise);
double y = box0.size.width*0.5*(sin(angle) + (cvtest::randReal(rng)-0.5)*2*max_noise);
@ -1291,7 +1303,7 @@ void CV_FitEllipseTest::run_func()
if(!test_cpp)
box = cvFitEllipse2( points );
else
box = (CvBox2D)cv::fitEllipse(cv::cvarrToMat(points));
box = cv::fitEllipse(cv::cvarrToMat(points));
}
int CV_FitEllipseTest::validate_test_results( int test_case_idx )
@ -1459,7 +1471,7 @@ void CV_FitEllipseParallelTest::generate_point_set( void* )
void CV_FitEllipseParallelTest::run_func()
{
box = (CvBox2D)cv::fitEllipse(pointsMat);
box = cv::fitEllipse(pointsMat);
}
CV_FitEllipseParallelTest::~CV_FitEllipseParallelTest(){
@ -1704,7 +1716,7 @@ cvTsGenerateTousledBlob( CvPoint2D32f center, CvSize2D32f axes,
for( i = 0; i < total; i++ )
{
CvPoint* pp;
CvPoint2D32f p;
Point2f p;
double phi0 = 2*CV_PI*i/total;
double phi = CV_PI*angle/180.;
@ -1730,7 +1742,7 @@ cvTsGenerateTousledBlob( CvPoint2D32f center, CvSize2D32f axes,
pp->y = cvRound(p.y);
}
else
*(CvPoint2D32f*)pp = p;
*(CvPoint2D32f*)pp = cvPoint2D32f(p);
}
}
@ -1747,11 +1759,11 @@ protected:
int validate_test_results( int test_case_idx );
CvMoments moments0, moments;
double area0, area;
CvSize2D32f axes;
CvPoint2D32f center;
Size2f axes;
Point2f center;
int max_max_r_scale;
double max_r_scale, angle;
CvSize img_size;
Size img_size;
};
@ -1785,7 +1797,7 @@ void CV_ContourMomentsTest::generate_point_set( void* pointsSet )
max_r_scale = cvtest::randReal(rng)*max_max_r_scale*0.01;
angle = cvtest::randReal(rng)*360;
cvTsGenerateTousledBlob( center, axes, max_r_scale, angle, pointsSet, rng );
cvTsGenerateTousledBlob( cvPoint2D32f(center), cvSize2D32f(axes), max_r_scale, angle, pointsSet, rng );
if( points1 )
points1->flags = CV_SEQ_MAGIC_VAL + CV_SEQ_POLYGON;
@ -1811,7 +1823,7 @@ void CV_ContourMomentsTest::run_func()
}
else
{
moments = (CvMoments)cv::moments(cv::cvarrToMat(points));
moments = cvMoments(cv::moments(cv::cvarrToMat(points)));
area = cv::contourArea(cv::cvarrToMat(points));
}
}
@ -1904,13 +1916,13 @@ void CV_PerimeterAreaSliceTest::run( int )
cvClearMemStorage(storage);
CvSeq* contour = cvCreateSeq(CV_SEQ_POLYGON, sizeof(CvSeq), sizeof(CvPoint), storage);
double dphi = CV_PI*2/n;
CvPoint center;
Point center;
center.x = rng.uniform(cvCeil(max_r), cvFloor(640-max_r));
center.y = rng.uniform(cvCeil(max_r), cvFloor(480-max_r));
for( int j = 0; j < n; j++ )
{
CvPoint pt;
CvPoint pt = CV_STRUCT_INITIALIZER;
double r = rng.uniform(min_r, max_r);
double phi = j*dphi;
pt.x = cvRound(center.x + r*cos(phi));
@ -1918,7 +1930,7 @@ void CV_PerimeterAreaSliceTest::run( int )
cvSeqPush(contour, &pt);
}
CvSlice slice;
CvSlice slice = {0, 0};
for(;;)
{
slice.start_index = rng.uniform(-n/2, 3*n/2);

@ -275,7 +275,7 @@ cvTsDistTransform( const CvMat* _src, CvMat* _dst, int dist_type,
void CV_DisTransTest::prepare_to_validation( int /*test_case_idx*/ )
{
CvMat _input = test_mat[INPUT][0], _output = test_mat[REF_OUTPUT][0];
CvMat _input = cvMat(test_mat[INPUT][0]), _output = cvMat(test_mat[REF_OUTPUT][0]);
cvTsDistTransform( &_input, &_output, dist_type, mask_size, mask, 0 );
}

@ -258,7 +258,7 @@ void CV_DrawingTest_C::draw( Mat& _img )
{
CvSize imgSize = cvSize(600, 400);
_img.create( imgSize, CV_8UC3 );
CvMat img = _img;
CvMat img = cvMat(_img);
vector<CvPoint> polyline(4);
polyline[0] = cvPoint(0, 0);
@ -282,7 +282,7 @@ void CV_DrawingTest_C::draw( Mat& _img )
if( cvClipLine(imgSize, &p1, &p2) )
cvCircle( &img, cvPoint(390,100), 10, cvScalar(0,0,255), 3 ); // not draw
p1 = Point(imgSize.width-1,1), p2 = Point(imgSize.width,3);
p1 = cvPoint(imgSize.width-1,1), p2 = cvPoint(imgSize.width,3);
if( cvClipLine(imgSize, &p1, &p2) )
cvEllipse( &img, cvPoint(390,100), cvSize(20,30), 60, 0, 220.0, cvScalar(0,200,0), 4 ); //draw
@ -292,7 +292,7 @@ void CV_DrawingTest_C::draw( Mat& _img )
box.size.width = 200;
box.size.height = 100;
box.angle = 160;
cvEllipseBox( &img, box, Scalar(200,200,255), 5 );
cvEllipseBox( &img, box, cvScalar(200,200,255), 5 );
polyline.resize(9);
pts = &polyline[0];
@ -311,7 +311,7 @@ void CV_DrawingTest_C::draw( Mat& _img )
n = (int)polyline.size();
actualSize = cvEllipse2Poly( cvPoint(500,300), cvSize(50,80), 0, 0, 180, &polyline[0], 10 );
CV_Assert(actualSize == n);
cvPolyLine( &img, &pts, &n, 1, true, Scalar(100,200,100), 20 );
cvPolyLine( &img, &pts, &n, 1, true, cvScalar(100,200,100), 20 );
cvFillConvexPoly( &img, pts, n, cvScalar(0, 80, 0) );
polyline.resize(8);
@ -335,7 +335,7 @@ void CV_DrawingTest_C::draw( Mat& _img )
CvFont font;
cvInitFont( &font, FONT_HERSHEY_SCRIPT_SIMPLEX, 2, 2, 0, 3 );
int baseline = 0;
CvSize textSize;
CvSize textSize = {0, 0};
cvGetTextSize( text1.c_str(), &font, &textSize, &baseline );
baseline += font.thickness;
CvPoint textOrg = cvPoint((imgSize.width - textSize.width)/2, (imgSize.height + textSize.height)/2);
@ -398,7 +398,7 @@ void CV_DrawingTest_C::draw( Mat& _img )
int CV_DrawingTest_C::checkLineIterator( Mat& _img )
{
CvLineIterator it;
CvMat img = _img;
CvMat img = cvMat(_img);
int count = cvInitLineIterator( &img, cvPoint(0,300), cvPoint(1000, 300), &it );
for(int i = 0; i < count; i++ )
{

@ -53,8 +53,8 @@ protected:
int read_params( CvFileStorage* fs );
void get_test_array_types_and_sizes( int test_case_idx, vector<vector<Size> >& sizes, vector<vector<int> >& types );
void get_minmax_bounds( int i, int j, int type, Scalar& low, Scalar& high );
CvSize aperture_size;
CvPoint anchor;
Size aperture_size;
Point anchor;
int max_aperture_size;
bool fp_kernel;
bool inplace;
@ -70,8 +70,8 @@ CV_FilterBaseTest::CV_FilterBaseTest( bool _fp_kernel ) : fp_kernel(_fp_kernel)
test_array[REF_OUTPUT].push_back(NULL);
max_aperture_size = 13;
inplace = false;
aperture_size = cvSize(0,0);
anchor = cvPoint(0,0);
aperture_size = Size(0,0);
anchor = Point(0,0);
element_wise_relative_error = false;
}
@ -420,9 +420,9 @@ double CV_FilterTest::get_success_error_level( int /*test_case_idx*/, int /*i*/,
void CV_FilterTest::run_func()
{
CvMat kernel = test_mat[INPUT][1];
CvMat kernel = cvMat(test_mat[INPUT][1]);
cvFilter2D( test_array[inplace ? OUTPUT : INPUT][0],
test_array[OUTPUT][0], &kernel, anchor );
test_array[OUTPUT][0], &kernel, cvPoint(anchor));
}
@ -1119,7 +1119,7 @@ void CV_PyramidBaseTest::get_test_array_types_and_sizes( int test_case_idx,
const int depthes[] = {CV_8U, CV_16S, CV_16U, CV_32F};
RNG& rng = ts->get_rng();
CvSize sz;
CvSize sz = {0, 0};
CV_FilterBaseTest::get_test_array_types_and_sizes( test_case_idx, sizes, types );
int depth = depthes[cvtest::randInt(rng) % (sizeof(depthes)/sizeof(depthes[0]))];

@ -60,9 +60,9 @@ protected:
void get_timing_test_array_types_and_sizes( int test_case_idx, vector<vector<Size> >& sizes, vector<vector<int> >& types
CvSize** whole_sizes, bool *are_images );
void print_timing_params( int test_case_idx, char* ptr, int params_left );*/
CvPoint seed_pt;
CvScalar new_val;
CvScalar l_diff, u_diff;
Point seed_pt;
Scalar new_val;
Scalar l_diff, u_diff;
int connectivity;
bool use_mask, mask_only;
int range_type;
@ -115,8 +115,8 @@ void CV_FloodFillTest::get_test_array_types_and_sizes( int test_case_idx,
sizes[INPUT_OUTPUT][1] = sizes[REF_INPUT_OUTPUT][1] = cvSize(0,0);
else
{
CvSize sz = sizes[INPUT_OUTPUT][0];
sizes[INPUT_OUTPUT][1] = sizes[REF_INPUT_OUTPUT][1] = cvSize(sz.width+2,sz.height+2);
Size sz = sizes[INPUT_OUTPUT][0];
sizes[INPUT_OUTPUT][1] = sizes[REF_INPUT_OUTPUT][1] = Size(sz.width+2,sz.height+2);
}
seed_pt.x = cvtest::randInt(rng) % sizes[INPUT_OUTPUT][0].width;
@ -194,7 +194,7 @@ void CV_FloodFillTest::run_func()
if(!test_cpp)
{
CvConnectedComp comp;
cvFloodFill( test_array[INPUT_OUTPUT][0], seed_pt, new_val, l_diff, u_diff, &comp,
cvFloodFill( test_array[INPUT_OUTPUT][0], cvPoint(seed_pt), cvScalar(new_val), cvScalar(l_diff), cvScalar(u_diff), &comp,
flags, test_array[INPUT_OUTPUT][1] );
odata[0] = comp.area;
odata[1] = comp.rect.x;
@ -269,7 +269,7 @@ cvTsFloodFill( CvMat* _img, CvPoint seed_pt, CvScalar new_val,
{
Mat m_mask = cvarrToMat(mask);
cvtest::set( m_mask, Scalar::all(0), Mat() );
cvRectangle( mask, cvPoint(0,0), cvPoint(mask->cols-1,mask->rows-1), Scalar::all(1.), 1, 8, 0 );
cvRectangle( mask, cvPoint(0,0), cvPoint(mask->cols-1,mask->rows-1), cvScalar(Scalar::all(1.)), 1, 8, 0 );
}
new_mask_val = (new_mask_val != 0 ? new_mask_val : 1) << 8;
@ -515,9 +515,9 @@ _exit_:
void CV_FloodFillTest::prepare_to_validation( int /*test_case_idx*/ )
{
double* comp = test_mat[REF_OUTPUT][0].ptr<double>();
CvMat _input = test_mat[REF_INPUT_OUTPUT][0];
CvMat _mask = test_mat[REF_INPUT_OUTPUT][1];
cvTsFloodFill( &_input, seed_pt, new_val, l_diff, u_diff,
CvMat _input = cvMat(test_mat[REF_INPUT_OUTPUT][0]);
CvMat _mask = cvMat(test_mat[REF_INPUT_OUTPUT][1]);
cvTsFloodFill( &_input, cvPoint(seed_pt), cvScalar(new_val), cvScalar(l_diff), cvScalar(u_diff),
_mask.data.ptr ? &_mask : 0,
comp, connectivity, range_type,
new_mask_val, mask_only );

@ -1729,15 +1729,15 @@ int CV_CalcBackProjectPatchTest::prepare_test_case( int test_case_idx )
void CV_CalcBackProjectPatchTest::run_func(void)
{
CvMat dst(images[CV_MAX_DIM]);
CvMat dst = cvMat(images[CV_MAX_DIM]);
vector<CvMat > img(cdims);
vector<CvMat*> pimg(cdims);
for(int i = 0; i < cdims; i++)
{
img[i] = CvMat(images[i]);
img[i] = cvMat(images[i]);
pimg[i] = &img[i];
}
cvCalcArrBackProjectPatch( (CvArr**)&pimg[0], &dst, patch_size, hist[0], method, factor );
cvCalcArrBackProjectPatch( (CvArr**)&pimg[0], &dst, cvSize(patch_size), hist[0], method, factor );
}

@ -222,7 +222,7 @@ void CV_ResizeTest::get_test_array_types_and_sizes( int test_case_idx, vector<ve
{
RNG& rng = ts->get_rng();
CV_ImgWarpBaseTest::get_test_array_types_and_sizes( test_case_idx, sizes, types );
CvSize sz;
Size sz;
sz.width = (cvtest::randInt(rng) % sizes[INPUT][0].width) + 1;
sz.height = (cvtest::randInt(rng) % sizes[INPUT][0].height) + 1;
@ -272,7 +272,7 @@ double CV_ResizeTest::get_success_error_level( int /*test_case_idx*/, int /*i*/,
void CV_ResizeTest::prepare_to_validation( int /*test_case_idx*/ )
{
CvMat _src = test_mat[INPUT][0], _dst = test_mat[REF_INPUT_OUTPUT][0];
CvMat _src = cvMat(test_mat[INPUT][0]), _dst = cvMat(test_mat[REF_INPUT_OUTPUT][0]);
CvMat *src = &_src, *dst = &_dst;
int i, j, k;
CvMat* x_idx = cvCreateMat( 1, dst->cols, CV_32SC1 );
@ -504,17 +504,17 @@ CV_WarpAffineTest::CV_WarpAffineTest() : CV_ImgWarpBaseTest( true )
void CV_WarpAffineTest::get_test_array_types_and_sizes( int test_case_idx, vector<vector<Size> >& sizes, vector<vector<int> >& types )
{
CV_ImgWarpBaseTest::get_test_array_types_and_sizes( test_case_idx, sizes, types );
CvSize sz = sizes[INPUT][0];
Size sz = sizes[INPUT][0];
// run for the second time to get output of a different size
CV_ImgWarpBaseTest::get_test_array_types_and_sizes( test_case_idx, sizes, types );
sizes[INPUT][0] = sz;
sizes[INPUT][1] = cvSize( 3, 2 );
sizes[INPUT][1] = Size( 3, 2 );
}
void CV_WarpAffineTest::run_func()
{
CvMat mtx = test_mat[INPUT][1];
CvMat mtx = cvMat(test_mat[INPUT][1]);
cvWarpAffine( test_array[INPUT][0], test_array[INPUT_OUTPUT][0], &mtx, interpolation );
}
@ -533,7 +533,7 @@ int CV_WarpAffineTest::prepare_test_case( int test_case_idx )
const Mat& src = test_mat[INPUT][0];
const Mat& dst = test_mat[INPUT_OUTPUT][0];
Mat& mat = test_mat[INPUT][1];
CvPoint2D32f center;
Point2f center;
double scale, angle;
if( code <= 0 )
@ -615,17 +615,17 @@ CV_WarpPerspectiveTest::CV_WarpPerspectiveTest() : CV_ImgWarpBaseTest( true )
void CV_WarpPerspectiveTest::get_test_array_types_and_sizes( int test_case_idx, vector<vector<Size> >& sizes, vector<vector<int> >& types )
{
CV_ImgWarpBaseTest::get_test_array_types_and_sizes( test_case_idx, sizes, types );
CvSize sz = sizes[INPUT][0];
Size sz = sizes[INPUT][0];
// run for the second time to get output of a different size
CV_ImgWarpBaseTest::get_test_array_types_and_sizes( test_case_idx, sizes, types );
sizes[INPUT][0] = sz;
sizes[INPUT][1] = cvSize( 3, 3 );
sizes[INPUT][1] = Size( 3, 3 );
}
void CV_WarpPerspectiveTest::run_func()
{
CvMat mtx = test_mat[INPUT][1];
CvMat mtx = cvMat(test_mat[INPUT][1]);
cvWarpPerspective( test_array[INPUT][0], test_array[INPUT_OUTPUT][0], &mtx, interpolation );
}
@ -641,8 +641,8 @@ int CV_WarpPerspectiveTest::prepare_test_case( int test_case_idx )
{
RNG& rng = ts->get_rng();
int code = CV_ImgWarpBaseTest::prepare_test_case( test_case_idx );
const CvMat& src = test_mat[INPUT][0];
const CvMat& dst = test_mat[INPUT_OUTPUT][0];
const CvMat src = cvMat(test_mat[INPUT][0]);
const CvMat dst = cvMat(test_mat[INPUT_OUTPUT][0]);
Mat& mat = test_mat[INPUT][1];
Point2f s[4], d[4];
int i;
@ -880,7 +880,7 @@ void CV_UndistortTest::run_func()
{
if (!useCPlus)
{
CvMat a = test_mat[INPUT][1], k = test_mat[INPUT][2];
CvMat a = cvMat(test_mat[INPUT][1]), k = cvMat(test_mat[INPUT][2]);
cvUndistort2( test_array[INPUT][0], test_array[INPUT_OUTPUT][0], &a, &k);
}
else
@ -1024,7 +1024,7 @@ void CV_UndistortMapTest::get_test_array_types_and_sizes( int test_case_idx, vec
cvtest::ArrayTest::get_test_array_types_and_sizes( test_case_idx, sizes, types );
int depth = cvtest::randInt(rng)%2 ? CV_64F : CV_32F;
CvSize sz = sizes[OUTPUT][0];
Size sz = sizes[OUTPUT][0];
types[INPUT][0] = types[INPUT][1] = depth;
dualChannel = cvtest::randInt(rng)%2 == 0;
types[OUTPUT][0] = types[OUTPUT][1] =
@ -1048,7 +1048,7 @@ void CV_UndistortMapTest::fill_array( int test_case_idx, int i, int j, Mat& arr
void CV_UndistortMapTest::run_func()
{
CvMat a = test_mat[INPUT][0], k = test_mat[INPUT][1];
CvMat a = cvMat(test_mat[INPUT][0]), k = cvMat(test_mat[INPUT][1]);
if (!dualChannel )
cvInitUndistortMap( &a, &k, test_array[OUTPUT][0], test_array[OUTPUT][1] );
@ -1189,7 +1189,7 @@ void CV_GetRectSubPixTest::get_test_array_types_and_sizes( int test_case_idx, ve
CV_ImgWarpBaseTest::get_test_array_types_and_sizes( test_case_idx, sizes, types );
int src_depth = cvtest::randInt(rng) % 2, dst_depth;
int cn = cvtest::randInt(rng) % 2 ? 3 : 1;
CvSize src_size, dst_size;
Size src_size, dst_size;
dst_depth = src_depth = src_depth == 0 ? CV_8U : CV_32F;
if( src_depth < CV_32F && cvtest::randInt(rng) % 2 )
@ -1293,7 +1293,7 @@ void CV_GetQuadSubPixTest::get_test_array_types_and_sizes( int test_case_idx, ve
{
int min_size = 4;
CV_ImgWarpBaseTest::get_test_array_types_and_sizes( test_case_idx, sizes, types );
CvSize sz = sizes[INPUT][0], dsz;
Size sz = sizes[INPUT][0], dsz;
RNG& rng = ts->get_rng();
int msz, src_depth = cvtest::randInt(rng) % 2, dst_depth;
int cn = cvtest::randInt(rng) % 2 ? 3 : 1;
@ -1323,7 +1323,7 @@ void CV_GetQuadSubPixTest::get_test_array_types_and_sizes( int test_case_idx, ve
void CV_GetQuadSubPixTest::run_func()
{
CvMat mtx = test_mat[INPUT][1];
CvMat mtx = cvMat(test_mat[INPUT][1]);
cvGetQuadrangleSubPix( test_array[INPUT][0], test_array[INPUT_OUTPUT][0], &mtx );
}
@ -1343,7 +1343,7 @@ int CV_GetQuadSubPixTest::prepare_test_case( int test_case_idx )
int code = CV_ImgWarpBaseTest::prepare_test_case( test_case_idx );
const Mat& src = test_mat[INPUT][0];
Mat& mat = test_mat[INPUT][1];
CvPoint2D32f center;
Point2f center;
double scale, angle;
if( code <= 0 )

@ -161,7 +161,7 @@ void CV_MomentsTest::run_func()
ttime += (double)getTickCount() - t;
ncalls++;
printf("%g\n", ttime/ncalls/u.total()));
*m = new_m;
*m = cvMoments(new_m);
}
else
cvMoments( test_array[INPUT][0], m, is_binary );
@ -179,22 +179,13 @@ void CV_MomentsTest::run_func()
void CV_MomentsTest::prepare_to_validation( int /*test_case_idx*/ )
{
Mat& src = test_mat[INPUT][0];
CvMoments m;
CvMoments m = cvMoments();
double* mdata = test_mat[REF_OUTPUT][0].ptr<double>();
int depth = src.depth();
int cn = src.channels();
int i, y, x, cols = src.cols;
double xc = 0., yc = 0.;
#if defined __GNUC__ && __GNUC__ >= 8
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wclass-memaccess"
#endif
memset( &m, 0, sizeof(m));
#if defined __GNUC__ && __GNUC__ >= 8
#pragma GCC diagnostic pop
#endif
int coi = 0;
for( y = 0; y < src.rows; y++ )
{

@ -151,7 +151,7 @@ static void cvTsMatchTemplate( const CvMat* img, const CvMat* templ, CvMat* resu
int width_n = templ->cols*cn, height = templ->rows;
int a_step = img->step / CV_ELEM_SIZE(img->type & CV_MAT_DEPTH_MASK);
int b_step = templ->step / CV_ELEM_SIZE(templ->type & CV_MAT_DEPTH_MASK);
CvScalar b_mean, b_sdv;
CvScalar b_mean = CV_STRUCT_INITIALIZER, b_sdv = CV_STRUCT_INITIALIZER;
double b_denom = 1., b_sum2 = 0;
int area = templ->rows*templ->cols;
@ -191,8 +191,8 @@ static void cvTsMatchTemplate( const CvMat* img, const CvMat* templ, CvMat* resu
{
for( j = 0; j < result->cols; j++ )
{
CvScalar a_sum(0), a_sum2(0);
CvScalar ccorr(0);
Scalar a_sum(0), a_sum2(0);
Scalar ccorr(0);
double value = 0.;
if( depth == CV_8U )
@ -308,8 +308,8 @@ static void cvTsMatchTemplate( const CvMat* img, const CvMat* templ, CvMat* resu
void CV_TemplMatchTest::prepare_to_validation( int /*test_case_idx*/ )
{
CvMat _input = test_mat[INPUT][0], _templ = test_mat[INPUT][1];
CvMat _output = test_mat[REF_OUTPUT][0];
CvMat _input = cvMat(test_mat[INPUT][0]), _templ = cvMat(test_mat[INPUT][1]);
CvMat _output = cvMat(test_mat[REF_OUTPUT][0]);
cvTsMatchTemplate( &_input, &_templ, &_output, method );
//if( ts->get_current_test_info()->test_case_idx == 0 )

@ -73,12 +73,12 @@ void CV_WatershedTest::run( int /* start_from */)
Mat markers(orig.size(), CV_32SC1);
markers = Scalar(0);
IplImage iplmrks = markers;
IplImage iplmrks = cvIplImage(markers);
vector<unsigned char> colors(1);
for(int i = 0; cnts != 0; cnts = cnts->h_next, ++i )
{
cvDrawContours( &iplmrks, cnts, Scalar::all(i + 1), Scalar::all(i + 1), -1, CV_FILLED);
cvDrawContours( &iplmrks, cnts, cvScalar(Scalar::all(i + 1)), cvScalar(Scalar::all(i + 1)), -1, CV_FILLED);
Point* p = (Point*)cvGetSeqElem(cnts, 0);
//expected image was added with 1 in order to save to png

@ -1231,9 +1231,9 @@ static void detectMultiScaleOldFormat( const Mat& image, Ptr<CvHaarClassifierCas
bool outputRejectLevels = false )
{
MemStorage storage(cvCreateMemStorage(0));
CvMat _image = image;
CvMat _image = cvMat(image);
CvSeq* _objects = cvHaarDetectObjectsForROC( &_image, oldCascade, storage, rejectLevels, levelWeights, scaleFactor,
minNeighbors, flags, minObjectSize, maxObjectSize, outputRejectLevels );
minNeighbors, flags, cvSize(minObjectSize), cvSize(maxObjectSize), outputRejectLevels );
Seq<CvAvgComp>(_objects).copyTo(vecAvgComp);
objects.resize(vecAvgComp.size());
std::transform(vecAvgComp.begin(), vecAvgComp.end(), objects.begin(), getRect());

@ -67,11 +67,6 @@
# endif
#endif
#if defined __GNUC__ && __GNUC__ >= 8
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wclass-memaccess"
#endif
/* these settings affect the quality of detection: change with care */
#define CV_ADJUST_FEATURES 1
#define CV_ADJUST_WEIGHTS 0
@ -171,7 +166,7 @@ icvCreateHidHaarClassifierCascade( CvHaarClassifierCascade* cascade )
char errorstr[1000];
CvHidHaarClassifier* haar_classifier_ptr;
CvHidHaarTreeNode* haar_node_ptr;
CvSize orig_window_size;
cv::Size orig_window_size;
bool has_tilted_features = false;
int max_count = 0;
@ -409,7 +404,7 @@ cvSetImagesForHaarClassifierCascade( CvHaarClassifierCascade* _cascade,
CvHidHaarClassifierCascade* cascade;
int coi0 = 0, coi1 = 0;
int i;
CvRect equRect;
cv::Rect equRect;
double weight_scale;
if( !CV_IS_HAAR_CLASSIFIER(_cascade) )
@ -495,7 +490,7 @@ cvSetImagesForHaarClassifierCascade( CvHaarClassifierCascade* _cascade,
CvHidHaarFeature* hidfeature =
&cascade->stage_classifier[i].classifier[j].node[l].feature;
double sum0 = 0, area0 = 0;
CvRect r[3];
cv::Rect r[3];
int base_w = -1, base_h = -1;
int new_base_w = 0, new_base_h = 0;
@ -539,7 +534,7 @@ cvSetImagesForHaarClassifierCascade( CvHaarClassifierCascade* _cascade,
for( k = 0; k < nr; k++ )
{
CvRect tr;
cv::Rect tr;
double correction_ratio;
if( flagx )
@ -1298,14 +1293,13 @@ cvHaarDetectObjectsForROC( const CvArr* _img,
for( factor = 1; ; factor *= scaleFactor )
{
CvSize winSize(cvRound(winSize0.width*factor),
cvRound(winSize0.height*factor));
CvSize sz(cvRound( img->cols/factor ), cvRound( img->rows/factor ));
CvSize sz1(sz.width - winSize0.width + 1, sz.height - winSize0.height + 1);
CvSize winSize = { cvRound(winSize0.width*factor),
cvRound(winSize0.height*factor) };
CvSize sz = { cvRound(img->cols/factor), cvRound(img->rows/factor) };
CvSize sz1 = { sz.width - winSize0.width + 1, sz.height - winSize0.height + 1 };
CvRect equRect(icv_object_win_border, icv_object_win_border,
winSize0.width - icv_object_win_border*2,
winSize0.height - icv_object_win_border*2);
CvRect equRect = { icv_object_win_border, icv_object_win_border,
winSize0.width - icv_object_win_border*2, winSize0.height - icv_object_win_border*2 };
CvMat img1, sum1, sqsum1, norm1, tilted1, mask1;
CvMat* _tilted = 0;
@ -1385,9 +1379,9 @@ cvHaarDetectObjectsForROC( const CvArr* _img,
for( ; n_factors-- > 0; factor *= scaleFactor )
{
const double ystep = std::max( 2., factor );
CvSize winSize(cvRound( cascade->orig_window_size.width * factor ),
cvRound( cascade->orig_window_size.height * factor ));
CvRect equRect;
cv::Size winSize(cvRound(cascade->orig_window_size.width * factor),
cvRound(cascade->orig_window_size.height * factor));
cv::Rect equRect;
int *p[4] = {0,0,0,0};
int *pq[4] = {0,0,0,0};
int startX = 0, startY = 0;
@ -1504,14 +1498,14 @@ cvHaarDetectObjectsForROC( const CvArr* _img,
if( findBiggestObject && rectList.size() )
{
CvAvgComp result_comp = {CvRect(),0};
CvAvgComp result_comp = {{0, 0, 0, 0},0};
for( size_t i = 0; i < rectList.size(); i++ )
{
cv::Rect r = rectList[i];
if( r.area() > cv::Rect(result_comp.rect).area() )
{
result_comp.rect = r;
result_comp.rect = cvRect(r);
result_comp.neighbors = rweights[i];
}
}
@ -1522,7 +1516,7 @@ cvHaarDetectObjectsForROC( const CvArr* _img,
for( size_t i = 0; i < rectList.size(); i++ )
{
CvAvgComp c;
c.rect = rectList[i];
c.rect = cvRect(rectList[i]);
c.neighbors = !rweights.empty() ? rweights[i] : 0;
cvSeqPush( result_seq, &c );
}
@ -1601,13 +1595,13 @@ icvLoadCascadeCART( const char** input_cascade, int n, CvSize orig_window_size )
for( k = 0; k < rects; k++ )
{
CvRect r;
cv::Rect r;
int band = 0;
sscanf( stage, "%d%d%d%d%d%f%n",
&r.x, &r.y, &r.width, &r.height, &band,
&(classifier->haar_feature[l].rect[k].weight), &dl );
stage += dl;
classifier->haar_feature[l].rect[k].r = r;
classifier->haar_feature[l].rect[k].r = cvRect(r);
}
sscanf( stage, "%99s%n", str, &dl );
stage += dl;
@ -1905,7 +1899,7 @@ icvReadHaarClassifier( CvFileStorage* fs, CvFileNode* node )
for( l = 0; l < rects_fn->data.seq->total; ++l )
{
CvFileNode* rect_fn;
CvRect r;
cv::Rect r;
rect_fn = (CvFileNode*) rects_reader.ptr;
if( !CV_NODE_IS_SEQ( rect_fn->tag ) || rect_fn->data.seq->total != 5 )
@ -1960,7 +1954,7 @@ icvReadHaarClassifier( CvFileStorage* fs, CvFileNode* node )
}
classifier->haar_feature[k].rect[l].weight = (float) fn->data.f;
classifier->haar_feature[k].rect[l].r = r;
classifier->haar_feature[k].rect[l].r = cvRect(r);
CV_NEXT_SEQ_ELEM( sizeof( *rect_fn ), rects_reader );
} /* for each rect */
@ -2295,8 +2289,4 @@ CvType haar_type( CV_TYPE_NAME_HAAR, icvIsHaarClassifier,
icvReadHaarClassifier, icvWriteHaarClassifier,
icvCloneHaarClassifier );
#if defined __GNUC__ && __GNUC__ >= 8
#pragma GCC diagnostic pop
#endif
/* End of file. */

@ -430,7 +430,7 @@ int CV_CascadeDetectorTest::detectMultiScale_C( const string& filename,
cvtColor( img, grayImg, COLOR_BGR2GRAY );
equalizeHist( grayImg, grayImg );
CvMat c_gray = grayImg;
CvMat c_gray = cvMat(grayImg);
CvSeq* rs = cvHaarDetectObjects(&c_gray, c_cascade, storage, 1.1, 3, flags[di] );
objects.clear();

@ -201,12 +201,14 @@ public:
}
};
inline float VectorScalMult(CvPoint2D32f v1,CvPoint2D32f v2) {
static inline float VectorScalMult(const cv::Point2f& v1, const cv::Point2f& v2)
{
return v1.x*v2.x+v1.y*v2.y;
}
inline float VectorLength(CvPoint2D32f v1) {
return v1.x*v1.x+v1.y*v1.y;
static inline float VectorLength(const cv::Point2f& v1)
{
return v1.x*v1.x+v1.y*v1.y;
}
///////////////////////////////////////////////////////////////////////////////////////////
@ -307,7 +309,7 @@ icvTeleaInpaintFMM(const CvMat *f, CvMat *t, CvMat *out, int range, CvPriorityQu
CV_MAT_ELEM(*t,float,i,j) = dist;
for (color=0; color<=2; color++) {
CvPoint2D32f gradI,gradT,r;
cv::Point2f gradI,gradT,r;
float Ia=0,Jx=0,Jy=0,s=1.0e-20f,w,dst,lev,dir,sat;
if (CV_MAT_ELEM(*f,uchar,i,j+1)!=INSIDE) {
@ -419,7 +421,7 @@ icvTeleaInpaintFMM(const CvMat *f, CvMat *t, CvMat *out, int range, CvPriorityQu
CV_MAT_ELEM(*t,float,i,j) = dist;
for (color=0; color<=0; color++) {
CvPoint2D32f gradI,gradT,r;
cv::Point2f gradI,gradT,r;
float Ia=0,Jx=0,Jy=0,s=1.0e-20f,w,dst,lev,dir,sat;
if (CV_MAT_ELEM(*f,uchar,i,j+1)!=INSIDE) {
@ -539,7 +541,7 @@ icvNSInpaintFMM(const CvMat *f, CvMat *t, CvMat *out, int range, CvPriorityQueue
CV_MAT_ELEM(*t,float,i,j) = dist;
for (color=0; color<=2; color++) {
CvPoint2D32f gradI,r;
cv::Point2f gradI,r;
float Ia=0,s=1.0e-20f,w,dst,dir;
for (k=i-range; k<=i+range; k++) {
@ -627,7 +629,7 @@ icvNSInpaintFMM(const CvMat *f, CvMat *t, CvMat *out, int range, CvPriorityQueue
CV_MAT_ELEM(*t,float,i,j) = dist;
{
CvPoint2D32f gradI,r;
cv::Point2f gradI,r;
float Ia=0,s=1.0e-20f,w,dst,dir;
for (k=i-range; k<=i+range; k++) {
@ -847,6 +849,6 @@ void cv::inpaint( InputArray _src, InputArray _mask, OutputArray _dst,
Mat src = _src.getMat(), mask = _mask.getMat();
_dst.create( src.size(), src.type() );
Mat dst = _dst.getMat();
CvMat c_src = src, c_mask = mask, c_dst = dst;
CvMat c_src = cvMat(src), c_mask = cvMat(mask), c_dst = cvMat(dst);
cvInpaint( &c_src, &c_mask, &c_dst, inpaintRange, flags );
}

@ -255,10 +255,10 @@ bool BundleAdjusterBase::estimate(const std::vector<ImageFeatures> &features,
CvLevMarq solver(num_images_ * num_params_per_cam_,
total_num_matches_ * num_errs_per_measurement_,
term_criteria_);
cvTermCriteria(term_criteria_));
Mat err, jac;
CvMat matParams = cam_params_;
CvMat matParams = cvMat(cam_params_);
cvCopy(&matParams, solver.param);
int iter = 0;
@ -278,7 +278,7 @@ bool BundleAdjusterBase::estimate(const std::vector<ImageFeatures> &features,
if (_jac)
{
calcJacobian(jac);
CvMat tmp = jac;
CvMat tmp = cvMat(jac);
cvCopy(&tmp, _jac);
}
@ -287,7 +287,7 @@ bool BundleAdjusterBase::estimate(const std::vector<ImageFeatures> &features,
calcError(err);
LOG_CHAT(".");
iter++;
CvMat tmp = err;
CvMat tmp = cvMat(err);
cvCopy(&tmp, _err);
}
}

@ -158,8 +158,8 @@ int ArrayTest::prepare_test_case( int test_case_idx )
{
unsigned t = randInt(rng);
bool create_mask = true, use_roi = false;
CvSize size = sizes[i][j], whole_size = size;
CvRect roi;
CvSize size = cvSize(sizes[i][j]), whole_size = size;
CvRect roi = CV_STRUCT_INITIALIZER;
is_image = !cvmat_allowed ? true : iplimage_allowed ? (t & 1) != 0 : false;
create_mask = (t & 6) == 0; // ~ each of 3 tests will use mask

@ -56,7 +56,7 @@ cvMeanShift( const void* imgProb, CvRect windowIn,
if( comp )
{
comp->rect = window;
comp->rect = cvRect(window);
comp->area = cvRound(cv::sum(img(window))[0]);
}
@ -76,13 +76,13 @@ cvCamShift( const void* imgProb, CvRect windowIn,
if( comp )
{
comp->rect = window;
comp->rect = cvRect(window);
cv::Rect roi = rr.boundingRect() & cv::Rect(0, 0, img.cols, img.rows);
comp->area = cvRound(cv::sum(img(roi))[0]);
}
if( box )
*box = rr;
*box = cvBox2D(rr);
return rr.size.width*rr.size.height > 0.f ? 1 : -1;
}

@ -435,7 +435,7 @@ void CV_MeanShiftTest::run_func(void)
int CV_MeanShiftTest::validate_test_results( int /*test_case_idx*/ )
{
int code = cvtest::TS::OK;
CvPoint2D32f c;
Point2f c;
double m = MAX(box0.size.width, box0.size.height), delta;
if( cvIsNaN(comp.area) || cvIsInf(comp.area) || comp.area <= 0 )

@ -120,7 +120,7 @@ void CV_OptFlowPyrLKTest::run( int )
/* read first image */
sprintf( filename, "%soptflow/%s", ts->get_data_path().c_str(), "rock_1.bmp" );
imgI2 = cv::imread( filename, cv::IMREAD_UNCHANGED );
imgI = imgI2;
imgI = cvIplImage(imgI2);
if( imgI2.empty() )
{
@ -132,7 +132,7 @@ void CV_OptFlowPyrLKTest::run( int )
/* read second image */
sprintf( filename, "%soptflow/%s", ts->get_data_path().c_str(), "rock_2.bmp" );
imgJ2 = cv::imread( filename, cv::IMREAD_UNCHANGED );
imgJ = imgJ2;
imgJ = cvIplImage(imgJ2);
if( imgJ2.empty() )
{

@ -366,7 +366,7 @@ void VideoWriter::write(const Mat& image)
iwriter->write(image);
else
{
IplImage _img = image;
IplImage _img = cvIplImage(image);
cvWriteFrame(writer, &_img);
}
}

@ -382,7 +382,7 @@ IplImage* CvCapture_OpenNI::OutputMap::getIplImagePtr()
if( mat.empty() )
return 0;
iplHeader = IplImage(mat);
iplHeader = cvIplImage(mat);
return &iplHeader;
}

@ -192,7 +192,7 @@ IplImage* CvCapture_OpenNI2::OutputMap::getIplImagePtr()
if( mat.empty() )
return 0;
iplHeader = IplImage(mat);
iplHeader = cvIplImage(mat);
return &iplHeader;
}

@ -551,7 +551,7 @@ static int v4l2_num_channels(__u32 palette) {
}
static void v4l2_create_frame(CvCaptureCAM_V4L *capture) {
CvSize size(capture->form.fmt.pix.width, capture->form.fmt.pix.height);
CvSize size = {capture->form.fmt.pix.width, capture->form.fmt.pix.height};
int channels = 3;
int depth = IPL_DEPTH_8U;
@ -561,7 +561,7 @@ static void v4l2_create_frame(CvCaptureCAM_V4L *capture) {
switch(capture->palette) {
case V4L2_PIX_FMT_MJPEG:
case V4L2_PIX_FMT_JPEG:
size = CvSize(capture->buffers[capture->bufferIndex].length, 1);
size = cvSize(capture->buffers[capture->bufferIndex].length, 1);
break;
case V4L2_PIX_FMT_YVU420:
case V4L2_PIX_FMT_YUV420:

@ -659,22 +659,22 @@ void VideoWriter_create(CvVideoWriter*& writer, Ptr<IVideoWriter>& iwriter, Vide
#endif
#ifdef HAVE_VFW
case CAP_VFW:
CREATE_WRITER_LEGACY(cvCreateVideoWriter_VFW(filename.c_str(), fourcc, fps, frameSize, isColor))
CREATE_WRITER_LEGACY(cvCreateVideoWriter_VFW(filename.c_str(), fourcc, fps, cvSize(frameSize), isColor))
break;
#endif
#ifdef HAVE_AVFOUNDATION
case CAP_AVFOUNDATION:
CREATE_WRITER_LEGACY(cvCreateVideoWriter_AVFoundation(filename.c_str(), fourcc, fps, frameSize, isColor))
CREATE_WRITER_LEGACY(cvCreateVideoWriter_AVFoundation(filename.c_str(), fourcc, fps, cvSize(frameSize), isColor))
break;
#endif
#if defined(HAVE_QUICKTIME) || defined(HAVE_QTKIT)
case(CAP_QT):
CREATE_WRITER_LEGACY(cvCreateVideoWriter_QT(filename.c_str(), fourcc, fps, frameSize, isColor))
CREATE_WRITER_LEGACY(cvCreateVideoWriter_QT(filename.c_str(), fourcc, fps, cvSize(frameSize), isColor))
break;
#endif
#ifdef HAVE_GSTREAMER
case CAP_GSTREAMER:
CREATE_WRITER_LEGACY(cvCreateVideoWriter_GStreamer (filename.c_str(), fourcc, fps, frameSize, isColor))
CREATE_WRITER_LEGACY(cvCreateVideoWriter_GStreamer (filename.c_str(), fourcc, fps, cvSize(frameSize), isColor))
break;
#endif
case CAP_OPENCV_MJPEG:

Loading…
Cancel
Save