Merge pull request #3057 from Adil-Ibragimov:adding-constness
This commit is contained in:
commit
99eed2d885
@ -261,8 +261,8 @@ public:
|
|||||||
int* refcount;
|
int* refcount;
|
||||||
|
|
||||||
//! helper fields used in locateROI and adjustROI
|
//! helper fields used in locateROI and adjustROI
|
||||||
uchar* datastart;
|
const uchar* datastart;
|
||||||
uchar* dataend;
|
const uchar* dataend;
|
||||||
|
|
||||||
//! allocator
|
//! allocator
|
||||||
Allocator* allocator;
|
Allocator* allocator;
|
||||||
@ -349,8 +349,8 @@ public:
|
|||||||
uchar* data;
|
uchar* data;
|
||||||
int* refcount;
|
int* refcount;
|
||||||
|
|
||||||
uchar* datastart;
|
const uchar* datastart;
|
||||||
uchar* dataend;
|
const uchar* dataend;
|
||||||
|
|
||||||
AllocType alloc_type;
|
AllocType alloc_type;
|
||||||
};
|
};
|
||||||
|
@ -395,7 +395,7 @@ struct CV_EXPORTS UMatData
|
|||||||
|
|
||||||
struct CV_EXPORTS UMatDataAutoLock
|
struct CV_EXPORTS UMatDataAutoLock
|
||||||
{
|
{
|
||||||
UMatDataAutoLock(UMatData* u);
|
explicit UMatDataAutoLock(UMatData* u);
|
||||||
~UMatDataAutoLock();
|
~UMatDataAutoLock();
|
||||||
UMatData* u;
|
UMatData* u;
|
||||||
};
|
};
|
||||||
@ -403,7 +403,7 @@ struct CV_EXPORTS UMatDataAutoLock
|
|||||||
|
|
||||||
struct CV_EXPORTS MatSize
|
struct CV_EXPORTS MatSize
|
||||||
{
|
{
|
||||||
MatSize(int* _p);
|
explicit MatSize(int* _p);
|
||||||
Size operator()() const;
|
Size operator()() const;
|
||||||
const int& operator[](int i) const;
|
const int& operator[](int i) const;
|
||||||
int& operator[](int i);
|
int& operator[](int i);
|
||||||
@ -417,7 +417,7 @@ struct CV_EXPORTS MatSize
|
|||||||
struct CV_EXPORTS MatStep
|
struct CV_EXPORTS MatStep
|
||||||
{
|
{
|
||||||
MatStep();
|
MatStep();
|
||||||
MatStep(size_t s);
|
explicit MatStep(size_t s);
|
||||||
const size_t& operator[](int i) const;
|
const size_t& operator[](int i) const;
|
||||||
size_t& operator[](int i);
|
size_t& operator[](int i);
|
||||||
operator size_t() const;
|
operator size_t() const;
|
||||||
@ -918,9 +918,9 @@ public:
|
|||||||
uchar* data;
|
uchar* data;
|
||||||
|
|
||||||
//! helper fields used in locateROI and adjustROI
|
//! helper fields used in locateROI and adjustROI
|
||||||
uchar* datastart;
|
const uchar* datastart;
|
||||||
uchar* dataend;
|
const uchar* dataend;
|
||||||
uchar* datalimit;
|
const uchar* datalimit;
|
||||||
|
|
||||||
//! custom allocator
|
//! custom allocator
|
||||||
MatAllocator* allocator;
|
MatAllocator* allocator;
|
||||||
@ -1804,9 +1804,9 @@ public:
|
|||||||
//! copy operator
|
//! copy operator
|
||||||
MatConstIterator& operator = (const MatConstIterator& it);
|
MatConstIterator& operator = (const MatConstIterator& it);
|
||||||
//! returns the current matrix element
|
//! returns the current matrix element
|
||||||
uchar* operator *() const;
|
const uchar* operator *() const;
|
||||||
//! returns the i-th matrix element, relative to the current
|
//! returns the i-th matrix element, relative to the current
|
||||||
uchar* operator [](ptrdiff_t i) const;
|
const uchar* operator [](ptrdiff_t i) const;
|
||||||
|
|
||||||
//! shifts the iterator forward by the specified number of elements
|
//! shifts the iterator forward by the specified number of elements
|
||||||
MatConstIterator& operator += (ptrdiff_t ofs);
|
MatConstIterator& operator += (ptrdiff_t ofs);
|
||||||
@ -1831,9 +1831,9 @@ public:
|
|||||||
|
|
||||||
const Mat* m;
|
const Mat* m;
|
||||||
size_t elemSize;
|
size_t elemSize;
|
||||||
uchar* ptr;
|
const uchar* ptr;
|
||||||
uchar* sliceStart;
|
const uchar* sliceStart;
|
||||||
uchar* sliceEnd;
|
const uchar* sliceEnd;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -1917,9 +1917,9 @@ public:
|
|||||||
//! constructor that sets the iterator to the specified element of the matrix
|
//! constructor that sets the iterator to the specified element of the matrix
|
||||||
MatIterator_(Mat_<_Tp>* _m, int _row, int _col=0);
|
MatIterator_(Mat_<_Tp>* _m, int _row, int _col=0);
|
||||||
//! constructor that sets the iterator to the specified element of the matrix
|
//! constructor that sets the iterator to the specified element of the matrix
|
||||||
MatIterator_(const Mat_<_Tp>* _m, Point _pt);
|
MatIterator_(Mat_<_Tp>* _m, Point _pt);
|
||||||
//! constructor that sets the iterator to the specified element of the matrix
|
//! constructor that sets the iterator to the specified element of the matrix
|
||||||
MatIterator_(const Mat_<_Tp>* _m, const int* _idx);
|
MatIterator_(Mat_<_Tp>* _m, const int* _idx);
|
||||||
//! copy constructor
|
//! copy constructor
|
||||||
MatIterator_(const MatIterator_& it);
|
MatIterator_(const MatIterator_& it);
|
||||||
//! copy operator
|
//! copy operator
|
||||||
|
@ -438,7 +438,7 @@ Mat::Mat(const std::vector<_Tp>& vec, bool copyData)
|
|||||||
if( !copyData )
|
if( !copyData )
|
||||||
{
|
{
|
||||||
step[0] = step[1] = sizeof(_Tp);
|
step[0] = step[1] = sizeof(_Tp);
|
||||||
data = datastart = (uchar*)&vec[0];
|
datastart = data = (uchar*)&vec[0];
|
||||||
datalimit = dataend = datastart + rows * step[0];
|
datalimit = dataend = datastart + rows * step[0];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -453,7 +453,7 @@ Mat::Mat(const Vec<_Tp, n>& vec, bool copyData)
|
|||||||
if( !copyData )
|
if( !copyData )
|
||||||
{
|
{
|
||||||
step[0] = step[1] = sizeof(_Tp);
|
step[0] = step[1] = sizeof(_Tp);
|
||||||
data = datastart = (uchar*)vec.val;
|
datastart = data = (uchar*)vec.val;
|
||||||
datalimit = dataend = datastart + rows * step[0];
|
datalimit = dataend = datastart + rows * step[0];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -470,7 +470,7 @@ Mat::Mat(const Matx<_Tp,m,n>& M, bool copyData)
|
|||||||
{
|
{
|
||||||
step[0] = cols * sizeof(_Tp);
|
step[0] = cols * sizeof(_Tp);
|
||||||
step[1] = sizeof(_Tp);
|
step[1] = sizeof(_Tp);
|
||||||
data = datastart = (uchar*)M.val;
|
datastart = data = (uchar*)M.val;
|
||||||
datalimit = dataend = datastart + rows * step[0];
|
datalimit = dataend = datastart + rows * step[0];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -485,7 +485,7 @@ Mat::Mat(const Point_<_Tp>& pt, bool copyData)
|
|||||||
if( !copyData )
|
if( !copyData )
|
||||||
{
|
{
|
||||||
step[0] = step[1] = sizeof(_Tp);
|
step[0] = step[1] = sizeof(_Tp);
|
||||||
data = datastart = (uchar*)&pt.x;
|
datastart = data = (uchar*)&pt.x;
|
||||||
datalimit = dataend = datastart + rows * step[0];
|
datalimit = dataend = datastart + rows * step[0];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -504,7 +504,7 @@ Mat::Mat(const Point3_<_Tp>& pt, bool copyData)
|
|||||||
if( !copyData )
|
if( !copyData )
|
||||||
{
|
{
|
||||||
step[0] = step[1] = sizeof(_Tp);
|
step[0] = step[1] = sizeof(_Tp);
|
||||||
data = datastart = (uchar*)&pt.x;
|
datastart = data = (uchar*)&pt.x;
|
||||||
datalimit = dataend = datastart + rows * step[0];
|
datalimit = dataend = datastart + rows * step[0];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -642,7 +642,7 @@ inline void Mat::release()
|
|||||||
if( u && CV_XADD(&u->refcount, -1) == 1 )
|
if( u && CV_XADD(&u->refcount, -1) == 1 )
|
||||||
deallocate();
|
deallocate();
|
||||||
u = NULL;
|
u = NULL;
|
||||||
data = datastart = dataend = datalimit = 0;
|
datastart = dataend = datalimit = data = 0;
|
||||||
size.p[0] = 0;
|
size.p[0] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1044,7 +1044,7 @@ void Mat::push_back(const _Tp& elem)
|
|||||||
}
|
}
|
||||||
CV_Assert(DataType<_Tp>::type == type() && cols == 1
|
CV_Assert(DataType<_Tp>::type == type() && cols == 1
|
||||||
/* && dims == 2 (cols == 1 implies dims == 2) */);
|
/* && dims == 2 (cols == 1 implies dims == 2) */);
|
||||||
uchar* tmp = dataend + step[0];
|
const uchar* tmp = dataend + step[0];
|
||||||
if( !isSubmatrix() && isContinuous() && tmp <= datalimit )
|
if( !isSubmatrix() && isContinuous() && tmp <= datalimit )
|
||||||
{
|
{
|
||||||
*(_Tp*)(data + (size.p[0]++) * step.p[0]) = elem;
|
*(_Tp*)(data + (size.p[0]++) * step.p[0]) = elem;
|
||||||
@ -2148,7 +2148,7 @@ MatConstIterator& MatConstIterator::operator = (const MatConstIterator& it )
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
uchar* MatConstIterator::operator *() const
|
const uchar* MatConstIterator::operator *() const
|
||||||
{
|
{
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
@ -2281,7 +2281,7 @@ MatConstIterator operator - (const MatConstIterator& a, ptrdiff_t ofs)
|
|||||||
|
|
||||||
|
|
||||||
inline
|
inline
|
||||||
uchar* MatConstIterator::operator [](ptrdiff_t i) const
|
const uchar* MatConstIterator::operator [](ptrdiff_t i) const
|
||||||
{
|
{
|
||||||
return *(*this + i);
|
return *(*this + i);
|
||||||
}
|
}
|
||||||
@ -2453,12 +2453,12 @@ MatIterator_<_Tp>::MatIterator_(Mat_<_Tp>* _m, int _row, int _col)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
template<typename _Tp> inline
|
template<typename _Tp> inline
|
||||||
MatIterator_<_Tp>::MatIterator_(const Mat_<_Tp>* _m, Point _pt)
|
MatIterator_<_Tp>::MatIterator_(Mat_<_Tp>* _m, Point _pt)
|
||||||
: MatConstIterator_<_Tp>(_m, _pt)
|
: MatConstIterator_<_Tp>(_m, _pt)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
template<typename _Tp> inline
|
template<typename _Tp> inline
|
||||||
MatIterator_<_Tp>::MatIterator_(const Mat_<_Tp>* _m, const int* _idx)
|
MatIterator_<_Tp>::MatIterator_(Mat_<_Tp>* _m, const int* _idx)
|
||||||
: MatConstIterator_<_Tp>(_m, _idx)
|
: MatConstIterator_<_Tp>(_m, _idx)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -2592,7 +2592,7 @@ inline SparseMatConstIterator& SparseMatConstIterator::operator = (const SparseM
|
|||||||
template<typename _Tp> inline
|
template<typename _Tp> inline
|
||||||
const _Tp& SparseMatConstIterator::value() const
|
const _Tp& SparseMatConstIterator::value() const
|
||||||
{
|
{
|
||||||
return *(_Tp*)ptr;
|
return *(const _Tp*)ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
|
@ -2635,8 +2635,8 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows )
|
|||||||
|
|
||||||
for( i = 0; i < nonzero_rows; i++ )
|
for( i = 0; i < nonzero_rows; i++ )
|
||||||
{
|
{
|
||||||
uchar* sptr = src.data + i*src.step;
|
const uchar* sptr = src.ptr(i);
|
||||||
uchar* dptr0 = dst.data + i*dst.step;
|
uchar* dptr0 = dst.ptr(i);
|
||||||
uchar* dptr = dptr0;
|
uchar* dptr = dptr0;
|
||||||
|
|
||||||
if( tmp_buf )
|
if( tmp_buf )
|
||||||
@ -2649,7 +2649,7 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows )
|
|||||||
|
|
||||||
for( ; i < count; i++ )
|
for( ; i < count; i++ )
|
||||||
{
|
{
|
||||||
uchar* dptr0 = dst.data + i*dst.step;
|
uchar* dptr0 = dst.ptr(i);
|
||||||
memset( dptr0, 0, dst_full_len );
|
memset( dptr0, 0, dst_full_len );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2661,7 +2661,7 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows )
|
|||||||
{
|
{
|
||||||
int a = 0, b = count;
|
int a = 0, b = count;
|
||||||
uchar *buf0, *buf1, *dbuf0, *dbuf1;
|
uchar *buf0, *buf1, *dbuf0, *dbuf1;
|
||||||
uchar* sptr0 = src.data;
|
const uchar* sptr0 = src.data;
|
||||||
uchar* dptr0 = dst.data;
|
uchar* dptr0 = dst.data;
|
||||||
buf0 = ptr;
|
buf0 = ptr;
|
||||||
ptr += len*complex_elem_size;
|
ptr += len*complex_elem_size;
|
||||||
@ -2800,7 +2800,7 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows )
|
|||||||
int n = dst.cols;
|
int n = dst.cols;
|
||||||
if( elem_size == (int)sizeof(float) )
|
if( elem_size == (int)sizeof(float) )
|
||||||
{
|
{
|
||||||
float* p0 = (float*)dst.data;
|
float* p0 = dst.ptr<float>();
|
||||||
size_t dstep = dst.step/sizeof(p0[0]);
|
size_t dstep = dst.step/sizeof(p0[0]);
|
||||||
for( i = 0; i < len; i++ )
|
for( i = 0; i < len; i++ )
|
||||||
{
|
{
|
||||||
@ -2816,7 +2816,7 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
double* p0 = (double*)dst.data;
|
double* p0 = dst.ptr<double>();
|
||||||
size_t dstep = dst.step/sizeof(p0[0]);
|
size_t dstep = dst.step/sizeof(p0[0]);
|
||||||
for( i = 0; i < len; i++ )
|
for( i = 0; i < len; i++ )
|
||||||
{
|
{
|
||||||
|
@ -955,10 +955,10 @@ double cv::invert( InputArray _src, OutputArray _dst, int method )
|
|||||||
SVD::compute(src, w, u, vt);
|
SVD::compute(src, w, u, vt);
|
||||||
SVD::backSubst(w, u, vt, Mat(), _dst);
|
SVD::backSubst(w, u, vt, Mat(), _dst);
|
||||||
return type == CV_32F ?
|
return type == CV_32F ?
|
||||||
(((float*)w.data)[0] >= FLT_EPSILON ?
|
(w.ptr<float>()[0] >= FLT_EPSILON ?
|
||||||
((float*)w.data)[n-1]/((float*)w.data)[0] : 0) :
|
w.ptr<float>()[n-1]/w.ptr<float>()[0] : 0) :
|
||||||
(((double*)w.data)[0] >= DBL_EPSILON ?
|
(w.ptr<double>()[0] >= DBL_EPSILON ?
|
||||||
((double*)w.data)[n-1]/((double*)w.data)[0] : 0);
|
w.ptr<double>()[n-1]/w.ptr<double>()[0] : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
CV_Assert( m == n );
|
CV_Assert( m == n );
|
||||||
@ -975,10 +975,10 @@ double cv::invert( InputArray _src, OutputArray _dst, int method )
|
|||||||
transpose(vt, u);
|
transpose(vt, u);
|
||||||
SVD::backSubst(w, u, vt, Mat(), _dst);
|
SVD::backSubst(w, u, vt, Mat(), _dst);
|
||||||
return type == CV_32F ?
|
return type == CV_32F ?
|
||||||
(((float*)w.data)[0] >= FLT_EPSILON ?
|
(w.ptr<float>()[0] >= FLT_EPSILON ?
|
||||||
((float*)w.data)[n-1]/((float*)w.data)[0] : 0) :
|
w.ptr<float>()[n-1]/w.ptr<float>()[0] : 0) :
|
||||||
(((double*)w.data)[0] >= DBL_EPSILON ?
|
(w.ptr<double>()[0] >= DBL_EPSILON ?
|
||||||
((double*)w.data)[n-1]/((double*)w.data)[0] : 0);
|
w.ptr<double>()[n-1]/w.ptr<double>()[0] : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
CV_Assert( method == DECOMP_LU || method == DECOMP_CHOLESKY );
|
CV_Assert( method == DECOMP_LU || method == DECOMP_CHOLESKY );
|
||||||
@ -988,7 +988,7 @@ double cv::invert( InputArray _src, OutputArray _dst, int method )
|
|||||||
|
|
||||||
if( n <= 3 )
|
if( n <= 3 )
|
||||||
{
|
{
|
||||||
uchar* srcdata = src.data;
|
const uchar* srcdata = src.data;
|
||||||
uchar* dstdata = dst.data;
|
uchar* dstdata = dst.data;
|
||||||
size_t srcstep = src.step;
|
size_t srcstep = src.step;
|
||||||
size_t dststep = dst.step;
|
size_t dststep = dst.step;
|
||||||
@ -1212,8 +1212,8 @@ bool cv::solve( InputArray _src, InputArray _src2arg, OutputArray _dst, int meth
|
|||||||
#define bf(y) ((float*)(bdata + y*src2step))[0]
|
#define bf(y) ((float*)(bdata + y*src2step))[0]
|
||||||
#define bd(y) ((double*)(bdata + y*src2step))[0]
|
#define bd(y) ((double*)(bdata + y*src2step))[0]
|
||||||
|
|
||||||
uchar* srcdata = src.data;
|
const uchar* srcdata = src.data;
|
||||||
uchar* bdata = _src2.data;
|
const uchar* bdata = _src2.data;
|
||||||
uchar* dstdata = dst.data;
|
uchar* dstdata = dst.data;
|
||||||
size_t srcstep = src.step;
|
size_t srcstep = src.step;
|
||||||
size_t src2step = _src2.step;
|
size_t src2step = _src2.step;
|
||||||
@ -1709,7 +1709,7 @@ cvEigenVV( CvArr* srcarr, CvArr* evectsarr, CvArr* evalsarr, double,
|
|||||||
eigen(src, evals, evects);
|
eigen(src, evals, evects);
|
||||||
if( evects0.data != evects.data )
|
if( evects0.data != evects.data )
|
||||||
{
|
{
|
||||||
uchar* p = evects0.data;
|
const uchar* p = evects0.data;
|
||||||
evects.convertTo(evects0, evects0.type());
|
evects.convertTo(evects0, evects0.type());
|
||||||
CV_Assert( p == evects0.data );
|
CV_Assert( p == evects0.data );
|
||||||
}
|
}
|
||||||
@ -1718,7 +1718,7 @@ cvEigenVV( CvArr* srcarr, CvArr* evectsarr, CvArr* evalsarr, double,
|
|||||||
eigen(src, evals);
|
eigen(src, evals);
|
||||||
if( evals0.data != evals.data )
|
if( evals0.data != evals.data )
|
||||||
{
|
{
|
||||||
uchar* p = evals0.data;
|
const uchar* p = evals0.data;
|
||||||
if( evals0.size() == evals.size() )
|
if( evals0.size() == evals.size() )
|
||||||
evals.convertTo(evals0, evals0.type());
|
evals.convertTo(evals0, evals0.type());
|
||||||
else if( evals0.type() == evals.type() )
|
else if( evals0.type() == evals.type() )
|
||||||
|
@ -346,7 +346,7 @@ static void finalizeHdr(Mat& m)
|
|||||||
if( d > 2 )
|
if( d > 2 )
|
||||||
m.rows = m.cols = -1;
|
m.rows = m.cols = -1;
|
||||||
if(m.u)
|
if(m.u)
|
||||||
m.data = m.datastart = m.u->data;
|
m.datastart = m.data = m.u->data;
|
||||||
if( m.data )
|
if( m.data )
|
||||||
{
|
{
|
||||||
m.datalimit = m.datastart + m.size[0]*m.step[0];
|
m.datalimit = m.datastart + m.size[0]*m.step[0];
|
||||||
@ -510,7 +510,7 @@ Mat::Mat(int _dims, const int* _sizes, int _type, void* _data, const size_t* _st
|
|||||||
datalimit(0), allocator(0), u(0), size(&rows)
|
datalimit(0), allocator(0), u(0), size(&rows)
|
||||||
{
|
{
|
||||||
flags |= CV_MAT_TYPE(_type);
|
flags |= CV_MAT_TYPE(_type);
|
||||||
data = datastart = (uchar*)_data;
|
datastart = data = (uchar*)_data;
|
||||||
setSize(*this, _dims, _sizes, _steps, true);
|
setSize(*this, _dims, _sizes, _steps, true);
|
||||||
finalizeHdr(*this);
|
finalizeHdr(*this);
|
||||||
}
|
}
|
||||||
@ -549,7 +549,7 @@ static Mat cvMatNDToMat(const CvMatND* m, bool copyData)
|
|||||||
|
|
||||||
if( !m )
|
if( !m )
|
||||||
return thiz;
|
return thiz;
|
||||||
thiz.data = thiz.datastart = m->data.ptr;
|
thiz.datastart = thiz.data = m->data.ptr;
|
||||||
thiz.flags |= CV_MAT_TYPE(m->type);
|
thiz.flags |= CV_MAT_TYPE(m->type);
|
||||||
int _sizes[CV_MAX_DIM];
|
int _sizes[CV_MAX_DIM];
|
||||||
size_t _steps[CV_MAX_DIM];
|
size_t _steps[CV_MAX_DIM];
|
||||||
@ -587,7 +587,7 @@ static Mat cvMatToMat(const CvMat* m, bool copyData)
|
|||||||
thiz.dims = 2;
|
thiz.dims = 2;
|
||||||
thiz.rows = m->rows;
|
thiz.rows = m->rows;
|
||||||
thiz.cols = m->cols;
|
thiz.cols = m->cols;
|
||||||
thiz.data = thiz.datastart = m->data.ptr;
|
thiz.datastart = thiz.data = m->data.ptr;
|
||||||
size_t esz = CV_ELEM_SIZE(m->type), minstep = thiz.cols*esz, _step = m->step;
|
size_t esz = CV_ELEM_SIZE(m->type), minstep = thiz.cols*esz, _step = m->step;
|
||||||
if( _step == 0 )
|
if( _step == 0 )
|
||||||
_step = minstep;
|
_step = minstep;
|
||||||
@ -597,7 +597,7 @@ static Mat cvMatToMat(const CvMat* m, bool copyData)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
thiz.data = thiz.datastart = thiz.dataend = 0;
|
thiz.datastart = thiz.dataend = thiz.data = 0;
|
||||||
Mat(m->rows, m->cols, m->type, m->data.ptr, m->step).copyTo(thiz);
|
Mat(m->rows, m->cols, m->type, m->data.ptr, m->step).copyTo(thiz);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -636,7 +636,7 @@ static Mat iplImageToMat(const IplImage* img, bool copyData)
|
|||||||
m.rows = img->roi->height;
|
m.rows = img->roi->height;
|
||||||
m.cols = img->roi->width;
|
m.cols = img->roi->width;
|
||||||
esz = CV_ELEM_SIZE(m.flags);
|
esz = CV_ELEM_SIZE(m.flags);
|
||||||
m.data = m.datastart = (uchar*)img->imageData +
|
m.datastart = m.data = (uchar*)img->imageData +
|
||||||
(selectedPlane ? (img->roi->coi - 1)*m.step*img->height : 0) +
|
(selectedPlane ? (img->roi->coi - 1)*m.step*img->height : 0) +
|
||||||
img->roi->yOffset*m.step[0] + img->roi->xOffset*esz;
|
img->roi->yOffset*m.step[0] + img->roi->xOffset*esz;
|
||||||
}
|
}
|
||||||
@ -5532,14 +5532,14 @@ double norm( const SparseMat& src, int normType )
|
|||||||
{
|
{
|
||||||
if( normType == NORM_INF )
|
if( normType == NORM_INF )
|
||||||
for( i = 0; i < N; i++, ++it )
|
for( i = 0; i < N; i++, ++it )
|
||||||
result = std::max(result, std::abs((double)*(const float*)it.ptr));
|
result = std::max(result, std::abs((double)it.value<float>()));
|
||||||
else if( normType == NORM_L1 )
|
else if( normType == NORM_L1 )
|
||||||
for( i = 0; i < N; i++, ++it )
|
for( i = 0; i < N; i++, ++it )
|
||||||
result += std::abs(*(const float*)it.ptr);
|
result += std::abs(it.value<float>());
|
||||||
else
|
else
|
||||||
for( i = 0; i < N; i++, ++it )
|
for( i = 0; i < N; i++, ++it )
|
||||||
{
|
{
|
||||||
double v = *(const float*)it.ptr;
|
double v = it.value<float>();
|
||||||
result += v*v;
|
result += v*v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5547,14 +5547,14 @@ double norm( const SparseMat& src, int normType )
|
|||||||
{
|
{
|
||||||
if( normType == NORM_INF )
|
if( normType == NORM_INF )
|
||||||
for( i = 0; i < N; i++, ++it )
|
for( i = 0; i < N; i++, ++it )
|
||||||
result = std::max(result, std::abs(*(const double*)it.ptr));
|
result = std::max(result, std::abs(it.value<double>()));
|
||||||
else if( normType == NORM_L1 )
|
else if( normType == NORM_L1 )
|
||||||
for( i = 0; i < N; i++, ++it )
|
for( i = 0; i < N; i++, ++it )
|
||||||
result += std::abs(*(const double*)it.ptr);
|
result += std::abs(it.value<double>());
|
||||||
else
|
else
|
||||||
for( i = 0; i < N; i++, ++it )
|
for( i = 0; i < N; i++, ++it )
|
||||||
{
|
{
|
||||||
double v = *(const double*)it.ptr;
|
double v = it.value<double>();
|
||||||
result += v*v;
|
result += v*v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5578,7 +5578,7 @@ void minMaxLoc( const SparseMat& src, double* _minval, double* _maxval, int* _mi
|
|||||||
float minval = FLT_MAX, maxval = -FLT_MAX;
|
float minval = FLT_MAX, maxval = -FLT_MAX;
|
||||||
for( i = 0; i < N; i++, ++it )
|
for( i = 0; i < N; i++, ++it )
|
||||||
{
|
{
|
||||||
float v = *(const float*)it.ptr;
|
float v = it.value<float>();
|
||||||
if( v < minval )
|
if( v < minval )
|
||||||
{
|
{
|
||||||
minval = v;
|
minval = v;
|
||||||
@ -5600,7 +5600,7 @@ void minMaxLoc( const SparseMat& src, double* _minval, double* _maxval, int* _mi
|
|||||||
double minval = DBL_MAX, maxval = -DBL_MAX;
|
double minval = DBL_MAX, maxval = -DBL_MAX;
|
||||||
for( i = 0; i < N; i++, ++it )
|
for( i = 0; i < N; i++, ++it )
|
||||||
{
|
{
|
||||||
double v = *(const double*)it.ptr;
|
double v = it.value<double>();
|
||||||
if( v < minval )
|
if( v < minval )
|
||||||
{
|
{
|
||||||
minval = v;
|
minval = v;
|
||||||
|
@ -782,7 +782,7 @@ cv::Scalar cv::mean( InputArray _src, InputArray _mask )
|
|||||||
int type = src.type();
|
int type = src.type();
|
||||||
if( !mask.empty() )
|
if( !mask.empty() )
|
||||||
{
|
{
|
||||||
typedef IppStatus (CV_STDCALL* ippiMaskMeanFuncC1)(const void *, int, void *, int, IppiSize, Ipp64f *);
|
typedef IppStatus (CV_STDCALL* ippiMaskMeanFuncC1)(const void *, int, const void *, int, IppiSize, Ipp64f *);
|
||||||
ippiMaskMeanFuncC1 ippFuncC1 =
|
ippiMaskMeanFuncC1 ippFuncC1 =
|
||||||
type == CV_8UC1 ? (ippiMaskMeanFuncC1)ippiMean_8u_C1MR :
|
type == CV_8UC1 ? (ippiMaskMeanFuncC1)ippiMean_8u_C1MR :
|
||||||
type == CV_16UC1 ? (ippiMaskMeanFuncC1)ippiMean_16u_C1MR :
|
type == CV_16UC1 ? (ippiMaskMeanFuncC1)ippiMean_16u_C1MR :
|
||||||
@ -795,7 +795,7 @@ cv::Scalar cv::mean( InputArray _src, InputArray _mask )
|
|||||||
return Scalar(res);
|
return Scalar(res);
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
typedef IppStatus (CV_STDCALL* ippiMaskMeanFuncC3)(const void *, int, void *, int, IppiSize, int, Ipp64f *);
|
typedef IppStatus (CV_STDCALL* ippiMaskMeanFuncC3)(const void *, int, const void *, int, IppiSize, int, Ipp64f *);
|
||||||
ippiMaskMeanFuncC3 ippFuncC3 =
|
ippiMaskMeanFuncC3 ippFuncC3 =
|
||||||
type == CV_8UC3 ? (ippiMaskMeanFuncC3)ippiMean_8u_C3CMR :
|
type == CV_8UC3 ? (ippiMaskMeanFuncC3)ippiMean_8u_C3CMR :
|
||||||
type == CV_16UC3 ? (ippiMaskMeanFuncC3)ippiMean_16u_C3CMR :
|
type == CV_16UC3 ? (ippiMaskMeanFuncC3)ippiMean_16u_C3CMR :
|
||||||
@ -1071,7 +1071,7 @@ void cv::meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv, Input
|
|||||||
int type = src.type();
|
int type = src.type();
|
||||||
if( !mask.empty() )
|
if( !mask.empty() )
|
||||||
{
|
{
|
||||||
typedef IppStatus (CV_STDCALL* ippiMaskMeanStdDevFuncC1)(const void *, int, void *, int, IppiSize, Ipp64f *, Ipp64f *);
|
typedef IppStatus (CV_STDCALL* ippiMaskMeanStdDevFuncC1)(const void *, int, const void *, int, IppiSize, Ipp64f *, Ipp64f *);
|
||||||
ippiMaskMeanStdDevFuncC1 ippFuncC1 =
|
ippiMaskMeanStdDevFuncC1 ippFuncC1 =
|
||||||
type == CV_8UC1 ? (ippiMaskMeanStdDevFuncC1)ippiMean_StdDev_8u_C1MR :
|
type == CV_8UC1 ? (ippiMaskMeanStdDevFuncC1)ippiMean_StdDev_8u_C1MR :
|
||||||
type == CV_16UC1 ? (ippiMaskMeanStdDevFuncC1)ippiMean_StdDev_16u_C1MR :
|
type == CV_16UC1 ? (ippiMaskMeanStdDevFuncC1)ippiMean_StdDev_16u_C1MR :
|
||||||
@ -1083,7 +1083,7 @@ void cv::meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv, Input
|
|||||||
return;
|
return;
|
||||||
setIppErrorStatus();
|
setIppErrorStatus();
|
||||||
}
|
}
|
||||||
typedef IppStatus (CV_STDCALL* ippiMaskMeanStdDevFuncC3)(const void *, int, void *, int, IppiSize, int, Ipp64f *, Ipp64f *);
|
typedef IppStatus (CV_STDCALL* ippiMaskMeanStdDevFuncC3)(const void *, int, const void *, int, IppiSize, int, Ipp64f *, Ipp64f *);
|
||||||
ippiMaskMeanStdDevFuncC3 ippFuncC3 =
|
ippiMaskMeanStdDevFuncC3 ippFuncC3 =
|
||||||
type == CV_8UC3 ? (ippiMaskMeanStdDevFuncC3)ippiMean_StdDev_8u_C3CMR :
|
type == CV_8UC3 ? (ippiMaskMeanStdDevFuncC3)ippiMean_StdDev_8u_C3CMR :
|
||||||
type == CV_16UC3 ? (ippiMaskMeanStdDevFuncC3)ippiMean_StdDev_16u_C3CMR :
|
type == CV_16UC3 ? (ippiMaskMeanStdDevFuncC3)ippiMean_StdDev_16u_C3CMR :
|
||||||
|
@ -582,7 +582,7 @@ Mat UMat::getMat(int accessFlags) const
|
|||||||
hdr.flags = flags;
|
hdr.flags = flags;
|
||||||
hdr.u = u;
|
hdr.u = u;
|
||||||
hdr.datastart = u->data;
|
hdr.datastart = u->data;
|
||||||
hdr.data = hdr.datastart + offset;
|
hdr.data = u->data + offset;
|
||||||
hdr.datalimit = hdr.dataend = u->data + u->size;
|
hdr.datalimit = hdr.dataend = u->data + u->size;
|
||||||
CV_XADD(&hdr.u->refcount, 1);
|
CV_XADD(&hdr.u->refcount, 1);
|
||||||
return hdr;
|
return hdr;
|
||||||
|
@ -427,7 +427,7 @@ BRISK::smoothedIntensity(const cv::Mat& image, const cv::Mat& integral, const fl
|
|||||||
if (dx + dy > 2)
|
if (dx + dy > 2)
|
||||||
{
|
{
|
||||||
// now the calculation:
|
// now the calculation:
|
||||||
uchar* ptr = image.data + x_left + imagecols * y_top;
|
const uchar* ptr = image.data + x_left + imagecols * y_top;
|
||||||
// first the corners:
|
// first the corners:
|
||||||
ret_val = A * int(*ptr);
|
ret_val = A * int(*ptr);
|
||||||
ptr += dx + 1;
|
ptr += dx + 1;
|
||||||
@ -475,7 +475,7 @@ BRISK::smoothedIntensity(const cv::Mat& image, const cv::Mat& integral, const fl
|
|||||||
}
|
}
|
||||||
|
|
||||||
// now the calculation:
|
// now the calculation:
|
||||||
uchar* ptr = image.data + x_left + imagecols * y_top;
|
const uchar* ptr = image.data + x_left + imagecols * y_top;
|
||||||
// first row:
|
// first row:
|
||||||
ret_val = A * int(*ptr);
|
ret_val = A * int(*ptr);
|
||||||
ptr++;
|
ptr++;
|
||||||
@ -487,7 +487,7 @@ BRISK::smoothedIntensity(const cv::Mat& image, const cv::Mat& integral, const fl
|
|||||||
ret_val += B * int(*ptr);
|
ret_val += B * int(*ptr);
|
||||||
// middle ones:
|
// middle ones:
|
||||||
ptr += imagecols - dx - 1;
|
ptr += imagecols - dx - 1;
|
||||||
uchar* end_j = ptr + dy * imagecols;
|
const uchar* end_j = ptr + dy * imagecols;
|
||||||
for (; ptr < end_j; ptr += imagecols - dx - 1)
|
for (; ptr < end_j; ptr += imagecols - dx - 1)
|
||||||
{
|
{
|
||||||
ret_val += r_x_1_i * int(*ptr);
|
ret_val += r_x_1_i * int(*ptr);
|
||||||
@ -607,7 +607,7 @@ BRISK::computeDescriptorsAndOrOrientation(InputArray _image, InputArray _mask, s
|
|||||||
int t2;
|
int t2;
|
||||||
|
|
||||||
// the feature orientation
|
// the feature orientation
|
||||||
uchar* ptr = descriptors.data;
|
const uchar* ptr = descriptors.data;
|
||||||
for (size_t k = 0; k < ksize; k++)
|
for (size_t k = 0; k < ksize; k++)
|
||||||
{
|
{
|
||||||
cv::KeyPoint& kp = keypoints[k];
|
cv::KeyPoint& kp = keypoints[k];
|
||||||
@ -1070,7 +1070,7 @@ BriskScaleSpace::isMax2D(const int layer, const int x_layer, const int y_layer)
|
|||||||
{
|
{
|
||||||
const cv::Mat& scores = pyramid_[layer].scores();
|
const cv::Mat& scores = pyramid_[layer].scores();
|
||||||
const int scorescols = scores.cols;
|
const int scorescols = scores.cols;
|
||||||
uchar* data = scores.data + y_layer * scorescols + x_layer;
|
const uchar* data = scores.data + y_layer * scorescols + x_layer;
|
||||||
// decision tree:
|
// decision tree:
|
||||||
const uchar center = (*data);
|
const uchar center = (*data);
|
||||||
data--;
|
data--;
|
||||||
@ -2140,7 +2140,7 @@ BriskLayer::value(const cv::Mat& mat, float xf, float yf, float scale_in) const
|
|||||||
const int r_y = (int)((yf - y) * 1024);
|
const int r_y = (int)((yf - y) * 1024);
|
||||||
const int r_x_1 = (1024 - r_x);
|
const int r_x_1 = (1024 - r_x);
|
||||||
const int r_y_1 = (1024 - r_y);
|
const int r_y_1 = (1024 - r_y);
|
||||||
uchar* ptr = image.data + x + y * imagecols;
|
const uchar* ptr = image.data + x + y * imagecols;
|
||||||
// just interpolate:
|
// just interpolate:
|
||||||
ret_val = (r_x_1 * r_y_1 * int(*ptr));
|
ret_val = (r_x_1 * r_y_1 * int(*ptr));
|
||||||
ptr++;
|
ptr++;
|
||||||
@ -2186,7 +2186,7 @@ BriskLayer::value(const cv::Mat& mat, float xf, float yf, float scale_in) const
|
|||||||
const int r_y1_i = (int)(r_y1 * scaling);
|
const int r_y1_i = (int)(r_y1 * scaling);
|
||||||
|
|
||||||
// now the calculation:
|
// now the calculation:
|
||||||
uchar* ptr = image.data + x_left + imagecols * y_top;
|
const uchar* ptr = image.data + x_left + imagecols * y_top;
|
||||||
// first row:
|
// first row:
|
||||||
ret_val = A * int(*ptr);
|
ret_val = A * int(*ptr);
|
||||||
ptr++;
|
ptr++;
|
||||||
@ -2198,7 +2198,7 @@ BriskLayer::value(const cv::Mat& mat, float xf, float yf, float scale_in) const
|
|||||||
ret_val += B * int(*ptr);
|
ret_val += B * int(*ptr);
|
||||||
// middle ones:
|
// middle ones:
|
||||||
ptr += imagecols - dx - 1;
|
ptr += imagecols - dx - 1;
|
||||||
uchar* end_j = ptr + dy * imagecols;
|
const uchar* end_j = ptr + dy * imagecols;
|
||||||
for (; ptr < end_j; ptr += imagecols - dx - 1)
|
for (; ptr < end_j; ptr += imagecols - dx - 1)
|
||||||
{
|
{
|
||||||
ret_val += r_x_1_i * int(*ptr);
|
ret_val += r_x_1_i * int(*ptr);
|
||||||
|
@ -154,7 +154,7 @@ bool Jpeg2KDecoder::readData( Mat& img )
|
|||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
int color = img.channels() > 1;
|
int color = img.channels() > 1;
|
||||||
uchar* data = img.data;
|
uchar* data = img.ptr();
|
||||||
int step = (int)img.step;
|
int step = (int)img.step;
|
||||||
jas_stream_t* stream = (jas_stream_t*)m_stream;
|
jas_stream_t* stream = (jas_stream_t*)m_stream;
|
||||||
jas_image_t* image = (jas_image_t*)m_image;
|
jas_image_t* image = (jas_image_t*)m_image;
|
||||||
@ -478,7 +478,7 @@ bool Jpeg2KEncoder::writeComponent8u( void *__img, const Mat& _img )
|
|||||||
|
|
||||||
for( int y = 0; y < h; y++ )
|
for( int y = 0; y < h; y++ )
|
||||||
{
|
{
|
||||||
uchar* data = _img.data + _img.step*y;
|
const uchar* data = _img.ptr(y);
|
||||||
for( int i = 0; i < ncmpts; i++ )
|
for( int i = 0; i < ncmpts; i++ )
|
||||||
{
|
{
|
||||||
for( int x = 0; x < w; x++)
|
for( int x = 0; x < w; x++)
|
||||||
@ -502,7 +502,7 @@ bool Jpeg2KEncoder::writeComponent16u( void *__img, const Mat& _img )
|
|||||||
|
|
||||||
for( int y = 0; y < h; y++ )
|
for( int y = 0; y < h; y++ )
|
||||||
{
|
{
|
||||||
uchar* data = _img.data + _img.step*y;
|
const uchar* data = _img.ptr(y);
|
||||||
for( int i = 0; i < ncmpts; i++ )
|
for( int i = 0; i < ncmpts; i++ )
|
||||||
{
|
{
|
||||||
for( int x = 0; x < w; x++)
|
for( int x = 0; x < w; x++)
|
||||||
|
@ -228,7 +228,7 @@ int CV_MorphologyBaseTest::prepare_test_case( int test_case_idx )
|
|||||||
if( shape == CV_SHAPE_CUSTOM )
|
if( shape == CV_SHAPE_CUSTOM )
|
||||||
{
|
{
|
||||||
eldata.resize(aperture_size.width*aperture_size.height);
|
eldata.resize(aperture_size.width*aperture_size.height);
|
||||||
uchar* src = test_mat[INPUT][1].data;
|
const uchar* src = test_mat[INPUT][1].data;
|
||||||
int srcstep = (int)test_mat[INPUT][1].step;
|
int srcstep = (int)test_mat[INPUT][1].step;
|
||||||
int i, j, nonzero = 0;
|
int i, j, nonzero = 0;
|
||||||
|
|
||||||
|
@ -344,7 +344,7 @@ static void test_remap( const Mat& src, Mat& dst, const Mat& mapx, const Mat& ma
|
|||||||
int x, y, k;
|
int x, y, k;
|
||||||
int drows = dst.rows, dcols = dst.cols;
|
int drows = dst.rows, dcols = dst.cols;
|
||||||
int srows = src.rows, scols = src.cols;
|
int srows = src.rows, scols = src.cols;
|
||||||
uchar* sptr0 = src.data;
|
const uchar* sptr0 = src.data;
|
||||||
int depth = src.depth(), cn = src.channels();
|
int depth = src.depth(), cn = src.channels();
|
||||||
int elem_size = (int)src.elemSize();
|
int elem_size = (int)src.elemSize();
|
||||||
int step = (int)(src.step / CV_ELEM_SIZE(depth));
|
int step = (int)(src.step / CV_ELEM_SIZE(depth));
|
||||||
|
@ -532,7 +532,7 @@ void CV_Resize_Test::resize_1d(const Mat& _src, Mat& _dst, int dy, const dim& _d
|
|||||||
ofs = 3, ksize = 8;
|
ofs = 3, ksize = 8;
|
||||||
|
|
||||||
Mat _extended_src_row(1, _src.cols + ksize * 2, _src.type());
|
Mat _extended_src_row(1, _src.cols + ksize * 2, _src.type());
|
||||||
uchar* srow = _src.data + dy * _src.step;
|
const uchar* srow = _src.ptr(dy);
|
||||||
memcpy(_extended_src_row.data + elemsize * ksize, srow, _src.step);
|
memcpy(_extended_src_row.data + elemsize * ksize, srow, _src.step);
|
||||||
for (int k = 0; k < ksize; ++k)
|
for (int k = 0; k < ksize; ++k)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user