Merge pull request #3094 from Adil-Ibragimov:minor_fixes_in_Mat-data

This commit is contained in:
Vadim Pisarevsky
2014-08-13 18:28:51 +00:00
134 changed files with 988 additions and 986 deletions

View File

@@ -2121,7 +2121,7 @@ MatConstIterator::MatConstIterator(const Mat* _m)
{
if( m && m->isContinuous() )
{
sliceStart = m->data;
sliceStart = m->ptr();
sliceEnd = sliceStart + m->total()*elemSize;
}
seek((const int*)0);
@@ -2134,7 +2134,7 @@ MatConstIterator::MatConstIterator(const Mat* _m, int _row, int _col)
CV_Assert(m && m->dims <= 2);
if( m->isContinuous() )
{
sliceStart = m->data;
sliceStart = m->ptr();
sliceEnd = sliceStart + m->total()*elemSize;
}
int idx[] = {_row, _col};
@@ -2148,7 +2148,7 @@ MatConstIterator::MatConstIterator(const Mat* _m, Point _pt)
CV_Assert(m && m->dims <= 2);
if( m->isContinuous() )
{
sliceStart = m->data;
sliceStart = m->ptr();
sliceEnd = sliceStart + m->total()*elemSize;
}
int idx[] = {_pt.y, _pt.x};

View File

@@ -1076,7 +1076,7 @@ void convertAndUnrollScalar( const Mat& sc, int buftype, uchar* scbuf, size_t bl
{
int scn = (int)sc.total(), cn = CV_MAT_CN(buftype);
size_t esz = CV_ELEM_SIZE(buftype);
getConvertFunc(sc.depth(), buftype)(sc.data, 1, 0, 1, scbuf, 1, Size(std::min(cn, scn), 1), 0);
getConvertFunc(sc.depth(), buftype)(sc.ptr(), 1, 0, 1, scbuf, 1, Size(std::min(cn, scn), 1), 0);
// unroll the scalar
if( scn < cn )
{
@@ -1215,7 +1215,7 @@ static void binary_op( InputArray _src1, InputArray _src2, OutputArray _dst,
if( len == (size_t)(int)len )
{
sz.width = (int)len;
func(src1.data, src1.step, src2.data, src2.step, dst.data, dst.step, sz, 0);
func(src1.ptr(), src1.step, src2.ptr(), src2.step, dst.ptr(), dst.step, sz, 0);
return;
}
}
@@ -1622,7 +1622,7 @@ static void arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst,
Mat src1 = psrc1->getMat(), src2 = psrc2->getMat(), dst = _dst.getMat();
Size sz = getContinuousSize(src1, src2, dst, src1.channels());
tab[depth1](src1.data, src1.step, src2.data, src2.step, dst.data, dst.step, sz, usrdata);
tab[depth1](src1.ptr(), src1.step, src2.ptr(), src2.step, dst.ptr(), dst.step, sz, usrdata);
return;
}
@@ -2985,7 +2985,7 @@ static bool ocl_compare(InputArray _src1, InputArray _src2, OutputArray _dst, in
else
{
double fval = 0;
getConvertFunc(depth2, CV_64F)(src2.data, 1, 0, 1, (uchar *)&fval, 1, Size(1, 1), 0);
getConvertFunc(depth2, CV_64F)(src2.ptr(), 1, 0, 1, (uchar *)&fval, 1, Size(1, 1), 0);
if( fval < getMinVal(depth1) )
return dst.setTo(Scalar::all(op == CMP_GT || op == CMP_GE || op == CMP_NE ? 255 : 0)), true;
@@ -3065,7 +3065,7 @@ void cv::compare(InputArray _src1, InputArray _src2, OutputArray _dst, int op)
_dst.create(src1.size(), CV_8UC(cn));
Mat dst = _dst.getMat();
Size sz = getContinuousSize(src1, src2, dst, src1.channels());
getCmpFunc(src1.depth())(src1.data, src1.step, src2.data, src2.step, dst.data, dst.step, sz, &op);
getCmpFunc(src1.depth())(src1.ptr(), src1.step, src2.ptr(), src2.step, dst.ptr(), dst.step, sz, &op);
return;
}
@@ -3106,7 +3106,7 @@ void cv::compare(InputArray _src1, InputArray _src2, OutputArray _dst, int op)
else
{
double fval=0;
getConvertFunc(depth2, CV_64F)(src2.data, 1, 0, 1, (uchar*)&fval, 1, Size(1,1), 0);
getConvertFunc(depth2, CV_64F)(src2.ptr(), 1, 0, 1, (uchar*)&fval, 1, Size(1,1), 0);
if( fval < getMinVal(depth1) )
{
dst = Scalar::all(op == CMP_GT || op == CMP_GE || op == CMP_NE ? 255 : 0);
@@ -3676,8 +3676,8 @@ static bool ocl_inRange( InputArray _src, InputArray _lowerb,
int* iubuf = ilbuf + cn;
BinaryFunc sccvtfunc = getConvertFunc(ldepth, CV_32S);
sccvtfunc(lscalar.data, 1, 0, 1, (uchar*)ilbuf, 1, Size(cn, 1), 0);
sccvtfunc(uscalar.data, 1, 0, 1, (uchar*)iubuf, 1, Size(cn, 1), 0);
sccvtfunc(lscalar.ptr(), 1, 0, 1, (uchar*)ilbuf, 1, Size(cn, 1), 0);
sccvtfunc(uscalar.ptr(), 1, 0, 1, (uchar*)iubuf, 1, Size(cn, 1), 0);
int minval = cvRound(getMinVal(sdepth)), maxval = cvRound(getMaxVal(sdepth));
for( int k = 0; k < cn; k++ )
@@ -3787,8 +3787,8 @@ void cv::inRange(InputArray _src, InputArray _lowerb,
int* iubuf = ilbuf + cn;
BinaryFunc sccvtfunc = getConvertFunc(scdepth, CV_32S);
sccvtfunc(lb.data, 1, 0, 1, (uchar*)ilbuf, 1, Size(cn, 1), 0);
sccvtfunc(ub.data, 1, 0, 1, (uchar*)iubuf, 1, Size(cn, 1), 0);
sccvtfunc(lb.ptr(), 1, 0, 1, (uchar*)ilbuf, 1, Size(cn, 1), 0);
sccvtfunc(ub.ptr(), 1, 0, 1, (uchar*)iubuf, 1, Size(cn, 1), 0);
int minval = cvRound(getMinVal(depth)), maxval = cvRound(getMaxVal(depth));
for( int k = 0; k < cn; k++ )

View File

@@ -1815,7 +1815,7 @@ void cv::convertScaleAbs( InputArray _src, OutputArray _dst, double alpha, doubl
if( src.dims <= 2 )
{
Size sz = getContinuousSize(src, dst, cn);
func( src.data, src.step, 0, 0, dst.data, dst.step, sz, scale );
func( src.ptr(), src.step, 0, 0, dst.ptr(), dst.step, sz, scale );
}
else
{
@@ -2054,7 +2054,7 @@ public:
CV_DbgAssert(lutcn == 3 || lutcn == 4);
if (lutcn == 3)
{
IppStatus status = ippiCopy_8u_C3P3R(lut.data, (int)lut.step[0], lutTable, (int)lut.step[0], sz256);
IppStatus status = ippiCopy_8u_C3P3R(lut.ptr(), (int)lut.step[0], lutTable, (int)lut.step[0], sz256);
if (status < 0)
{
setIppErrorStatus();
@@ -2063,7 +2063,7 @@ public:
}
else if (lutcn == 4)
{
IppStatus status = ippiCopy_8u_C4P4R(lut.data, (int)lut.step[0], lutTable, (int)lut.step[0], sz256);
IppStatus status = ippiCopy_8u_C4P4R(lut.ptr(), (int)lut.step[0], lutTable, (int)lut.step[0], sz256);
if (status < 0)
{
setIppErrorStatus();
@@ -2096,14 +2096,14 @@ public:
if (lutcn == 3)
{
if (ippiLUTPalette_8u_C3R(
src.data, (int)src.step[0], dst.data, (int)dst.step[0],
src.ptr(), (int)src.step[0], dst.ptr(), (int)dst.step[0],
ippiSize(dst.size()), lutTable, 8) >= 0)
return;
}
else if (lutcn == 4)
{
if (ippiLUTPalette_8u_C4R(
src.data, (int)src.step[0], dst.data, (int)dst.step[0],
src.ptr(), (int)src.step[0], dst.ptr(), (int)dst.step[0],
ippiSize(dst.size()), lutTable, 8) >= 0)
return;
}
@@ -2153,7 +2153,7 @@ public:
int len = (int)it.size;
for( size_t i = 0; i < it.nplanes; i++, ++it )
func(ptrs[0], lut_.data, ptrs[1], len, cn, lutcn);
func(ptrs[0], lut_.ptr(), ptrs[1], len, cn, lutcn);
}
private:
LUTParallelBody(const LUTParallelBody&);
@@ -2225,7 +2225,7 @@ void cv::LUT( InputArray _src, InputArray _lut, OutputArray _dst )
int len = (int)it.size;
for( size_t i = 0; i < it.nplanes; i++, ++it )
func(ptrs[0], lut.data, ptrs[1], len, cn, lutcn);
func(ptrs[0], lut.ptr(), ptrs[1], len, cn, lutcn);
}
namespace cv {

View File

@@ -741,25 +741,25 @@ void flip( InputArray _src, OutputArray _dst, int flip_mode )
if (ippFunc != 0)
{
if (ippFunc(src.data, (int)src.step, dst.data, (int)dst.step, ippiSize(src.cols, src.rows), axis) >= 0)
if (ippFunc(src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, ippiSize(src.cols, src.rows), axis) >= 0)
return;
setIppErrorStatus();
}
else if (ippFuncI != 0)
{
if (ippFuncI(dst.data, (int)dst.step, roisize, axis) >= 0)
if (ippFuncI(dst.ptr(), (int)dst.step, roisize, axis) >= 0)
return;
setIppErrorStatus();
}
#endif
if( flip_mode <= 0 )
flipVert( src.data, src.step, dst.data, dst.step, src.size(), esz );
flipVert( src.ptr(), src.step, dst.ptr(), dst.step, src.size(), esz );
else
flipHoriz( src.data, src.step, dst.data, dst.step, src.size(), esz );
flipHoriz( src.ptr(), src.step, dst.ptr(), dst.step, src.size(), esz );
if( flip_mode < 0 )
flipHoriz( dst.data, dst.step, dst.data, dst.step, dst.size(), esz );
flipHoriz( dst.ptr(), dst.step, dst.ptr(), dst.step, dst.size(), esz );
}
#if defined HAVE_OPENCL && !defined __APPLE__
@@ -814,11 +814,11 @@ void repeat(InputArray _src, int ny, int nx, OutputArray _dst)
for( y = 0; y < ssize.height; y++ )
{
for( x = 0; x < dsize.width; x += ssize.width )
memcpy( dst.data + y*dst.step + x, src.data + y*src.step, ssize.width );
memcpy( dst.ptr(y) + x, src.ptr(y), ssize.width );
}
for( ; y < dsize.height; y++ )
memcpy( dst.data + y*dst.step, dst.data + (y - ssize.height)*dst.step, dsize.width );
memcpy( dst.ptr(y), dst.ptr(y - ssize.height), dsize.width );
}
Mat repeat(const Mat& src, int ny, int nx)
@@ -1220,8 +1220,8 @@ void cv::copyMakeBorder( InputArray _src, OutputArray _dst, int top, int bottom,
#endif
if( borderType != BORDER_CONSTANT )
copyMakeBorder_8u( src.data, src.step, src.size(),
dst.data, dst.step, dst.size(),
copyMakeBorder_8u( src.ptr(), src.step, src.size(),
dst.ptr(), dst.step, dst.size(),
top, left, (int)src.elemSize(), borderType );
else
{
@@ -1233,8 +1233,8 @@ void cv::copyMakeBorder( InputArray _src, OutputArray _dst, int top, int bottom,
cn1 = 1;
}
scalarToRawData(value, buf, CV_MAKETYPE(src.depth(), cn1), cn);
copyMakeConstBorder_8u( src.data, src.step, src.size(),
dst.data, dst.step, dst.size(),
copyMakeConstBorder_8u( src.ptr(), src.step, src.size(),
dst.ptr(), dst.step, dst.size(),
top, left, (int)src.elemSize(), (uchar*)(double*)buf );
}
}

View File

@@ -3672,7 +3672,7 @@ void KDTree::build(InputArray __points, InputArray __labels, bool _copyData)
{
int nlabels = _labels.checkVector(1, CV_32S, true);
CV_Assert(nlabels == n);
_labels_data = (const int*)_labels.data;
_labels_data = _labels.ptr<int>();
}
Mat sumstack(MAX_TREE_DEPTH*2, ptdims*2, CV_64F);
@@ -3992,7 +3992,7 @@ void KDTree::getPoints(InputArray _idx, OutputArray _pts, OutputArray _labels) c
int k = idx[i];
CV_Assert( (unsigned)k < (unsigned)points.rows );
const float* src = points.ptr<float>(k);
if( pts.data )
if( !pts.empty() )
std::copy(src, src + ptdims, pts.ptr<float>(i));
if( dstlabels )
dstlabels[i] = srclabels ? srclabels[k] : k;

View File

@@ -228,7 +228,7 @@ LineIterator::LineIterator(const Mat& img, Point pt1, Point pt2,
count = dx + dy + 1;
}
this->ptr0 = img.data;
this->ptr0 = img.ptr();
this->step = (int)img.step;
this->elemSize = bt_pix0;
}
@@ -291,7 +291,7 @@ LineAA( Mat& img, Point pt1, Point pt2, const void* color )
int cb = ((uchar*)color)[0], cg = ((uchar*)color)[1], cr = ((uchar*)color)[2];
int _cb, _cg, _cr;
int nch = img.channels();
uchar* ptr = img.data;
uchar* ptr = img.ptr();
size_t step = img.step;
Size size = img.size();
@@ -558,7 +558,7 @@ Line2( Mat& img, Point pt1, Point pt2, const void* color )
int cg = ((uchar*)color)[1];
int cr = ((uchar*)color)[2];
int pix_size = (int)img.elemSize();
uchar *ptr = img.data, *tptr;
uchar *ptr = img.ptr(), *tptr;
size_t step = img.step;
Size size = img.size(), sizeScaled(size.width*XY_ONE, size.height*XY_ONE);
@@ -961,7 +961,7 @@ FillConvexPoly( Mat& img, const Point* v, int npts, const void* color, int line_
int i, y, imin = 0, left = 0, right = 1, x1, x2;
int edges = npts;
int xmin, xmax, ymin, ymax;
uchar* ptr = img.data;
uchar* ptr = img.ptr();
Size size = img.size();
int pix_size = (int)img.elemSize();
Point p0;
@@ -1251,7 +1251,7 @@ FillEdgeCollection( Mat& img, std::vector<PolyEdge>& edges, const void* color )
if( !clipline )
{
// convert x's from fixed-point to image coordinates
uchar *timg = img.data + y * img.step;
uchar *timg = img.ptr(y);
int x1 = keep_prelast->x;
int x2 = prelast->x;
@@ -1323,7 +1323,7 @@ Circle( Mat& img, Point center, int radius, const void* color, int fill )
Size size = img.size();
size_t step = img.step;
int pix_size = (int)img.elemSize();
uchar* ptr = img.data;
uchar* ptr = img.ptr();
int err = 0, dx = radius, dy = 0, plus = 1, minus = (radius << 1) - 1;
int inside = center.x >= radius && center.x < size.width - radius &&
center.y >= radius && center.y < size.height - radius;
@@ -2048,7 +2048,7 @@ void cv::fillConvexPoly(InputOutputArray _img, InputArray _points,
{
Mat img = _img.getMat(), points = _points.getMat();
CV_Assert(points.checkVector(2, CV_32S) >= 0);
fillConvexPoly(img, (const Point*)points.data, points.rows*points.cols*points.channels()/2, color, lineType, shift);
fillConvexPoly(img, points.ptr<Point>(), points.rows*points.cols*points.channels()/2, color, lineType, shift);
}
@@ -2068,7 +2068,7 @@ void cv::fillPoly(InputOutputArray _img, InputArrayOfArrays pts,
{
Mat p = pts.getMat(i);
CV_Assert(p.checkVector(2, CV_32S) >= 0);
ptsptr[i] = (Point*)p.data;
ptsptr[i] = p.ptr<Point>();
npts[i] = p.rows*p.cols*p.channels()/2;
}
fillPoly(img, (const Point**)ptsptr, npts, (int)ncontours, color, lineType, shift, offset);
@@ -2096,7 +2096,7 @@ void cv::polylines(InputOutputArray _img, InputArrayOfArrays pts,
if( p.total() == 0 )
continue;
CV_Assert(p.checkVector(2, CV_32S) >= 0);
ptsptr[i] = (Point*)p.data;
ptsptr[i] = p.ptr<Point>();
npts[i] = p.rows*p.cols*p.channels()/2;
}
polylines(img, (const Point**)ptsptr, npts, (int)ncontours, isClosed, color, thickness, lineType, shift);
@@ -2116,7 +2116,7 @@ static void addChildContour(InputArrayOfArrays contours,
{
Mat ci = contours.getMat(i);
cvMakeSeqHeaderForArray(CV_SEQ_POLYGON, sizeof(CvSeq), sizeof(Point),
!ci.empty() ? (void*)ci.data : 0, (int)ci.total(),
!ci.empty() ? (void*)ci.ptr() : 0, (int)ci.total(),
&seq[i], &block[i] );
int h_next = hierarchy[i][0], h_prev = hierarchy[i][1],
@@ -2169,7 +2169,7 @@ void cv::drawContours( InputOutputArray _image, InputArrayOfArrays _contours,
int npoints = ci.checkVector(2, CV_32S);
CV_Assert( npoints > 0 );
cvMakeSeqHeaderForArray( CV_SEQ_POLYGON, sizeof(CvSeq), sizeof(Point),
ci.data, npoints, &seq[i], &block[i] );
ci.ptr(), npoints, &seq[i], &block[i] );
}
if( hierarchy.empty() || maxLevel == 0 )

View File

@@ -1547,7 +1547,7 @@ public:
}
for( int i = range.start; i < range.end; ++i)
if(!ippidft((Ipp32fc*)(src.data+i*src.step), (int)src.step,(Ipp32fc*)(dst.data+i*dst.step), (int)dst.step, pDFTSpec, (Ipp8u*)pBuffer))
if(!ippidft(src.ptr<Ipp32fc>(i), (int)src.step,dst.ptr<Ipp32fc>(i), (int)dst.step, pDFTSpec, (Ipp8u*)pBuffer))
{
*ok = false;
}
@@ -1718,9 +1718,9 @@ static bool ippi_DFT_C_32F(const Mat& src, Mat& dst, bool inv, int norm_flag)
}
if (!inv)
status = ippiDFTFwd_CToC_32fc_C1R( (Ipp32fc*)src.data, (int)src.step, (Ipp32fc*)dst.data, (int)dst.step, pDFTSpec, pBuffer );
status = ippiDFTFwd_CToC_32fc_C1R( src.ptr<Ipp32fc>(), (int)src.step, dst.ptr<Ipp32fc>(), (int)dst.step, pDFTSpec, pBuffer );
else
status = ippiDFTInv_CToC_32fc_C1R( (Ipp32fc*)src.data, (int)src.step, (Ipp32fc*)dst.data, (int)dst.step, pDFTSpec, pBuffer );
status = ippiDFTInv_CToC_32fc_C1R( src.ptr<Ipp32fc>(), (int)src.step, dst.ptr<Ipp32fc>(), (int)dst.step, pDFTSpec, pBuffer );
if ( sizeBuffer > 0 )
ippFree( pBuffer );
@@ -2661,8 +2661,8 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows )
{
int a = 0, b = count;
uchar *buf0, *buf1, *dbuf0, *dbuf1;
const uchar* sptr0 = src.data;
uchar* dptr0 = dst.data;
const uchar* sptr0 = src.ptr();
uchar* dptr0 = dst.ptr();
buf0 = ptr;
ptr += len*complex_elem_size;
buf1 = ptr;
@@ -2911,9 +2911,9 @@ void cv::mulSpectrums( InputArray _srcA, InputArray _srcB,
if( depth == CV_32F )
{
const float* dataA = (const float*)srcA.data;
const float* dataB = (const float*)srcB.data;
float* dataC = (float*)dst.data;
const float* dataA = srcA.ptr<float>();
const float* dataB = srcB.ptr<float>();
float* dataC = dst.ptr<float>();
size_t stepA = srcA.step/sizeof(dataA[0]);
size_t stepB = srcB.step/sizeof(dataB[0]);
@@ -2978,9 +2978,9 @@ void cv::mulSpectrums( InputArray _srcA, InputArray _srcB,
}
else
{
const double* dataA = (const double*)srcA.data;
const double* dataB = (const double*)srcB.data;
double* dataC = (double*)dst.data;
const double* dataA = srcA.ptr<double>();
const double* dataB = srcB.ptr<double>();
double* dataC = dst.ptr<double>();
size_t stepA = srcA.step/sizeof(dataA[0]);
size_t stepB = srcB.step/sizeof(dataB[0]);
@@ -3299,7 +3299,7 @@ public:
pBuffer = (uchar*)buf;
for( int i = range.start; i < range.end; ++i)
if(!(*ippidct)((float*)(src->data+i*src->step), (int)src->step,(float*)(dst->data+i*dst->step), (int)dst->step, pDCTSpec, (Ipp8u*)pBuffer))
if(!(*ippidct)(src->ptr<float>(i), (int)src->step,dst->ptr<float>(i), (int)dst->step, pDCTSpec, (Ipp8u*)pBuffer))
*ok = false;
}
else
@@ -3368,7 +3368,7 @@ static bool ippi_DCT_32f(const Mat& src, Mat& dst, bool inv, bool row)
buf.allocate( bufSize );
pBuffer = (uchar*)buf;
status = ippFunc((float*)src.data, (int)src.step, (float*)dst.data, (int)dst.step, pDCTSpec, (Ipp8u*)pBuffer);
status = ippFunc(src.ptr<float>(), (int)src.step, dst.ptr<float>(), (int)dst.step, pDCTSpec, (Ipp8u*)pBuffer);
}
if (pDCTSpec)
@@ -3438,7 +3438,8 @@ void cv::dct( InputArray _src0, OutputArray _dst, int flags )
for( ; stage <= end_stage; stage++ )
{
uchar *sptr = src.data, *dptr = dst.data;
const uchar* sptr = src.ptr();
uchar* dptr = dst.ptr();
size_t sstep0, sstep1, dstep0, dstep1;
if( stage == 0 )

View File

@@ -859,7 +859,7 @@ double cv::determinant( InputArray _mat )
double result = 0;
int type = mat.type(), rows = mat.rows;
size_t step = mat.step;
const uchar* m = mat.data;
const uchar* m = mat.ptr();
CV_Assert( !mat.empty() );
CV_Assert( mat.rows == mat.cols && (type == CV_32F || type == CV_64F));
@@ -882,11 +882,11 @@ double cv::determinant( InputArray _mat )
Mat a(rows, rows, CV_32F, (uchar*)buffer);
mat.copyTo(a);
result = LU((float*)a.data, a.step, rows, 0, 0, 0);
result = LU(a.ptr<float>(), a.step, rows, 0, 0, 0);
if( result )
{
for( int i = 0; i < rows; i++ )
result *= ((const float*)(a.data + a.step*i))[i];
result *= a.at<float>(i,i);
result = 1./result;
}
}
@@ -906,11 +906,11 @@ double cv::determinant( InputArray _mat )
Mat a(rows, rows, CV_64F, (uchar*)buffer);
mat.copyTo(a);
result = LU((double*)a.data, a.step, rows, 0, 0, 0);
result = LU(a.ptr<double>(), a.step, rows, 0, 0, 0);
if( result )
{
for( int i = 0; i < rows; i++ )
result *= ((const double*)(a.data + a.step*i))[i];
result *= a.at<double>(i,i);
result = 1./result;
}
}
@@ -949,8 +949,8 @@ double cv::invert( InputArray _src, OutputArray _dst, int method )
AutoBuffer<uchar> _buf((m*nm + nm + nm*n)*esz + sizeof(double));
uchar* buf = alignPtr((uchar*)_buf, (int)esz);
Mat u(m, nm, type, buf);
Mat w(nm, 1, type, u.data + m*nm*esz);
Mat vt(nm, n, type, w.data + nm*esz);
Mat w(nm, 1, type, u.ptr() + m*nm*esz);
Mat vt(nm, n, type, w.ptr() + nm*esz);
SVD::compute(src, w, u, vt);
SVD::backSubst(w, u, vt, Mat(), _dst);
@@ -968,8 +968,8 @@ double cv::invert( InputArray _src, OutputArray _dst, int method )
AutoBuffer<uchar> _buf((n*n*2 + n)*esz + sizeof(double));
uchar* buf = alignPtr((uchar*)_buf, (int)esz);
Mat u(n, n, type, buf);
Mat w(n, 1, type, u.data + n*n*esz);
Mat vt(n, n, type, w.data + n*esz);
Mat w(n, 1, type, u.ptr() + n*n*esz);
Mat vt(n, n, type, w.ptr() + n*esz);
eigen(src, w, vt);
transpose(vt, u);
@@ -988,8 +988,8 @@ double cv::invert( InputArray _src, OutputArray _dst, int method )
if( n <= 3 )
{
const uchar* srcdata = src.data;
uchar* dstdata = dst.data;
const uchar* srcdata = src.ptr();
uchar* dstdata = dst.ptr();
size_t srcstep = src.step;
size_t dststep = dst.step;
@@ -1169,13 +1169,13 @@ double cv::invert( InputArray _src, OutputArray _dst, int method )
setIdentity(dst);
if( method == DECOMP_LU && type == CV_32F )
result = LU((float*)src1.data, src1.step, n, (float*)dst.data, dst.step, n) != 0;
result = LU(src1.ptr<float>(), src1.step, n, dst.ptr<float>(), dst.step, n) != 0;
else if( method == DECOMP_LU && type == CV_64F )
result = LU((double*)src1.data, src1.step, n, (double*)dst.data, dst.step, n) != 0;
result = LU(src1.ptr<double>(), src1.step, n, dst.ptr<double>(), dst.step, n) != 0;
else if( method == DECOMP_CHOLESKY && type == CV_32F )
result = Cholesky((float*)src1.data, src1.step, n, (float*)dst.data, dst.step, n);
result = Cholesky(src1.ptr<float>(), src1.step, n, dst.ptr<float>(), dst.step, n);
else
result = Cholesky((double*)src1.data, src1.step, n, (double*)dst.data, dst.step, n);
result = Cholesky(src1.ptr<double>(), src1.step, n, dst.ptr<double>(), dst.step, n);
if( !result )
dst = Scalar(0);
@@ -1212,9 +1212,9 @@ bool cv::solve( InputArray _src, InputArray _src2arg, OutputArray _dst, int meth
#define bf(y) ((float*)(bdata + y*src2step))[0]
#define bd(y) ((double*)(bdata + y*src2step))[0]
const uchar* srcdata = src.data;
const uchar* bdata = _src2.data;
uchar* dstdata = dst.data;
const uchar* srcdata = src.ptr();
const uchar* bdata = _src2.ptr();
uchar* dstdata = dst.ptr();
size_t srcstep = src.step;
size_t src2step = _src2.step;
size_t dststep = dst.step;
@@ -1709,23 +1709,23 @@ cvEigenVV( CvArr* srcarr, CvArr* evectsarr, CvArr* evalsarr, double,
eigen(src, evals, evects);
if( evects0.data != evects.data )
{
const uchar* p = evects0.data;
const uchar* p = evects0.ptr();
evects.convertTo(evects0, evects0.type());
CV_Assert( p == evects0.data );
CV_Assert( p == evects0.ptr() );
}
}
else
eigen(src, evals);
if( evals0.data != evals.data )
{
const uchar* p = evals0.data;
const uchar* p = evals0.ptr();
if( evals0.size() == evals.size() )
evals.convertTo(evals0, evals0.type());
else if( evals0.type() == evals.type() )
cv::transpose(evals, evals0);
else
cv::Mat(evals.t()).convertTo(evals0, evals0.type());
CV_Assert( p == evals0.data );
CV_Assert( p == evals0.ptr() );
}
}
@@ -1743,7 +1743,7 @@ cvSVD( CvArr* aarr, CvArr* warr, CvArr* uarr, CvArr* varr, int flags )
cv::SVD svd;
if( w.size() == cv::Size(nm, 1) )
svd.w = cv::Mat(nm, 1, type, w.data );
svd.w = cv::Mat(nm, 1, type, w.ptr() );
else if( w.isContinuous() )
svd.w = w;
@@ -1766,7 +1766,7 @@ cvSVD( CvArr* aarr, CvArr* warr, CvArr* uarr, CvArr* varr, int flags )
((m != n && (svd.u.size() == cv::Size(mn, mn) ||
svd.vt.size() == cv::Size(mn, mn))) ? cv::SVD::FULL_UV : 0));
if( u.data )
if( !u.empty() )
{
if( flags & CV_SVD_U_T )
cv::transpose( svd.u, u );
@@ -1777,7 +1777,7 @@ cvSVD( CvArr* aarr, CvArr* warr, CvArr* uarr, CvArr* varr, int flags )
}
}
if( v.data )
if( !v.empty() )
{
if( !(flags & CV_SVD_V_T) )
cv::transpose( svd.vt, v );

View File

@@ -786,7 +786,7 @@ void polarToCart( InputArray src1, InputArray src2,
depth == CV_64F ? (ippsPolarToCart)ippsPolarToCart_64f : 0;
CV_Assert(ippFunc != 0);
IppStatus status = ippFunc(Mag.data, Angle.data, X.data, Y.data, static_cast<int>(cn * X.total()));
IppStatus status = ippFunc(Mag.ptr(), Angle.ptr(), X.ptr(), Y.ptr(), static_cast<int>(cn * X.total()));
if (status >= 0)
return;
setIppErrorStatus();
@@ -2220,7 +2220,7 @@ void pow( InputArray _src, double power, OutputArray _dst )
}
size.width *= cn;
IppStatus status = ippiSqr_32f_C1R((const Ipp32f *)src.data, srcstep, (Ipp32f *)dst.data, dststep, ippiSize(size.width, size.height));
IppStatus status = ippiSqr_32f_C1R(src.ptr<Ipp32f>(), srcstep, dst.ptr<Ipp32f>(), dststep, ippiSize(size.width, size.height));
if (status >= 0)
return;
@@ -2278,8 +2278,8 @@ void pow( InputArray _src, double power, OutputArray _dst )
if (src.isContinuous() && dst.isContinuous())
{
IppStatus status = depth == CV_32F ?
ippsPowx_32f_A21((const Ipp32f *)src.data, (Ipp32f)power, (Ipp32f*)dst.data, (Ipp32s)(src.total() * cn)) :
ippsPowx_64f_A50((const Ipp64f *)src.data, power, (Ipp64f*)dst.data, (Ipp32s)(src.total() * cn));
ippsPowx_32f_A21(src.ptr<Ipp32f>(), (Ipp32f)power, dst.ptr<Ipp32f>(), (Ipp32s)(src.total() * cn)) :
ippsPowx_64f_A50(src.ptr<Ipp64f>(), power, dst.ptr<Ipp64f>(), (Ipp32s)(src.total() * cn));
if (status >= 0)
return;
@@ -2451,7 +2451,7 @@ bool checkRange(InputArray _src, bool quiet, Point* pt, double minVal, double ma
{
Cv32suf a, b;
int ia, ib;
const int* isrc = (const int*)src.data;
const int* isrc = src.ptr<int>();
size_t step = src.step/sizeof(isrc[0]);
a.f = (float)std::max(minVal, (double)-FLT_MAX);
@@ -2480,7 +2480,7 @@ bool checkRange(InputArray _src, bool quiet, Point* pt, double minVal, double ma
{
Cv64suf a, b;
int64 ia, ib;
const int64* isrc = (const int64*)src.data;
const int64* isrc = src.ptr<int64>();
size_t step = src.step/sizeof(isrc[0]);
a.f = minVal;

View File

@@ -822,7 +822,7 @@ void cv::gemm( InputArray matA, InputArray matB, double alpha,
break;
}
if( C.data )
if( !C.empty() )
{
CV_Assert( C.type() == type &&
(((flags&GEMM_3_T) == 0 && C.rows == d_size.height && C.cols == d_size.width) ||
@@ -841,9 +841,9 @@ void cv::gemm( InputArray matA, InputArray matB, double alpha,
{
if( type == CV_32F )
{
float* d = (float*)D.data;
const float *a = (const float*)A.data,
*b = (const float*)B.data,
float* d = D.ptr<float>();
const float *a = A.ptr<float>(),
*b = B.ptr<float>(),
*c = (const float*)C.data;
size_t d_step = D.step/sizeof(d[0]),
a_step = A.step/sizeof(a[0]),
@@ -969,9 +969,9 @@ void cv::gemm( InputArray matA, InputArray matB, double alpha,
if( type == CV_64F )
{
double* d = (double*)D.data;
const double *a = (const double*)A.data,
*b = (const double*)B.data,
double* d = D.ptr<double>();
const double *a = A.ptr<double>(),
*b = B.ptr<double>(),
*c = (const double*)C.data;
size_t d_step = D.step/sizeof(d[0]),
a_step = A.step/sizeof(a[0]),
@@ -1211,8 +1211,8 @@ void cv::gemm( InputArray matA, InputArray matB, double alpha,
(d_size.width <= block_lin_size &&
d_size.height <= block_lin_size && len <= block_lin_size) )
{
singleMulFunc( A.data, A.step, B.data, b_step, Cdata, Cstep,
matD->data, matD->step, a_size, d_size, alpha, beta, flags );
singleMulFunc( A.ptr(), A.step, B.ptr(), b_step, Cdata, Cstep,
matD->ptr(), matD->step, a_size, d_size, alpha, beta, flags );
}
else
{
@@ -1239,7 +1239,7 @@ void cv::gemm( InputArray matA, InputArray matB, double alpha,
else
b_step0 = elem_size, b_step1 = b_step;
if( !C.data )
if( C.empty() )
{
c_step0 = c_step1 = 0;
flags &= ~GEMM_3_T;
@@ -1285,7 +1285,7 @@ void cv::gemm( InputArray matA, InputArray matB, double alpha,
for( j = 0; j < d_size.width; j += dj )
{
uchar* _d = matD->data + i*matD->step + j*elem_size;
uchar* _d = matD->ptr() + i*matD->step + j*elem_size;
const uchar* _c = Cdata + i*c_step0 + j*c_step1;
size_t _d_step = matD->step;
dj = dn0;
@@ -1302,9 +1302,9 @@ void cv::gemm( InputArray matA, InputArray matB, double alpha,
for( k = 0; k < len; k += dk )
{
const uchar* _a = A.data + i*a_step0 + k*a_step1;
const uchar* _a = A.ptr() + i*a_step0 + k*a_step1;
size_t _a_step = A.step;
const uchar* _b = B.data + k*b_step0 + j*b_step1;
const uchar* _b = B.ptr() + k*b_step0 + j*b_step1;
size_t _b_step = b_step;
Size a_bl_size;
@@ -1349,7 +1349,7 @@ void cv::gemm( InputArray matA, InputArray matB, double alpha,
if( dk0 < len )
storeFunc( _c, Cstep, _d, _d_step,
matD->data + i*matD->step + j*elem_size,
matD->ptr(i) + j*elem_size,
matD->step, Size(dj,di), alpha, beta, flags );
}
}
@@ -1858,7 +1858,7 @@ void cv::transform( InputArray _src, OutputArray _dst, InputArray _mtx )
_mbuf.allocate(dcn*(scn+1));
mbuf = (double*)_mbuf;
Mat tmp(dcn, scn+1, mtype, mbuf);
memset(tmp.data, 0, tmp.total()*tmp.elemSize());
memset(tmp.ptr(), 0, tmp.total()*tmp.elemSize());
if( m.cols == scn+1 )
m.convertTo(tmp, mtype);
else
@@ -1869,7 +1869,7 @@ void cv::transform( InputArray _src, OutputArray _dst, InputArray _mtx )
m = tmp;
}
else
mbuf = (double*)m.data;
mbuf = m.ptr<double>();
if( scn == dcn )
{
@@ -2039,7 +2039,7 @@ void cv::perspectiveTransform( InputArray _src, OutputArray _dst, InputArray _mt
m = tmp;
}
else
mbuf = (double*)m.data;
mbuf = m.ptr<double>();
TransformFunc func = depth == CV_32F ?
(TransformFunc)perspectiveTransform_32f :
@@ -2227,7 +2227,7 @@ void cv::scaleAdd( InputArray _src1, double alpha, InputArray _src2, OutputArray
if (src1.isContinuous() && src2.isContinuous() && dst.isContinuous())
{
size_t len = src1.total()*cn;
func(src1.data, src2.data, dst.data, (int)len, palpha);
func(src1.ptr(), src2.ptr(), dst.ptr(), (int)len, palpha);
return;
}
@@ -2271,7 +2271,7 @@ void cv::calcCovarMatrix( const Mat* data, int nsamples, Mat& covar, Mat& _mean,
{
CV_Assert( data[i].size() == size && data[i].type() == type );
if( data[i].isContinuous() )
memcpy( _data.ptr(i), data[i].data, sz*esz );
memcpy( _data.ptr(i), data[i].ptr(), sz*esz );
else
{
Mat dataRow(size.height, size.width, type, _data.ptr(i));
@@ -2392,12 +2392,12 @@ double cv::Mahalanobis( InputArray _v1, InputArray _v2, InputArray _icovar )
if( depth == CV_32F )
{
const float* src1 = (const float*)v1.data;
const float* src2 = (const float*)v2.data;
const float* src1 = v1.ptr<float>();
const float* src2 = v2.ptr<float>();
size_t step1 = v1.step/sizeof(src1[0]);
size_t step2 = v2.step/sizeof(src2[0]);
double* diff = buf;
const float* mat = (const float*)icovar.data;
const float* mat = icovar.ptr<float>();
size_t matstep = icovar.step/sizeof(mat[0]);
for( ; sz.height--; src1 += step1, src2 += step2, diff += sz.width )
@@ -2423,12 +2423,12 @@ double cv::Mahalanobis( InputArray _v1, InputArray _v2, InputArray _icovar )
}
else if( depth == CV_64F )
{
const double* src1 = (const double*)v1.data;
const double* src2 = (const double*)v2.data;
const double* src1 = v1.ptr<double>();
const double* src2 = v2.ptr<double>();
size_t step1 = v1.step/sizeof(src1[0]);
size_t step2 = v2.step/sizeof(src2[0]);
double* diff = buf;
const double* mat = (const double*)icovar.data;
const double* mat = icovar.ptr<double>();
size_t matstep = icovar.step/sizeof(mat[0]);
for( ; sz.height--; src1 += step1, src2 += step2, diff += sz.width )
@@ -2469,9 +2469,9 @@ template<typename sT, typename dT> static void
MulTransposedR( const Mat& srcmat, Mat& dstmat, const Mat& deltamat, double scale )
{
int i, j, k;
const sT* src = (const sT*)srcmat.data;
dT* dst = (dT*)dstmat.data;
const dT* delta = (const dT*)deltamat.data;
const sT* src = srcmat.ptr<sT>();
dT* dst = dstmat.ptr<dT>();
const dT* delta = deltamat.ptr<dT>();
size_t srcstep = srcmat.step/sizeof(src[0]);
size_t dststep = dstmat.step/sizeof(dst[0]);
size_t deltastep = deltamat.rows > 1 ? deltamat.step/sizeof(delta[0]) : 0;
@@ -2588,9 +2588,9 @@ template<typename sT, typename dT> static void
MulTransposedL( const Mat& srcmat, Mat& dstmat, const Mat& deltamat, double scale )
{
int i, j, k;
const sT* src = (const sT*)srcmat.data;
dT* dst = (dT*)dstmat.data;
const dT* delta = (const dT*)deltamat.data;
const sT* src = srcmat.ptr<sT>();
dT* dst = dstmat.ptr<dT>();
const dT* delta = deltamat.ptr<dT>();
size_t srcstep = srcmat.step/sizeof(src[0]);
size_t dststep = dstmat.step/sizeof(dst[0]);
size_t deltastep = deltamat.rows > 1 ? deltamat.step/sizeof(delta[0]) : 0;
@@ -2669,7 +2669,7 @@ void cv::mulTransposed( InputArray _src, OutputArray _dst, bool ata,
dtype = std::max(std::max(CV_MAT_DEPTH(dtype >= 0 ? dtype : stype), delta.depth()), CV_32F);
CV_Assert( src.channels() == 1 );
if( delta.data )
if( !delta.empty() )
{
CV_Assert( delta.channels() == 1 &&
(delta.rows == src.rows || delta.rows == 1) &&
@@ -2688,7 +2688,7 @@ void cv::mulTransposed( InputArray _src, OutputArray _dst, bool ata,
{
Mat src2;
const Mat* tsrc = &src;
if( delta.data )
if( !delta.empty() )
{
if( delta.size() == src.size() )
subtract( src, delta, src2 );
@@ -3012,7 +3012,7 @@ PCA& PCA::operator()(InputArray _data, InputArray __mean, int flags, int maxComp
Mat covar( count, count, ctype );
if( _mean.data )
if( !_mean.empty() )
{
CV_Assert( _mean.size() == mean_sz );
_mean.convertTo(mean, ctype);
@@ -3148,7 +3148,7 @@ PCA& PCA::operator()(InputArray _data, InputArray __mean, int flags, double reta
Mat covar( count, count, ctype );
if( _mean.data )
if( !_mean.empty() )
{
CV_Assert( _mean.size() == mean_sz );
_mean.convertTo(mean, ctype);
@@ -3203,7 +3203,7 @@ PCA& PCA::operator()(InputArray _data, InputArray __mean, int flags, double reta
void PCA::project(InputArray _data, OutputArray result) const
{
Mat data = _data.getMat();
CV_Assert( mean.data && eigenvectors.data &&
CV_Assert( !mean.empty() && !eigenvectors.empty() &&
((mean.rows == 1 && mean.cols == data.cols) || (mean.cols == 1 && mean.rows == data.rows)));
Mat tmp_data, tmp_mean = repeat(mean, data.rows/mean.rows, data.cols/mean.cols);
int ctype = mean.type();
@@ -3233,7 +3233,7 @@ Mat PCA::project(InputArray data) const
void PCA::backProject(InputArray _data, OutputArray result) const
{
Mat data = _data.getMat();
CV_Assert( mean.data && eigenvectors.data &&
CV_Assert( !mean.empty() && !eigenvectors.empty() &&
((mean.rows == 1 && eigenvectors.rows == data.cols) ||
(mean.cols == 1 && eigenvectors.rows == data.rows)));
@@ -3427,7 +3427,7 @@ cvCalcPCA( const CvArr* data_arr, CvArr* avg_arr, CvArr* eigenvals, CvArr* eigen
pca.eigenvectors = evects;
pca(data, (flags & CV_PCA_USE_AVG) ? mean : cv::Mat(),
flags, evals.data ? evals.rows + evals.cols - 1 : 0);
flags, !evals.empty() ? evals.rows + evals.cols - 1 : 0);
if( pca.mean.size() == mean.size() )
pca.mean.convertTo( mean, mean.type() );

View File

@@ -352,7 +352,7 @@ static void finalizeHdr(Mat& m)
m.datalimit = m.datastart + m.size[0]*m.step[0];
if( m.size[0] > 0 )
{
m.dataend = m.data + m.size[d-1]*m.step[d-1];
m.dataend = m.ptr() + m.size[d-1]*m.step[d-1];
for( int i = 0; i < d-1; i++ )
m.dataend += (m.size[i] - 1)*m.step[i];
}
@@ -871,7 +871,7 @@ Mat cvarrToMat(const CvArr* arr, bool copyData,
}
Mat buf(total, 1, type);
cvCvtSeqToArray(seq, buf.data, CV_WHOLE_SEQ);
cvCvtSeqToArray(seq, buf.ptr(), CV_WHOLE_SEQ);
return buf;
}
CV_Error(CV_StsBadArg, "Unknown array type");
@@ -1941,7 +1941,7 @@ size_t _InputArray::offset(int i) const
{
CV_Assert( i < 0 );
const Mat * const m = ((const Mat*)obj);
return (size_t)(m->data - m->datastart);
return (size_t)(m->ptr() - m->datastart);
}
if( k == UMAT )
@@ -1960,7 +1960,7 @@ size_t _InputArray::offset(int i) const
return 1;
CV_Assert( i < (int)vv.size() );
return (size_t)(vv[i].data - vv[i].datastart);
return (size_t)(vv[i].ptr() - vv[i].datastart);
}
if( k == STD_VECTOR_UMAT )
@@ -2618,7 +2618,7 @@ void _OutputArray::setTo(const _InputArray& arr, const _InputArray & mask) const
{
Mat value = arr.getMat();
CV_Assert( checkScalar(value, type(), arr.kind(), _InputArray::GPU_MAT) );
((cuda::GpuMat*)obj)->setTo(Scalar(Vec<double, 4>((double *)value.data)), mask);
((cuda::GpuMat*)obj)->setTo(Scalar(Vec<double, 4>(value.ptr<double>())), mask);
}
else
CV_Error(Error::StsNotImplemented, "");
@@ -2804,7 +2804,7 @@ void cv::setIdentity( InputOutputArray _m, const Scalar& s )
if( type == CV_32FC1 )
{
float* data = (float*)m.data;
float* data = m.ptr<float>();
float val = (float)s[0];
size_t step = m.step/sizeof(data[0]);
@@ -2818,7 +2818,7 @@ void cv::setIdentity( InputOutputArray _m, const Scalar& s )
}
else if( type == CV_64FC1 )
{
double* data = (double*)m.data;
double* data = m.ptr<double>();
double val = s[0];
size_t step = m.step/sizeof(data[0]);
@@ -2846,7 +2846,7 @@ cv::Scalar cv::trace( InputArray _m )
if( type == CV_32FC1 )
{
const float* ptr = (const float*)m.data;
const float* ptr = m.ptr<float>();
size_t step = m.step/sizeof(ptr[0]) + 1;
double _s = 0;
for( i = 0; i < nm; i++ )
@@ -2856,7 +2856,7 @@ cv::Scalar cv::trace( InputArray _m )
if( type == CV_64FC1 )
{
const double* ptr = (const double*)m.data;
const double* ptr = m.ptr<double>();
size_t step = m.step/sizeof(ptr[0]) + 1;
double _s = 0;
for( i = 0; i < nm; i++ )
@@ -3115,13 +3115,13 @@ void cv::transpose( InputArray _src, OutputArray _dst )
IppiSize roiSize = { src.cols, src.rows };
if (ippFunc != 0)
{
if (ippFunc(src.data, (int)src.step, dst.data, (int)dst.step, roiSize) >= 0)
if (ippFunc(src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roiSize) >= 0)
return;
setIppErrorStatus();
}
else if (ippFuncI != 0)
{
if (ippFuncI(dst.data, (int)dst.step, roiSize) >= 0)
if (ippFuncI(dst.ptr(), (int)dst.step, roiSize) >= 0)
return;
setIppErrorStatus();
}
@@ -3132,13 +3132,13 @@ void cv::transpose( InputArray _src, OutputArray _dst )
TransposeInplaceFunc func = transposeInplaceTab[esz];
CV_Assert( func != 0 );
CV_Assert( dst.cols == dst.rows );
func( dst.data, dst.step, dst.rows );
func( dst.ptr(), dst.step, dst.rows );
}
else
{
TransposeFunc func = transposeTab[esz];
CV_Assert( func != 0 );
func( src.data, src.step, dst.data, dst.step, src.size() );
func( src.ptr(), src.step, dst.ptr(), dst.step, src.size() );
}
}
@@ -3154,7 +3154,7 @@ void cv::completeSymm( InputOutputArray _m, bool LtoR )
int rows = m.rows;
int j0 = 0, j1 = rows;
uchar* data = m.data;
uchar* data = m.ptr();
for( int i = 0; i < rows; i++ )
{
if( !LtoR ) j1 = i; else j0 = i+1;
@@ -3212,8 +3212,8 @@ reduceR_( const Mat& srcmat, Mat& dstmat )
size.width *= srcmat.channels();
AutoBuffer<WT> buffer(size.width);
WT* buf = buffer;
ST* dst = (ST*)dstmat.data;
const T* src = (const T*)srcmat.data;
ST* dst = dstmat.ptr<ST>();
const T* src = srcmat.ptr<T>();
size_t srcstep = srcmat.step/sizeof(src[0]);
int i;
Op op;
@@ -3258,8 +3258,8 @@ reduceC_( const Mat& srcmat, Mat& dstmat )
for( int y = 0; y < size.height; y++ )
{
const T* src = (const T*)(srcmat.data + srcmat.step*y);
ST* dst = (ST*)(dstmat.data + dstmat.step*y);
const T* src = srcmat.ptr<T>(y);
ST* dst = dstmat.ptr<ST>(y);
if( size.width == cn )
for( k = 0; k < cn; k++ )
dst[k] = src[k];
@@ -3356,7 +3356,7 @@ static inline void reduceSumC_8u16u16s32f_64f(const cv::Mat& srcmat, cv::Mat& ds
if (ippFunc)
{
for (int y = 0; y < size.height; ++y)
if (ippFunc(srcmat.data + sstep * y, sstep, roisize, dstmat.ptr<Ipp64f>(y)) < 0)
if (ippFunc(srcmat.ptr(y), sstep, roisize, dstmat.ptr<Ipp64f>(y)) < 0)
{
setIppErrorStatus();
cv::Mat dstroi = dstmat.rowRange(y, y + 1);
@@ -3367,7 +3367,7 @@ static inline void reduceSumC_8u16u16s32f_64f(const cv::Mat& srcmat, cv::Mat& ds
else if (ippFuncHint)
{
for (int y = 0; y < size.height; ++y)
if (ippFuncHint(srcmat.data + sstep * y, sstep, roisize, dstmat.ptr<Ipp64f>(y), ippAlgHintAccurate) < 0)
if (ippFuncHint(srcmat.ptr(y), sstep, roisize, dstmat.ptr<Ipp64f>(y), ippAlgHintAccurate) < 0)
{
setIppErrorStatus();
cv::Mat dstroi = dstmat.rowRange(y, y + 1);
@@ -3780,10 +3780,10 @@ template<typename T> static void sort_( const Mat& src, Mat& dst, int flags )
T* ptr = bptr;
if( sortRows )
{
T* dptr = (T*)(dst.data + dst.step*i);
T* dptr = dst.ptr<T>(i);
if( !inplace )
{
const T* sptr = (const T*)(src.data + src.step*i);
const T* sptr = src.ptr<T>(i);
memcpy(dptr, sptr, sizeof(T) * len);
}
ptr = dptr;
@@ -3791,7 +3791,7 @@ template<typename T> static void sort_( const Mat& src, Mat& dst, int flags )
else
{
for( j = 0; j < len; j++ )
ptr[j] = ((const T*)(src.data + src.step*j))[i];
ptr[j] = src.ptr<T>(j)[i];
}
#ifdef USE_IPP_SORT
@@ -3820,7 +3820,7 @@ template<typename T> static void sort_( const Mat& src, Mat& dst, int flags )
if( !sortRows )
for( j = 0; j < len; j++ )
((T*)(dst.data + dst.step*j))[i] = ptr[j];
dst.ptr<T>(j)[i] = ptr[j];
}
}
@@ -3893,12 +3893,12 @@ template<typename T> static void sortIdx_( const Mat& src, Mat& dst, int flags )
if( sortRows )
{
ptr = (T*)(src.data + src.step*i);
iptr = (int*)(dst.data + dst.step*i);
iptr = dst.ptr<int>(i);
}
else
{
for( j = 0; j < len; j++ )
ptr[j] = ((const T*)(src.data + src.step*j))[i];
ptr[j] = src.ptr<T>(j)[i];
}
for( j = 0; j < len; j++ )
iptr[j] = j;
@@ -3928,7 +3928,7 @@ template<typename T> static void sortIdx_( const Mat& src, Mat& dst, int flags )
if( !sortRows )
for( j = 0; j < len; j++ )
((int*)(dst.data + dst.step*j))[i] = iptr[j];
dst.ptr<int>(j)[i] = iptr[j];
}
}
@@ -4159,7 +4159,7 @@ double cv::kmeans( InputArray _data, int K,
CV_Assert( data0.dims <= 2 && type == CV_32F && K > 0 );
CV_Assert( N >= K );
Mat data(N, dims, CV_32F, data0.data, isrow ? dims * sizeof(float) : static_cast<size_t>(data0.step));
Mat data(N, dims, CV_32F, data0.ptr(), isrow ? dims * sizeof(float) : static_cast<size_t>(data0.step));
_bestLabels.create(N, 1, CV_32S, -1, true);
@@ -4765,7 +4765,7 @@ Point MatConstIterator::pos() const
return Point();
CV_DbgAssert(m->dims <= 2);
ptrdiff_t ofs = ptr - m->data;
ptrdiff_t ofs = ptr - m->ptr();
int y = (int)(ofs/m->step[0]);
return Point((int)((ofs - y*m->step[0])/elemSize), y);
}
@@ -4773,7 +4773,7 @@ Point MatConstIterator::pos() const
void MatConstIterator::pos(int* _idx) const
{
CV_Assert(m != 0 && _idx);
ptrdiff_t ofs = ptr - m->data;
ptrdiff_t ofs = ptr - m->ptr();
for( int i = 0; i < m->dims; i++ )
{
size_t s = m->step[i], v = ofs/s;
@@ -4788,7 +4788,7 @@ ptrdiff_t MatConstIterator::lpos() const
return 0;
if( m->isContinuous() )
return (ptr - sliceStart)/elemSize;
ptrdiff_t ofs = ptr - m->data;
ptrdiff_t ofs = ptr - m->ptr();
int i, d = m->dims;
if( d == 2 )
{
@@ -4823,13 +4823,13 @@ void MatConstIterator::seek(ptrdiff_t ofs, bool relative)
ptrdiff_t ofs0, y;
if( relative )
{
ofs0 = ptr - m->data;
ofs0 = ptr - m->ptr();
y = ofs0/m->step[0];
ofs += y*m->cols + (ofs0 - y*m->step[0])/elemSize;
}
y = ofs/m->cols;
int y1 = std::min(std::max((int)y, 0), m->rows-1);
sliceStart = m->data + y1*m->step[0];
sliceStart = m->ptr(y1);
sliceEnd = sliceStart + m->cols*elemSize;
ptr = y < 0 ? sliceStart : y >= m->rows ? sliceEnd :
sliceStart + (ofs - y*m->cols)*elemSize;
@@ -4846,8 +4846,8 @@ void MatConstIterator::seek(ptrdiff_t ofs, bool relative)
ptrdiff_t t = ofs/szi;
int v = (int)(ofs - t*szi);
ofs = t;
ptr = m->data + v*elemSize;
sliceStart = m->data;
ptr = m->ptr() + v*elemSize;
sliceStart = m->ptr();
for( int i = d-2; i >= 0; i-- )
{
@@ -4862,7 +4862,7 @@ void MatConstIterator::seek(ptrdiff_t ofs, bool relative)
if( ofs > 0 )
ptr = sliceEnd;
else
ptr = sliceStart + (ptr - m->data);
ptr = sliceStart + (ptr - m->ptr());
}
void MatConstIterator::seek(const int* _idx, bool relative)
@@ -5058,7 +5058,7 @@ SparseMat::SparseMat(const Mat& m)
int i, idx[CV_MAX_DIM] = {0}, d = m.dims, lastSize = m.size[d - 1];
size_t esz = m.elemSize();
uchar* dptr = m.data;
const uchar* dptr = m.ptr();
for(;;)
{

View File

@@ -2750,7 +2750,7 @@ KernelArg::KernelArg(int _flags, UMat* _m, int _wscale, int _iwscale, const void
KernelArg KernelArg::Constant(const Mat& m)
{
CV_Assert(m.isContinuous());
return KernelArg(CONSTANT, 0, 0, 0, m.data, m.total()*m.elemSize());
return KernelArg(CONSTANT, 0, 0, 0, m.ptr(), m.total()*m.elemSize());
}
/////////////////////////////////////////// Kernel /////////////////////////////////////////////
@@ -4397,7 +4397,7 @@ template <typename T>
static std::string kerToStr(const Mat & k)
{
int width = k.cols - 1, depth = k.depth();
const T * const data = reinterpret_cast<const T *>(k.data);
const T * const data = k.ptr<T>();
std::ostringstream stream;
stream.precision(10);

View File

@@ -511,8 +511,8 @@ void RNG::fill( InputOutputArray _mat, int disttype,
{
_parambuf.allocate(cn*8 + n1 + n2);
double* parambuf = _parambuf;
double* p1 = (double*)_param1.data;
double* p2 = (double*)_param2.data;
double* p1 = _param1.ptr<double>();
double* p2 = _param2.ptr<double>();
if( !_param1.isContinuous() || _param1.type() != CV_64F || n1 != cn )
{
@@ -625,7 +625,7 @@ void RNG::fill( InputOutputArray _mat, int disttype,
int esz = (int)CV_ELEM_SIZE(ptype);
if( _param1.isContinuous() && _param1.type() == ptype )
mean = _param1.data;
mean = _param1.ptr();
else
{
Mat tmp(_param1.size(), ptype, parambuf);
@@ -638,7 +638,7 @@ void RNG::fill( InputOutputArray _mat, int disttype,
mean[j] = mean[j - n1*esz];
if( _param2.isContinuous() && _param2.type() == ptype )
stddev = _param2.data;
stddev = _param2.ptr();
else
{
Mat tmp(_param2.size(), ptype, parambuf + cn);
@@ -753,7 +753,7 @@ randShuffle_( Mat& _arr, RNG& rng, double iterFactor )
int sz = _arr.rows*_arr.cols, iters = cvRound(iterFactor*sz);
if( _arr.isContinuous() )
{
T* arr = (T*)_arr.data;
T* arr = _arr.ptr<T>();
for( int i = 0; i < iters; i++ )
{
int j = (unsigned)rng % sz, k = (unsigned)rng % sz;
@@ -762,7 +762,7 @@ randShuffle_( Mat& _arr, RNG& rng, double iterFactor )
}
else
{
uchar* data = _arr.data;
uchar* data = _arr.ptr();
size_t step = _arr.step;
int cols = _arr.cols;
for( int i = 0; i < iters; i++ )

View File

@@ -605,8 +605,8 @@ cv::Scalar cv::sum( InputArray _src )
if( ippFuncHint || ippFuncNoHint )
{
Ipp64f res[4];
IppStatus ret = ippFuncHint ? ippFuncHint(src.data, (int)src.step[0], sz, res, ippAlgHintAccurate) :
ippFuncNoHint(src.data, (int)src.step[0], sz, res);
IppStatus ret = ippFuncHint ? ippFuncHint(src.ptr(), (int)src.step[0], sz, res, ippAlgHintAccurate) :
ippFuncNoHint(src.ptr(), (int)src.step[0], sz, res);
if( ret >= 0 )
{
Scalar sc;
@@ -791,7 +791,7 @@ cv::Scalar cv::mean( InputArray _src, InputArray _mask )
if( ippFuncC1 )
{
Ipp64f res;
if( ippFuncC1(src.data, (int)src.step[0], mask.data, (int)mask.step[0], sz, &res) >= 0 )
if( ippFuncC1(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, &res) >= 0 )
return Scalar(res);
setIppErrorStatus();
}
@@ -804,9 +804,9 @@ cv::Scalar cv::mean( InputArray _src, InputArray _mask )
if( ippFuncC3 )
{
Ipp64f res1, res2, res3;
if( ippFuncC3(src.data, (int)src.step[0], mask.data, (int)mask.step[0], sz, 1, &res1) >= 0 &&
ippFuncC3(src.data, (int)src.step[0], mask.data, (int)mask.step[0], sz, 2, &res2) >= 0 &&
ippFuncC3(src.data, (int)src.step[0], mask.data, (int)mask.step[0], sz, 3, &res3) >= 0 )
if( ippFuncC3(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, 1, &res1) >= 0 &&
ippFuncC3(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, 2, &res2) >= 0 &&
ippFuncC3(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, 3, &res3) >= 0 )
{
return Scalar(res1, res2, res3);
}
@@ -838,8 +838,8 @@ cv::Scalar cv::mean( InputArray _src, InputArray _mask )
if( ippFuncHint || ippFuncNoHint )
{
Ipp64f res[4];
IppStatus ret = ippFuncHint ? ippFuncHint(src.data, (int)src.step[0], sz, res, ippAlgHintAccurate) :
ippFuncNoHint(src.data, (int)src.step[0], sz, res);
IppStatus ret = ippFuncHint ? ippFuncHint(src.ptr(), (int)src.step[0], sz, res, ippAlgHintAccurate) :
ippFuncNoHint(src.ptr(), (int)src.step[0], sz, res);
if( ret >= 0 )
{
Scalar sc;
@@ -981,11 +981,11 @@ static bool ocl_meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv
part_sum funcs[3] = { ocl_part_sum<int>, ocl_part_sum<float>, ocl_part_sum<double> };
Mat dbm = db.getMat(ACCESS_READ);
mean = funcs[ddepth - CV_32S](Mat(1, groups, dtype, dbm.data));
stddev = funcs[sqddepth - CV_32S](Mat(1, groups, sqdtype, dbm.data + groups * CV_ELEM_SIZE(dtype)));
mean = funcs[ddepth - CV_32S](Mat(1, groups, dtype, dbm.ptr()));
stddev = funcs[sqddepth - CV_32S](Mat(1, groups, sqdtype, dbm.ptr() + groups * CV_ELEM_SIZE(dtype)));
if (haveMask)
nz = saturate_cast<int>(funcs[0](Mat(1, groups, CV_32SC1, dbm.data +
nz = saturate_cast<int>(funcs[0](Mat(1, groups, CV_32SC1, dbm.ptr() +
groups * (CV_ELEM_SIZE(dtype) +
CV_ELEM_SIZE(sqdtype))))[0]);
}
@@ -1052,7 +1052,7 @@ void cv::meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv, Input
_mean.create(cn, 1, CV_64F, -1, true);
mean = _mean.getMat();
dcn_mean = (int)mean.total();
pmean = (Ipp64f *)mean.data;
pmean = mean.ptr<Ipp64f>();
}
int dcn_stddev = -1;
if( _sdv.needed() )
@@ -1061,7 +1061,7 @@ void cv::meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv, Input
_sdv.create(cn, 1, CV_64F, -1, true);
stddev = _sdv.getMat();
dcn_stddev = (int)stddev.total();
pstddev = (Ipp64f *)stddev.data;
pstddev = stddev.ptr<Ipp64f>();
}
for( int c = cn; c < dcn_mean; c++ )
pmean[c] = 0;
@@ -1079,7 +1079,7 @@ void cv::meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv, Input
0;
if( ippFuncC1 )
{
if( ippFuncC1(src.data, (int)src.step[0], mask.data, (int)mask.step[0], sz, pmean, pstddev) >= 0 )
if( ippFuncC1(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, pmean, pstddev) >= 0 )
return;
setIppErrorStatus();
}
@@ -1091,9 +1091,9 @@ void cv::meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv, Input
0;
if( ippFuncC3 )
{
if( ippFuncC3(src.data, (int)src.step[0], mask.data, (int)mask.step[0], sz, 1, &pmean[0], &pstddev[0]) >= 0 &&
ippFuncC3(src.data, (int)src.step[0], mask.data, (int)mask.step[0], sz, 2, &pmean[1], &pstddev[1]) >= 0 &&
ippFuncC3(src.data, (int)src.step[0], mask.data, (int)mask.step[0], sz, 3, &pmean[2], &pstddev[2]) >= 0 )
if( ippFuncC3(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, 1, &pmean[0], &pstddev[0]) >= 0 &&
ippFuncC3(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, 2, &pmean[1], &pstddev[1]) >= 0 &&
ippFuncC3(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, 3, &pmean[2], &pstddev[2]) >= 0 )
return;
setIppErrorStatus();
}
@@ -1110,7 +1110,7 @@ void cv::meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv, Input
0;
if( ippFuncC1 )
{
if( ippFuncC1(src.data, (int)src.step[0], sz, pmean, pstddev) >= 0 )
if( ippFuncC1(src.ptr(), (int)src.step[0], sz, pmean, pstddev) >= 0 )
return;
setIppErrorStatus();
}
@@ -1122,9 +1122,9 @@ void cv::meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv, Input
0;
if( ippFuncC3 )
{
if( ippFuncC3(src.data, (int)src.step[0], sz, 1, &pmean[0], &pstddev[0]) >= 0 &&
ippFuncC3(src.data, (int)src.step[0], sz, 2, &pmean[1], &pstddev[1]) >= 0 &&
ippFuncC3(src.data, (int)src.step[0], sz, 3, &pmean[2], &pstddev[2]) >= 0 )
if( ippFuncC3(src.ptr(), (int)src.step[0], sz, 1, &pmean[0], &pstddev[0]) >= 0 &&
ippFuncC3(src.ptr(), (int)src.step[0], sz, 2, &pmean[1], &pstddev[1]) >= 0 &&
ippFuncC3(src.ptr(), (int)src.step[0], sz, 3, &pmean[2], &pstddev[2]) >= 0 )
return;
setIppErrorStatus();
}
@@ -1358,26 +1358,26 @@ void getMinMaxRes(const Mat & db, double * minVal, double * maxVal,
const uint * minlocptr = NULL, * maxlocptr = NULL;
if (minVal || minLoc)
{
minptr = (const T *)db.data;
minptr = db.ptr<T>();
index += sizeof(T) * groupnum;
}
if (maxVal || maxLoc)
{
maxptr = (const T *)(db.data + index);
maxptr = (const T *)(db.ptr() + index);
index += sizeof(T) * groupnum;
}
if (minLoc)
{
minlocptr = (uint *)(db.data + index);
minlocptr = (const uint *)(db.ptr() + index);
index += sizeof(uint) * groupnum;
}
if (maxLoc)
{
maxlocptr = (uint *)(db.data + index);
maxlocptr = (const uint *)(db.ptr() + index);
index += sizeof(uint) * groupnum;
}
if (maxVal2)
maxptr2 = (const T *)(db.data + index);
maxptr2 = (const T *)(db.ptr() + index);
for (int i = 0; i < groupnum; i++)
{
@@ -1602,13 +1602,13 @@ void cv::minMaxIdx(InputArray _src, double* minVal,
{
Ipp32f min, max;
IppiPoint minp, maxp;
if( ippFuncC1(src.data, (int)src.step[0], mask.data, (int)mask.step[0], sz, &min, &max, &minp, &maxp) >= 0 )
if( ippFuncC1(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, &min, &max, &minp, &maxp) >= 0 )
{
if( minVal )
*minVal = (double)min;
if( maxVal )
*maxVal = (double)max;
if( !minp.x && !minp.y && !maxp.x && !maxp.y && !mask.data[0] )
if( !minp.x && !minp.y && !maxp.x && !maxp.y && !mask.ptr()[0] )
minp.x = maxp.x = -1;
if( minIdx )
{
@@ -1641,7 +1641,7 @@ void cv::minMaxIdx(InputArray _src, double* minVal,
{
Ipp32f min, max;
IppiPoint minp, maxp;
if( ippFuncC1(src.data, (int)src.step[0], sz, &min, &max, &minp, &maxp) >= 0 )
if( ippFuncC1(src.ptr(), (int)src.step[0], sz, &min, &max, &minp, &maxp) >= 0 )
{
if( minVal )
*minVal = (double)min;
@@ -2280,7 +2280,7 @@ double cv::norm( InputArray _src, int normType, InputArray _mask )
if( ippFuncC1 )
{
Ipp64f norm;
if( ippFuncC1(src.data, (int)src.step[0], mask.data, (int)mask.step[0], sz, &norm) >= 0 )
if( ippFuncC1(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, &norm) >= 0 )
return normType == NORM_L2SQR ? (double)(norm * norm) : (double)norm;
setIppErrorStatus();
@@ -2381,8 +2381,8 @@ double cv::norm( InputArray _src, int normType, InputArray _mask )
if( ippFuncHint || ippFuncNoHint )
{
Ipp64f norm_array[4];
IppStatus ret = ippFuncHint ? ippFuncHint(src.data, (int)src.step[0], sz, norm_array, ippAlgHintAccurate) :
ippFuncNoHint(src.data, (int)src.step[0], sz, norm_array);
IppStatus ret = ippFuncHint ? ippFuncHint(src.ptr(), (int)src.step[0], sz, norm_array, ippAlgHintAccurate) :
ippFuncNoHint(src.ptr(), (int)src.step[0], sz, norm_array);
if( ret >= 0 )
{
Ipp64f norm = (normType == NORM_L2 || normType == NORM_L2SQR) ? norm_array[0] * norm_array[0] : norm_array[0];
@@ -2643,7 +2643,7 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m
if( ippFuncC1 )
{
Ipp64f norm;
if( ippFuncC1(src1.data, (int)src1.step[0], src2.data, (int)src2.step[0], mask.data, (int)mask.step[0], sz, &norm) >= 0 )
if( ippFuncC1(src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], mask.ptr(), (int)mask.step[0], sz, &norm) >= 0 )
return normType == NORM_L2SQR ? (double)(norm * norm) : (double)norm;
setIppErrorStatus();
}
@@ -2679,14 +2679,14 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m
if (ippFuncNoHint)
{
Ipp64f norm;
if( ippFuncNoHint(src1.data, (int)src1.step[0], src2.data, (int)src2.step[0], sz, &norm) >= 0 )
if( ippFuncNoHint(src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], sz, &norm) >= 0 )
return (double)norm;
setIppErrorStatus();
}
if (ippFuncHint)
{
Ipp64f norm;
if( ippFuncHint(src1.data, (int)src1.step[0], src2.data, (int)src2.step[0], sz, &norm, ippAlgHintAccurate) >= 0 )
if( ippFuncHint(src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], sz, &norm, ippAlgHintAccurate) >= 0 )
return (double)norm;
setIppErrorStatus();
}
@@ -2739,7 +2739,7 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m
if( ippFuncC1 )
{
Ipp64f norm;
if( ippFuncC1(src1.data, (int)src1.step[0], src2.data, (int)src2.step[0], mask.data, (int)mask.step[0], sz, &norm) >= 0 )
if( ippFuncC1(src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], mask.ptr(), (int)mask.step[0], sz, &norm) >= 0 )
return normType == NORM_L2SQR ? (double)(norm * norm) : (double)norm;
setIppErrorStatus();
}
@@ -2839,8 +2839,8 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m
if( ippFuncHint || ippFuncNoHint )
{
Ipp64f norm_array[4];
IppStatus ret = ippFuncHint ? ippFuncHint(src1.data, (int)src1.step[0], src2.data, (int)src2.step[0], sz, norm_array, ippAlgHintAccurate) :
ippFuncNoHint(src1.data, (int)src1.step[0], src2.data, (int)src2.step[0], sz, norm_array);
IppStatus ret = ippFuncHint ? ippFuncHint(src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], sz, norm_array, ippAlgHintAccurate) :
ippFuncNoHint(src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], sz, norm_array);
if( ret >= 0 )
{
Ipp64f norm = (normType == NORM_L2 || normType == NORM_L2SQR) ? norm_array[0] * norm_array[0] : norm_array[0];
@@ -3322,7 +3322,7 @@ void cv::findNonZero( InputArray _src, OutputArray _idx )
_idx.create(n, 1, CV_32SC2);
Mat idx = _idx.getMat();
CV_Assert(idx.isContinuous());
Point* idx_ptr = (Point*)idx.data;
Point* idx_ptr = idx.ptr<Point>();
for( int i = 0; i < src.rows; i++ )
{

View File

@@ -658,7 +658,7 @@ void UMat::copyTo(OutputArray _dst) const
}
Mat dst = _dst.getMat();
u->currAllocator->download(u, dst.data, dims, sz, srcofs, step.p, dst.step.p);
u->currAllocator->download(u, dst.ptr(), dims, sz, srcofs, step.p, dst.step.p);
}
void UMat::copyTo(OutputArray _dst, InputArray _mask) const

View File

@@ -562,10 +562,10 @@ static void inRange(const Mat& src, const Mat& lb, const Mat& rb, Mat& dst)
for( i = 0; i < nplanes; i++, ++it )
{
const uchar* sptr = planes[0].data;
const uchar* aptr = planes[1].data;
const uchar* bptr = planes[2].data;
uchar* dptr = planes[3].data;
const uchar* sptr = planes[0].ptr();
const uchar* aptr = planes[1].ptr();
const uchar* bptr = planes[2].ptr();
uchar* dptr = planes[3].ptr();
switch( depth )
{
@@ -614,8 +614,8 @@ static void inRangeS(const Mat& src, const Scalar& lb, const Scalar& rb, Mat& ds
for( i = 0; i < nplanes; i++, ++it )
{
const uchar* sptr = planes[0].data;
uchar* dptr = planes[1].data;
const uchar* sptr = planes[0].ptr();
uchar* dptr = planes[1].ptr();
switch( depth )
{
@@ -905,8 +905,8 @@ static void exp(const Mat& src, Mat& dst)
for( i = 0; i < nplanes; i++, ++it )
{
const uchar* sptr = planes[0].data;
uchar* dptr = planes[1].data;
const uchar* sptr = planes[0].ptr();
uchar* dptr = planes[1].ptr();
if( depth == CV_32F )
{
@@ -934,8 +934,8 @@ static void log(const Mat& src, Mat& dst)
for( i = 0; i < nplanes; i++, ++it )
{
const uchar* sptr = planes[0].data;
uchar* dptr = planes[1].data;
const uchar* sptr = planes[0].ptr();
uchar* dptr = planes[1].ptr();
if( depth == CV_32F )
{
@@ -1027,10 +1027,10 @@ static void cartToPolar(const Mat& mx, const Mat& my, Mat& mmag, Mat& mangle, bo
{
if( depth == CV_32F )
{
const float* xptr = (const float*)planes[0].data;
const float* yptr = (const float*)planes[1].data;
float* mptr = (float*)planes[2].data;
float* aptr = (float*)planes[3].data;
const float* xptr = planes[0].ptr<float>();
const float* yptr = planes[1].ptr<float>();
float* mptr = planes[2].ptr<float>();
float* aptr = planes[3].ptr<float>();
for( j = 0; j < total; j++ )
{
@@ -1042,10 +1042,10 @@ static void cartToPolar(const Mat& mx, const Mat& my, Mat& mmag, Mat& mangle, bo
}
else
{
const double* xptr = (const double*)planes[0].data;
const double* yptr = (const double*)planes[1].data;
double* mptr = (double*)planes[2].data;
double* aptr = (double*)planes[3].data;
const double* xptr = planes[0].ptr<double>();
const double* yptr = planes[1].ptr<double>();
double* mptr = planes[2].ptr<double>();
double* aptr = planes[3].ptr<double>();
for( j = 0; j < total; j++ )
{

View File

@@ -39,8 +39,8 @@ static void DFT_1D( const Mat& _src, Mat& _dst, int flags, const Mat& _wave=Mat(
double scale = (flags & DFT_SCALE) ? 1./n : 1.;
size_t esz = _src.elemSize();
size_t srcstep = esz, dststep = esz;
const uchar* src0 = _src.data;
uchar* dst0 = _dst.data;
const uchar* src0 = _src.ptr();
uchar* dst0 = _dst.ptr();
CV_Assert( _src.cols + _src.rows - 1 == n );

View File

@@ -126,7 +126,7 @@ protected:
CvSeq* seq = cvCreateSeq(test_mat.type(), (int)sizeof(CvSeq),
(int)test_mat.elemSize(), storage);
cvSeqPushMulti(seq, test_mat.data, test_mat.cols*test_mat.rows);
cvSeqPushMulti(seq, test_mat.ptr(), test_mat.cols*test_mat.rows);
CvGraph* graph = cvCreateGraph( CV_ORIENTED_GRAPH,
sizeof(CvGraph), sizeof(CvGraphVtx),

View File

@@ -323,8 +323,8 @@ protected:
evec = svd.vt;
eval = svd.w;*/
Mat subEval( maxComponents, 1, eval.type(), eval.data ),
subEvec( maxComponents, evec.cols, evec.type(), evec.data );
Mat subEval( maxComponents, 1, eval.type(), eval.ptr() ),
subEvec( maxComponents, evec.cols, evec.type(), evec.ptr() );
#ifdef CHECK_C
Mat prjTestPoints, backPrjTestPoints, cPoints = rPoints.t(), cTestPoints = rTestPoints.t();

View File

@@ -458,7 +458,7 @@ void Core_TraceTest::prepare_to_validation( int )
{
Mat& mat = test_mat[INPUT][0];
int count = MIN( mat.rows, mat.cols );
Mat diag(count, 1, mat.type(), mat.data, mat.step + mat.elemSize());
Mat diag(count, 1, mat.type(), mat.ptr(), mat.step + mat.elemSize());
Scalar r = cvtest::mean(diag);
r *= (double)count;
@@ -2698,7 +2698,7 @@ protected:
case MAT_1_N_CDIM:
data.create(1, N, CV_32FC(dims));
for( i = 0; i < N; i++ )
memcpy(data.data + i * dims * sizeof(float), data0.ptr(rng.uniform(0, N0)), dims * sizeof(float));
memcpy(data.ptr() + i * dims * sizeof(float), data0.ptr(rng.uniform(0, N0)), dims * sizeof(float));
break;
case MAT_N_DIM_C1_NONCONT:

View File

@@ -37,8 +37,8 @@ bool Core_RandTest::check_pdf(const Mat& hist, double scale,
int dist_type, double& refval, double& realval)
{
Mat hist0(hist.size(), CV_32F);
const int* H = (const int*)hist.data;
float* H0 = ((float*)hist0.data);
const int* H = hist.ptr<int>();
float* H0 = hist0.ptr<float>();
int i, hsz = hist.cols;
double sum = 0;
@@ -183,7 +183,7 @@ void Core_RandTest::run( int )
for( c = 0; c < cn; c++ )
{
const uchar* data = arr[0].data;
const uchar* data = arr[0].ptr();
int* H = hist[c].ptr<int>();
int HSZ = hist[c].cols;
double minVal = dist_type == CV_RAND_UNI ? A[c] : A[c] - B[c]*4;
@@ -255,7 +255,7 @@ void Core_RandTest::run( int )
int SDIM = cvtest::randInt(rng) % (MAX_SDIM-1) + 2;
int N0 = (SZ*cn/SDIM), n = 0;
double r2 = 0;
const uchar* data = arr[0].data;
const uchar* data = arr[0].ptr();
double scale[4], delta[4];
for( c = 0; c < cn; c++ )
{