Several type of formal refactoring:
1. someMatrix.data -> someMatrix.prt() 2. someMatrix.data + someMatrix.step * lineIndex -> someMatrix.ptr( lineIndex ) 3. (SomeType*) someMatrix.data -> someMatrix.ptr<SomeType>() 4. someMatrix.data -> !someMatrix.empty() ( or !someMatrix.data -> someMatrix.empty() ) in logical expressions
This commit is contained in:
@@ -1939,7 +1939,7 @@ void cv::drawChessboardCorners( InputOutputArray _image, Size patternSize,
|
||||
Mat image = _image.getMat(); CvMat c_image = _image.getMat();
|
||||
int nelems = corners.checkVector(2, CV_32F, true);
|
||||
CV_Assert(nelems >= 0);
|
||||
cvDrawChessboardCorners( &c_image, patternSize, (CvPoint2D32f*)corners.data,
|
||||
cvDrawChessboardCorners( &c_image, patternSize, corners.ptr<CvPoint2D32f>(),
|
||||
nelems, patternWasFound );
|
||||
}
|
||||
|
||||
|
||||
@@ -2998,15 +2998,15 @@ static void collectCalibrationData( InputArrayOfArrays objectPoints,
|
||||
int ni1 = imgpt1.checkVector(2, CV_32F);
|
||||
CV_Assert( ni > 0 && ni == ni1 );
|
||||
npoints.at<int>(i) = ni;
|
||||
memcpy( objPtData + j, objpt.data, ni*sizeof(objPtData[0]) );
|
||||
memcpy( imgPtData1 + j, imgpt1.data, ni*sizeof(imgPtData1[0]) );
|
||||
memcpy( objPtData + j, objpt.ptr(), ni*sizeof(objPtData[0]) );
|
||||
memcpy( imgPtData1 + j, imgpt1.ptr(), ni*sizeof(imgPtData1[0]) );
|
||||
|
||||
if( imgPtData2 )
|
||||
{
|
||||
Mat imgpt2 = imagePoints2.getMat(i);
|
||||
int ni2 = imgpt2.checkVector(2, CV_32F);
|
||||
CV_Assert( ni == ni2 );
|
||||
memcpy( imgPtData2 + j, imgpt2.data, ni*sizeof(imgPtData2[0]) );
|
||||
memcpy( imgPtData2 + j, imgpt2.ptr(), ni*sizeof(imgPtData2[0]) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3245,13 +3245,13 @@ double cv::calibrateCamera( InputArrayOfArrays _objectPoints,
|
||||
{
|
||||
_rvecs.create(3, 1, CV_64F, i, true);
|
||||
Mat rv = _rvecs.getMat(i);
|
||||
memcpy(rv.data, rvecM.ptr<double>(i), 3*sizeof(double));
|
||||
memcpy(rv.ptr(), rvecM.ptr<double>(i), 3*sizeof(double));
|
||||
}
|
||||
if( tvecs_needed )
|
||||
{
|
||||
_tvecs.create(3, 1, CV_64F, i, true);
|
||||
Mat tv = _tvecs.getMat(i);
|
||||
memcpy(tv.data, tvecM.ptr<double>(i), 3*sizeof(double));
|
||||
memcpy(tv.ptr(), tvecM.ptr<double>(i), 3*sizeof(double));
|
||||
}
|
||||
}
|
||||
cameraMatrix.copyTo(_cameraMatrix);
|
||||
@@ -3472,7 +3472,7 @@ void cv::decomposeProjectionMatrix( InputArray _projMatrix, OutputArray _cameraM
|
||||
if( _eulerAngles.needed() )
|
||||
{
|
||||
_eulerAngles.create(3, 1, CV_64F, -1, true);
|
||||
p_eulerAngles = (CvPoint3D64f*)_eulerAngles.getMat().data;
|
||||
p_eulerAngles = _eulerAngles.getMat().ptr<CvPoint3D64f>();
|
||||
}
|
||||
|
||||
cvDecomposeProjectionMatrix(&c_projMatrix, &c_cameraMatrix, &c_rotMatrix,
|
||||
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
Mat EE = Mat(Vt.t()).colRange(5, 9) * 1.0;
|
||||
Mat A(10, 20, CV_64F);
|
||||
EE = EE.t();
|
||||
getCoeffMat((double*)EE.data, (double*)A.data);
|
||||
getCoeffMat(EE.ptr<double>(), A.ptr<double>());
|
||||
EE = EE.t();
|
||||
|
||||
A = A.colRange(0, 10).inv() * A.colRange(10, 20);
|
||||
@@ -137,7 +137,7 @@ public:
|
||||
cv::Mat Evec = EE.col(0) * xs.back() + EE.col(1) * ys.back() + EE.col(2) * zs.back() + EE.col(3);
|
||||
Evec /= norm(Evec);
|
||||
|
||||
memcpy(e + count * 9, Evec.data, 9 * sizeof(double));
|
||||
memcpy(e + count * 9, Evec.ptr(), 9 * sizeof(double));
|
||||
count++;
|
||||
}
|
||||
|
||||
|
||||
@@ -767,8 +767,8 @@ void cv::computeCorrespondEpilines( InputArray _points, int whichImage,
|
||||
|
||||
if( depth == CV_32S || depth == CV_32F )
|
||||
{
|
||||
const Point* ptsi = (const Point*)points.data;
|
||||
const Point2f* ptsf = (const Point2f*)points.data;
|
||||
const Point* ptsi = points.ptr<Point>();
|
||||
const Point2f* ptsf = points.ptr<Point2f>();
|
||||
Point3f* dstf = lines.ptr<Point3f>();
|
||||
for( int i = 0; i < npoints; i++ )
|
||||
{
|
||||
@@ -784,7 +784,7 @@ void cv::computeCorrespondEpilines( InputArray _points, int whichImage,
|
||||
}
|
||||
else
|
||||
{
|
||||
const Point2d* ptsd = (const Point2d*)points.data;
|
||||
const Point2d* ptsd = points.ptr<Point2d>();
|
||||
Point3d* dstd = lines.ptr<Point3d>();
|
||||
for( int i = 0; i < npoints; i++ )
|
||||
{
|
||||
@@ -829,8 +829,8 @@ void cv::convertPointsFromHomogeneous( InputArray _src, OutputArray _dst )
|
||||
{
|
||||
if( cn == 3 )
|
||||
{
|
||||
const Point3i* sptr = (const Point3i*)src.data;
|
||||
Point2f* dptr = (Point2f*)dst.data;
|
||||
const Point3i* sptr = src.ptr<Point3i>();
|
||||
Point2f* dptr = dst.ptr<Point2f>();
|
||||
for( i = 0; i < npoints; i++ )
|
||||
{
|
||||
float scale = sptr[i].z != 0 ? 1.f/sptr[i].z : 1.f;
|
||||
@@ -839,8 +839,8 @@ void cv::convertPointsFromHomogeneous( InputArray _src, OutputArray _dst )
|
||||
}
|
||||
else
|
||||
{
|
||||
const Vec4i* sptr = (const Vec4i*)src.data;
|
||||
Point3f* dptr = (Point3f*)dst.data;
|
||||
const Vec4i* sptr = src.ptr<Vec4i>();
|
||||
Point3f* dptr = dst.ptr<Point3f>();
|
||||
for( i = 0; i < npoints; i++ )
|
||||
{
|
||||
float scale = sptr[i][3] != 0 ? 1.f/sptr[i][3] : 1.f;
|
||||
@@ -852,8 +852,8 @@ void cv::convertPointsFromHomogeneous( InputArray _src, OutputArray _dst )
|
||||
{
|
||||
if( cn == 3 )
|
||||
{
|
||||
const Point3f* sptr = (const Point3f*)src.data;
|
||||
Point2f* dptr = (Point2f*)dst.data;
|
||||
const Point3f* sptr = src.ptr<Point3f>();
|
||||
Point2f* dptr = dst.ptr<Point2f>();
|
||||
for( i = 0; i < npoints; i++ )
|
||||
{
|
||||
float scale = sptr[i].z != 0.f ? 1.f/sptr[i].z : 1.f;
|
||||
@@ -862,8 +862,8 @@ void cv::convertPointsFromHomogeneous( InputArray _src, OutputArray _dst )
|
||||
}
|
||||
else
|
||||
{
|
||||
const Vec4f* sptr = (const Vec4f*)src.data;
|
||||
Point3f* dptr = (Point3f*)dst.data;
|
||||
const Vec4f* sptr = src.ptr<Vec4f>();
|
||||
Point3f* dptr = dst.ptr<Point3f>();
|
||||
for( i = 0; i < npoints; i++ )
|
||||
{
|
||||
float scale = sptr[i][3] != 0.f ? 1.f/sptr[i][3] : 1.f;
|
||||
@@ -875,8 +875,8 @@ void cv::convertPointsFromHomogeneous( InputArray _src, OutputArray _dst )
|
||||
{
|
||||
if( cn == 3 )
|
||||
{
|
||||
const Point3d* sptr = (const Point3d*)src.data;
|
||||
Point2d* dptr = (Point2d*)dst.data;
|
||||
const Point3d* sptr = src.ptr<Point3d>();
|
||||
Point2d* dptr = dst.ptr<Point2d>();
|
||||
for( i = 0; i < npoints; i++ )
|
||||
{
|
||||
double scale = sptr[i].z != 0. ? 1./sptr[i].z : 1.;
|
||||
@@ -885,8 +885,8 @@ void cv::convertPointsFromHomogeneous( InputArray _src, OutputArray _dst )
|
||||
}
|
||||
else
|
||||
{
|
||||
const Vec4d* sptr = (const Vec4d*)src.data;
|
||||
Point3d* dptr = (Point3d*)dst.data;
|
||||
const Vec4d* sptr = src.ptr<Vec4d>();
|
||||
Point3d* dptr = dst.ptr<Point3d>();
|
||||
for( i = 0; i < npoints; i++ )
|
||||
{
|
||||
double scale = sptr[i][3] != 0.f ? 1./sptr[i][3] : 1.;
|
||||
@@ -928,15 +928,15 @@ void cv::convertPointsToHomogeneous( InputArray _src, OutputArray _dst )
|
||||
{
|
||||
if( cn == 2 )
|
||||
{
|
||||
const Point2i* sptr = (const Point2i*)src.data;
|
||||
Point3i* dptr = (Point3i*)dst.data;
|
||||
const Point2i* sptr = src.ptr<Point2i>();
|
||||
Point3i* dptr = dst.ptr<Point3i>();
|
||||
for( i = 0; i < npoints; i++ )
|
||||
dptr[i] = Point3i(sptr[i].x, sptr[i].y, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
const Point3i* sptr = (const Point3i*)src.data;
|
||||
Vec4i* dptr = (Vec4i*)dst.data;
|
||||
const Point3i* sptr = src.ptr<Point3i>();
|
||||
Vec4i* dptr = dst.ptr<Vec4i>();
|
||||
for( i = 0; i < npoints; i++ )
|
||||
dptr[i] = Vec4i(sptr[i].x, sptr[i].y, sptr[i].z, 1);
|
||||
}
|
||||
@@ -945,15 +945,15 @@ void cv::convertPointsToHomogeneous( InputArray _src, OutputArray _dst )
|
||||
{
|
||||
if( cn == 2 )
|
||||
{
|
||||
const Point2f* sptr = (const Point2f*)src.data;
|
||||
Point3f* dptr = (Point3f*)dst.data;
|
||||
const Point2f* sptr = src.ptr<Point2f>();
|
||||
Point3f* dptr = dst.ptr<Point3f>();
|
||||
for( i = 0; i < npoints; i++ )
|
||||
dptr[i] = Point3f(sptr[i].x, sptr[i].y, 1.f);
|
||||
}
|
||||
else
|
||||
{
|
||||
const Point3f* sptr = (const Point3f*)src.data;
|
||||
Vec4f* dptr = (Vec4f*)dst.data;
|
||||
const Point3f* sptr = src.ptr<Point3f>();
|
||||
Vec4f* dptr = dst.ptr<Vec4f>();
|
||||
for( i = 0; i < npoints; i++ )
|
||||
dptr[i] = Vec4f(sptr[i].x, sptr[i].y, sptr[i].z, 1.f);
|
||||
}
|
||||
@@ -962,15 +962,15 @@ void cv::convertPointsToHomogeneous( InputArray _src, OutputArray _dst )
|
||||
{
|
||||
if( cn == 2 )
|
||||
{
|
||||
const Point2d* sptr = (const Point2d*)src.data;
|
||||
Point3d* dptr = (Point3d*)dst.data;
|
||||
const Point2d* sptr = src.ptr<Point2d>();
|
||||
Point3d* dptr = dst.ptr<Point3d>();
|
||||
for( i = 0; i < npoints; i++ )
|
||||
dptr[i] = Point3d(sptr[i].x, sptr[i].y, 1.);
|
||||
}
|
||||
else
|
||||
{
|
||||
const Point3d* sptr = (const Point3d*)src.data;
|
||||
Vec4d* dptr = (Vec4d*)dst.data;
|
||||
const Point3d* sptr = src.ptr<Point3d>();
|
||||
Vec4d* dptr = dst.ptr<Vec4d>();
|
||||
for( i = 0; i < npoints; i++ )
|
||||
dptr[i] = Vec4d(sptr[i].x, sptr[i].y, sptr[i].z, 1.);
|
||||
}
|
||||
|
||||
@@ -113,12 +113,12 @@ public:
|
||||
int d1 = m1.channels() > 1 ? m1.channels() : m1.cols;
|
||||
int d2 = m2.channels() > 1 ? m2.channels() : m2.cols;
|
||||
int count = m1.checkVector(d1), count2 = m2.checkVector(d2);
|
||||
const int *m1ptr = (const int*)m1.data, *m2ptr = (const int*)m2.data;
|
||||
const int *m1ptr = m1.ptr<int>(), *m2ptr = m2.ptr<int>();
|
||||
|
||||
ms1.create(modelPoints, 1, CV_MAKETYPE(m1.depth(), d1));
|
||||
ms2.create(modelPoints, 1, CV_MAKETYPE(m2.depth(), d2));
|
||||
|
||||
int *ms1ptr = (int*)ms1.data, *ms2ptr = (int*)ms2.data;
|
||||
int *ms1ptr = ms1.ptr<int>(), *ms2ptr = ms2.ptr<int>();
|
||||
|
||||
CV_Assert( count >= modelPoints && count == count2 );
|
||||
CV_Assert( (esz1 % sizeof(int)) == 0 && (esz2 % sizeof(int)) == 0 );
|
||||
@@ -343,7 +343,7 @@ public:
|
||||
else
|
||||
errf = err;
|
||||
CV_Assert( errf.isContinuous() && errf.type() == CV_32F && (int)errf.total() == count );
|
||||
std::sort((int*)errf.data, (int*)errf.data + count);
|
||||
std::sort(errf.ptr<int>(), errf.ptr<int>() + count);
|
||||
|
||||
double median = count % 2 != 0 ?
|
||||
errf.at<float>(count/2) : (errf.at<float>(count/2-1) + errf.at<float>(count/2))*0.5;
|
||||
|
||||
@@ -114,7 +114,7 @@ static void prefilterNorm( const Mat& src, Mat& dst, int winsize, int ftzero, uc
|
||||
int scale_g = winsize*winsize/8, scale_s = (1024 + scale_g)/(scale_g*2);
|
||||
const int OFS = 256*5, TABSZ = OFS*2 + 256;
|
||||
uchar tab[TABSZ];
|
||||
const uchar* sptr = src.data;
|
||||
const uchar* sptr = src.ptr();
|
||||
int srcstep = (int)src.step;
|
||||
Size size = src.size();
|
||||
|
||||
@@ -294,10 +294,10 @@ static void findStereoCorrespondenceBM_SSE2( const Mat& left, const Mat& right,
|
||||
ushort *sad, *hsad0, *hsad, *hsad_sub;
|
||||
int *htext;
|
||||
uchar *cbuf0, *cbuf;
|
||||
const uchar* lptr0 = left.data + lofs;
|
||||
const uchar* rptr0 = right.data + rofs;
|
||||
const uchar* lptr0 = left.ptr() + lofs;
|
||||
const uchar* rptr0 = right.ptr() + rofs;
|
||||
const uchar *lptr, *lptr_sub, *rptr;
|
||||
short* dptr = (short*)disp.data;
|
||||
short* dptr = disp.ptr<short>();
|
||||
int sstep = (int)left.step;
|
||||
int dstep = (int)(disp.step/sizeof(dptr[0]));
|
||||
int cstep = (height + dy0 + dy1)*ndisp;
|
||||
@@ -357,7 +357,7 @@ static void findStereoCorrespondenceBM_SSE2( const Mat& left, const Mat& right,
|
||||
|
||||
for( x = 0; x < width1; x++, dptr++ )
|
||||
{
|
||||
short* costptr = cost.data ? (short*)cost.data + lofs + x : &costbuf;
|
||||
short* costptr = cost.data ? cost.ptr<short>() + lofs + x : &costbuf;
|
||||
int x0 = x - wsz2 - 1, x1 = x + wsz2;
|
||||
const uchar* cbuf_sub = cbuf0 + ((x0 + wsz2 + 1) % (wsz + 1))*cstep - dy0*ndisp;
|
||||
cbuf = cbuf0 + ((x1 + wsz2 + 1) % (wsz + 1))*cstep - dy0*ndisp;
|
||||
@@ -542,10 +542,10 @@ findStereoCorrespondenceBM( const Mat& left, const Mat& right,
|
||||
|
||||
int *sad, *hsad0, *hsad, *hsad_sub, *htext;
|
||||
uchar *cbuf0, *cbuf;
|
||||
const uchar* lptr0 = left.data + lofs;
|
||||
const uchar* rptr0 = right.data + rofs;
|
||||
const uchar* lptr0 = left.ptr() + lofs;
|
||||
const uchar* rptr0 = right.ptr() + rofs;
|
||||
const uchar *lptr, *lptr_sub, *rptr;
|
||||
short* dptr = (short*)disp.data;
|
||||
short* dptr = disp.ptr<short>();
|
||||
int sstep = (int)left.step;
|
||||
int dstep = (int)(disp.step/sizeof(dptr[0]));
|
||||
int cstep = (height+dy0+dy1)*ndisp;
|
||||
@@ -596,7 +596,7 @@ findStereoCorrespondenceBM( const Mat& left, const Mat& right,
|
||||
|
||||
for( x = 0; x < width1; x++, dptr++ )
|
||||
{
|
||||
int* costptr = cost.data ? (int*)cost.data + lofs + x : &costbuf;
|
||||
int* costptr = cost.data ? cost.ptr<int>() + lofs + x : &costbuf;
|
||||
int x0 = x - wsz2 - 1, x1 = x + wsz2;
|
||||
const uchar* cbuf_sub = cbuf0 + ((x0 + wsz2 + 1) % (wsz + 1))*cstep - dy0*ndisp;
|
||||
cbuf = cbuf0 + ((x1 + wsz2 + 1) % (wsz + 1))*cstep - dy0*ndisp;
|
||||
@@ -803,7 +803,7 @@ struct FindStereoCorrespInvoker : public ParallelLoopBody
|
||||
int cols = left->cols, rows = left->rows;
|
||||
int _row0 = std::min(cvRound(range.start * rows / nstripes), rows);
|
||||
int _row1 = std::min(cvRound(range.end * rows / nstripes), rows);
|
||||
uchar *ptr = slidingSumBuf->data + range.start * stripeBufSize;
|
||||
uchar *ptr = slidingSumBuf->ptr() + range.start * stripeBufSize;
|
||||
int FILTERED = (state->minDisparity - 1)*16;
|
||||
|
||||
Rect roi = validDisparityRect & Rect(0, _row0, cols, _row1 - _row0);
|
||||
@@ -988,7 +988,7 @@ public:
|
||||
if( slidingSumBuf.cols < bufSize )
|
||||
slidingSumBuf.create( 1, bufSize, CV_8U );
|
||||
|
||||
uchar *_buf = slidingSumBuf.data;
|
||||
uchar *_buf = slidingSumBuf.ptr();
|
||||
|
||||
parallel_for_(Range(0, 2), PrefilterInvoker(left0, right0, left, right, _buf, _buf + bufSize1, ¶ms), 1);
|
||||
|
||||
|
||||
@@ -383,12 +383,12 @@ static void computeDisparitySGBM( const Mat& img1, const Mat& img2,
|
||||
width*16*img1.channels()*sizeof(PixType) + // temp buffer for computing per-pixel cost
|
||||
width*(sizeof(CostType) + sizeof(DispType)) + 1024; // disp2cost + disp2
|
||||
|
||||
if( !buffer.data || !buffer.isContinuous() ||
|
||||
if( buffer.empty() || !buffer.isContinuous() ||
|
||||
buffer.cols*buffer.rows*buffer.elemSize() < totalBufSize )
|
||||
buffer.create(1, (int)totalBufSize, CV_8U);
|
||||
|
||||
// summary cost over different (nDirs) directions
|
||||
CostType* Cbuf = (CostType*)alignPtr(buffer.data, ALIGN);
|
||||
CostType* Cbuf = (CostType*)alignPtr(buffer.ptr(), ALIGN);
|
||||
CostType* Sbuf = Cbuf + CSBufSize;
|
||||
CostType* hsumBuf = Sbuf + CSBufSize;
|
||||
CostType* pixDiff = hsumBuf + costBufSize*hsumBufNRows;
|
||||
@@ -982,10 +982,10 @@ void filterSpecklesImpl(cv::Mat& img, int newVal, int maxSpeckleSize, int maxDif
|
||||
|
||||
int width = img.cols, height = img.rows, npixels = width*height;
|
||||
size_t bufSize = npixels*(int)(sizeof(Point2s) + sizeof(int) + sizeof(uchar));
|
||||
if( !_buf.isContinuous() || !_buf.data || _buf.cols*_buf.rows*_buf.elemSize() < bufSize )
|
||||
if( !_buf.isContinuous() || _buf.empty() || _buf.cols*_buf.rows*_buf.elemSize() < bufSize )
|
||||
_buf.create(1, (int)bufSize, CV_8U);
|
||||
|
||||
uchar* buf = _buf.data;
|
||||
uchar* buf = _buf.ptr();
|
||||
int i, j, dstep = (int)(img.step/sizeof(T));
|
||||
int* labels = (int*)buf;
|
||||
buf += npixels*sizeof(labels[0]);
|
||||
@@ -1097,10 +1097,10 @@ void cv::filterSpeckles( InputOutputArray _img, double _newval, int maxSpeckleSi
|
||||
if ((int)status >= 0)
|
||||
{
|
||||
if (type == CV_8UC1)
|
||||
status = ippiMarkSpeckles_8u_C1IR((Ipp8u *)img.data, (int)img.step, roisize,
|
||||
status = ippiMarkSpeckles_8u_C1IR(img.ptr<Ipp8u>(), (int)img.step, roisize,
|
||||
(Ipp8u)newVal, maxSpeckleSize, (Ipp8u)maxDiff, ippiNormL1, buffer);
|
||||
else
|
||||
status = ippiMarkSpeckles_16s_C1IR((Ipp16s *)img.data, (int)img.step, roisize,
|
||||
status = ippiMarkSpeckles_16s_C1IR(img.ptr<Ipp16s>(), (int)img.step, roisize,
|
||||
(Ipp16s)newVal, maxSpeckleSize, (Ipp16s)maxDiff, ippiNormL1, buffer);
|
||||
}
|
||||
|
||||
|
||||
@@ -773,10 +773,10 @@ void CV_CameraCalibrationTest_CPP::calibrate( int imageCount, int* pointCounts,
|
||||
flags );
|
||||
|
||||
assert( cameraMatrix.type() == CV_64FC1 );
|
||||
memcpy( _cameraMatrix, cameraMatrix.data, 9*sizeof(double) );
|
||||
memcpy( _cameraMatrix, cameraMatrix.ptr(), 9*sizeof(double) );
|
||||
|
||||
assert( cameraMatrix.type() == CV_64FC1 );
|
||||
memcpy( _distortionCoeffs, distCoeffs.data, 4*sizeof(double) );
|
||||
memcpy( _distortionCoeffs, distCoeffs.ptr(), 4*sizeof(double) );
|
||||
|
||||
vector<Mat>::iterator rvecsIt = rvecs.begin();
|
||||
vector<Mat>::iterator tvecsIt = tvecs.begin();
|
||||
@@ -788,8 +788,8 @@ void CV_CameraCalibrationTest_CPP::calibrate( int imageCount, int* pointCounts,
|
||||
{
|
||||
Mat r9( 3, 3, CV_64FC1 );
|
||||
Rodrigues( *rvecsIt, r9 );
|
||||
memcpy( rm, r9.data, 9*sizeof(double) );
|
||||
memcpy( tm, tvecsIt->data, 3*sizeof(double) );
|
||||
memcpy( rm, r9.ptr(), 9*sizeof(double) );
|
||||
memcpy( tm, tvecsIt->ptr(), 3*sizeof(double) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1430,7 +1430,7 @@ void CV_StereoCalibrationTest::run( int )
|
||||
{
|
||||
Mat left = imread(imglist[i*2]);
|
||||
Mat right = imread(imglist[i*2+1]);
|
||||
if(!left.data || !right.data)
|
||||
if(left.empty() || right.empty())
|
||||
{
|
||||
ts->printf( cvtest::TS::LOG, "Can not load images %s and %s, testcase %d\n",
|
||||
imglist[i*2].c_str(), imglist[i*2+1].c_str(), testcase );
|
||||
@@ -1722,7 +1722,7 @@ double CV_StereoCalibrationTest_C::calibrateStereoCamera( const vector<vector<Po
|
||||
for( int i = 0, ni = 0, j = 0; i < nimages; i++, j += ni )
|
||||
{
|
||||
ni = (int)objectPoints[i].size();
|
||||
((int*)npoints.data)[i] = ni;
|
||||
npoints.ptr<int>()[i] = ni;
|
||||
std::copy(objectPoints[i].begin(), objectPoints[i].end(), objPtData + j);
|
||||
std::copy(imagePoints1[i].begin(), imagePoints1[i].end(), imgPtData + j);
|
||||
std::copy(imagePoints2[i].begin(), imagePoints2[i].end(), imgPtData2 + j);
|
||||
|
||||
@@ -1021,12 +1021,12 @@ void CV_FundamentalMatTest::prepare_to_validation( int test_case_idx )
|
||||
cv::gemm( T, invA2, 1, Mat(), 0, F0 );
|
||||
F0 *= 1./f0[8];
|
||||
|
||||
uchar* status = test_mat[TEMP][1].data;
|
||||
uchar* status = test_mat[TEMP][1].ptr();
|
||||
double err_level = method <= CV_FM_8POINT ? 1 : get_success_error_level( test_case_idx, OUTPUT, 1 );
|
||||
uchar* mtfm1 = test_mat[REF_OUTPUT][1].data;
|
||||
uchar* mtfm2 = test_mat[OUTPUT][1].data;
|
||||
double* f_prop1 = (double*)test_mat[REF_OUTPUT][0].data;
|
||||
double* f_prop2 = (double*)test_mat[OUTPUT][0].data;
|
||||
uchar* mtfm1 = test_mat[REF_OUTPUT][1].ptr();
|
||||
uchar* mtfm2 = test_mat[OUTPUT][1].ptr();
|
||||
double* f_prop1 = test_mat[REF_OUTPUT][0].ptr<double>();
|
||||
double* f_prop2 = test_mat[OUTPUT][0].ptr<double>();
|
||||
|
||||
int i, pt_count = test_mat[INPUT][2].cols;
|
||||
Mat p1( 1, pt_count, CV_64FC2 );
|
||||
@@ -1357,12 +1357,12 @@ void CV_EssentialMatTest::prepare_to_validation( int test_case_idx )
|
||||
cv::gemm( T1, T2, 1, Mat(), 0, F0 );
|
||||
F0 *= 1./f0[8];
|
||||
|
||||
uchar* status = test_mat[TEMP][1].data;
|
||||
uchar* status = test_mat[TEMP][1].ptr();
|
||||
double err_level = get_success_error_level( test_case_idx, OUTPUT, 1 );
|
||||
uchar* mtfm1 = test_mat[REF_OUTPUT][1].data;
|
||||
uchar* mtfm2 = test_mat[OUTPUT][1].data;
|
||||
double* e_prop1 = (double*)test_mat[REF_OUTPUT][0].data;
|
||||
double* e_prop2 = (double*)test_mat[OUTPUT][0].data;
|
||||
uchar* mtfm1 = test_mat[REF_OUTPUT][1].ptr();
|
||||
uchar* mtfm2 = test_mat[OUTPUT][1].ptr();
|
||||
double* e_prop1 = test_mat[REF_OUTPUT][0].ptr<double>();
|
||||
double* e_prop2 = test_mat[OUTPUT][0].ptr<double>();
|
||||
Mat E_prop2 = Mat(3, 1, CV_64F, e_prop2);
|
||||
|
||||
int i, pt_count = test_mat[INPUT][2].cols;
|
||||
@@ -1407,8 +1407,8 @@ void CV_EssentialMatTest::prepare_to_validation( int test_case_idx )
|
||||
|
||||
|
||||
|
||||
double* pose_prop1 = (double*)test_mat[REF_OUTPUT][2].data;
|
||||
double* pose_prop2 = (double*)test_mat[OUTPUT][2].data;
|
||||
double* pose_prop1 = test_mat[REF_OUTPUT][2].ptr<double>();
|
||||
double* pose_prop2 = test_mat[OUTPUT][2].ptr<double>();
|
||||
double terr1 = cvtest::norm(Rt0.col(3) / norm(Rt0.col(3)) + test_mat[TEMP][3], NORM_L2);
|
||||
double terr2 = cvtest::norm(Rt0.col(3) / norm(Rt0.col(3)) - test_mat[TEMP][3], NORM_L2);
|
||||
Mat rvec;
|
||||
|
||||
@@ -142,7 +142,7 @@ protected:
|
||||
Mat_<double> res = Q * Mat_<double>(4, 1, from);
|
||||
res /= res(3, 0);
|
||||
|
||||
out3d_t pixel_exp = *(Vec3d*)res.data;
|
||||
out3d_t pixel_exp = *res.ptr<Vec3d>();
|
||||
out3d_t pixel_out = _3dImg(y, x);
|
||||
|
||||
const int largeZValue = 10000; /* see documentation */
|
||||
|
||||
Reference in New Issue
Block a user