Several type of formal refactoring:
1. someMatrix.data -> someMatrix.prt() 2. someMatrix.data + someMatrix.step * lineIndex -> someMatrix.ptr( lineIndex ) 3. (SomeType*) someMatrix.data -> someMatrix.ptr<SomeType>() 4. someMatrix.data -> !someMatrix.empty() ( or !someMatrix.data -> someMatrix.empty() ) in logical expressions
This commit is contained in:
@@ -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++ )
|
||||
{
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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++ )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user